diff --git a/README.md b/README.md
index 5a5c159..404031c 100644
--- a/README.md
+++ b/README.md
@@ -112,7 +112,7 @@ the **virt-manager** tool.
Instances can be created with a different architecture than the host architecture. You'll need to have a proper
qemu binary installed for this to work (eg. qemu-system-aarch64-core for aarch64 on x86_64 on Fedora). Supported
-architectures in testcloud are: x86_64, aarch64, ppc64le, and s390x. Any combinations of these are supported.
+architectures in testcloud are: x86_64, aarch64, ppc64le, s390x, and riscv64. Any combinations of these are supported.
Some examples:
@@ -131,6 +131,11 @@ $ testcloud create centos-stream --arch x86_64
$ testcloud create fedora:rawhide --arch ppc64le
```
+```
+# Debian riscv64 on x86_64 (or any other)
+$ testcloud create debian:13 --arch riscv64
+```
+
### Starting, stopping, and removing an instance
Instances can be started and stopped using the `instance` interface of
diff --git a/testcloud/config.py b/testcloud/config.py
index 16a2d63..e2dc12e 100644
--- a/testcloud/config.py
+++ b/testcloud/config.py
@@ -273,8 +273,8 @@ def DATA_DIR(self, value):
"latest": "9",
}
- DEBIAN_RELEASE_MAP = {"10": "buster", "11": "bullseye", "12": "bookworm"}
- DEBIAN_LATEST = "12"
+ DEBIAN_RELEASE_MAP = {"10": "buster", "11": "bullseye", "12": "bookworm", "13": "trixie"}
+ DEBIAN_LATEST = "13"
DEBIAN_IMG_URL = "https://cloud.debian.org/images/cloud/%s/daily/latest/debian-%s-genericcloud-%s-daily.qcow2"
UBUNTU_RELEASES_API = "https://api.launchpad.net/devel/ubuntu/series"
diff --git a/testcloud/distro_utils/debian.py b/testcloud/distro_utils/debian.py
index 171f176..90b5c35 100644
--- a/testcloud/distro_utils/debian.py
+++ b/testcloud/distro_utils/debian.py
@@ -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"}
if arch not in arch_map:
log.error("Requested architecture is not supported by testcloud for Debian.")
diff --git a/testcloud/distro_utils/fedora.py b/testcloud/distro_utils/fedora.py
index 7c3d6c9..20e0cbd 100644
--- a/testcloud/distro_utils/fedora.py
+++ b/testcloud/distro_utils/fedora.py
@@ -152,6 +152,22 @@ def get_fedora_image_url(version: str, arch: str) -> str:
raise exceptions.TestcloudImageError
return str(url)
+ # RISC-V image not released
+ if arch == "riscv64":
+ images_url = "https://dl.fedoraproject.org/pub/alt/risc-v/release/%s/Cloud/riscv64/images/" % version
+ try:
+ response = session.get(images_url)
+ response.raise_for_status()
+ except Exception:
+ log.error("Couldn't fetch RISC-V image listing for Fedora %s" % version)
+ raise exceptions.TestcloudImageError
+ matches = re.findall(r'href="(Fedora-Cloud-Base-Generic-[^"]+\.riscv64\.qcow2)"', response.text)
+ if not matches:
+ log.error("No RISC-V Cloud Base image found for Fedora %s" % version)
+ raise exceptions.TestcloudImageError
+ matches.sort(reverse=True)
+ return images_url + matches[0]
+
try:
releases = session.get("https://getfedora.org/releases.json").json()
except (ConnectionError, requests.exceptions.JSONDecodeError):
diff --git a/testcloud/domain_configuration.py b/testcloud/domain_configuration.py
index e73b680..3194ebf 100644
--- a/testcloud/domain_configuration.py
+++ b/testcloud/domain_configuration.py
@@ -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 """
+
+ hvm
+ {uefi_loader}
+
+
+ {cpu}
+
+ """.format(
+ arch=self.arch,
+ model=self.model,
+ uefi_loader="/usr/share/edk2/riscv/RISCV_VIRT_CODE.qcow2",
+ cpu=(
+ ""
+ if self.kvm
+ else "rva23s64"
+ ),
+ )
+
+
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")