-
Notifications
You must be signed in to change notification settings - Fork 6
Add RISC-V support #29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,7 +13,7 @@ | |
|
|
||
|
|
||
| def get_debian_image_url(version: str, arch: str) -> str: | ||
| arch_map = {"x86_64": "amd64", "aarch64": "arm64", "ppc64le": "ppc64el"} | ||
| arch_map = {"x86_64": "amd64", "aarch64": "arm64", "ppc64le": "ppc64el", "riscv64": "riscv64"} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| if arch not in arch_map: | ||
| log.error("Requested architecture is not supported by testcloud for Debian.") | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -125,6 +125,10 @@ def get_fedora_image_url(version: str, arch: str) -> str: | |
| if version == "latest": | ||
| version = str(oraculum_releases["fedora"]["stable"]) | ||
|
|
||
| # RISC-V image not released | ||
| if arch == "riscv64": | ||
| return "https://dl.fedoraproject.org/pub/alt/risc-v/release/42/Cloud/riscv64/images/Fedora-Cloud-Base-Generic-42.20250911-2251ba41cdd3.riscv64.qcow2" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @peeweep isn't there a way to not hardcode the URL here, at least find the latest image somehow or similar? |
||
|
|
||
| try: | ||
| releases = session.get("https://getfedora.org/releases.json").json() | ||
| except (ConnectionError, requests.exceptions.JSONDecodeError): | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -155,6 +155,37 @@ def generate(self) -> str: | |
| ) | ||
|
|
||
|
|
||
| class RISCV64ArchitectureConfiguration(ArchitectureConfiguration): | ||
| qemu = "qemu-system-riscv64" | ||
| arch = "riscv64" | ||
| model = "virt" | ||
|
|
||
| def __init__(self, kvm=True, uefi=True, model="virt") -> None: | ||
| self.kvm = kvm | ||
| self.uefi = uefi | ||
| self.model = model | ||
|
|
||
| def generate(self) -> str: | ||
| return """ | ||
| <os> | ||
| <type arch='{arch}' machine='{model}'>hvm</type> | ||
| {uefi_loader} | ||
| <boot dev='hd'/> | ||
| </os> | ||
| {cpu} | ||
| <memballoon model='virtio'></memballoon> | ||
| """.format( | ||
| arch=self.arch, | ||
| model=self.model, | ||
| uefi_loader="<loader readonly='yes' type='pflash'>/usr/share/edk2/riscv/RISCV_VIRT_CODE.qcow2</loader>", | ||
| cpu=( | ||
| "<cpu mode='host-passthrough' check='none'/>" | ||
| if self.kvm | ||
| else "<cpu mode='custom' match='exact'><model>rva23s64</model></cpu>" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it make sense to be more conservative here? e.g. use rather |
||
| ), | ||
| ) | ||
|
|
||
|
|
||
| def storage_device_name_generator(): | ||
| prefix = "vd" | ||
| for i in range(26): | ||
|
|
@@ -529,6 +560,8 @@ def _get_default_domain_conf( | |
| domain_configuration.system_architecture = Ppc64leArchitectureConfiguration(kvm=kvm, uefi=False, model="pseries") | ||
| elif desired_arch == "s390x": | ||
| domain_configuration.system_architecture = S390xArchitectureConfiguration(kvm=kvm, uefi=False, model="s390-ccw-virtio") | ||
| elif desired_arch == "riscv64": | ||
| domain_configuration.system_architecture = RISCV64ArchitectureConfiguration(kvm=kvm, uefi=True, model="virt") | ||
| else: | ||
| raise TestcloudInstanceError("Unsupported arch") | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I consider this change unexpected to the RISC-V support. Please update the MR description with the reason for this change.