diff --git a/0001-add-loongarch64-support-for-nova-27.3.0.patch b/0001-add-loongarch64-support-for-nova-27.3.0.patch new file mode 100644 index 0000000000000000000000000000000000000000..b2dd167b261fb68ec0e85e7f747558ec7e2bb455 --- /dev/null +++ b/0001-add-loongarch64-support-for-nova-27.3.0.patch @@ -0,0 +1,139 @@ +From 9a1ebb77ff326f6fe8a98c1de2516686e316926b Mon Sep 17 00:00:00 2001 +From: Wenlong Zhang +Date: Wed, 25 Jun 2025 02:29:51 +0000 +Subject: [PATCH] add loongarch64 support for nova-27.3.0 + +--- + nova/objects/fields.py | 1 + + nova/virt/arch.py | 3 ++- + nova/virt/libvirt/driver.py | 17 ++++++++++++++--- + nova/virt/libvirt/utils.py | 3 +++ + 4 files changed, 20 insertions(+), 4 deletions(-) + +diff --git a/nova/objects/fields.py b/nova/objects/fields.py +index cae1ea4..bb1234e 100644 +--- a/nova/objects/fields.py ++++ b/nova/objects/fields.py +@@ -137,6 +137,7 @@ class Architecture(BaseNovaEnum): + I686 = arch.I686 + IA64 = arch.IA64 + LM32 = arch.LM32 ++ LOONGARCH64 = arch.LOONGARCH64 + + M68K = arch.M68K + MICROBLAZE = arch.MICROBLAZE +diff --git a/nova/virt/arch.py b/nova/virt/arch.py +index 7518ab9..5997074 100644 +--- a/nova/virt/arch.py ++++ b/nova/virt/arch.py +@@ -23,6 +23,7 @@ CRIS = 'cris' + I686 = 'i686' + IA64 = 'ia64' + LM32 = 'lm32' ++LOONGARCH64 = 'loongarch64' + + M68K = 'm68k' + MICROBLAZE = 'microblaze' +@@ -56,7 +57,7 @@ XTENSAEB = 'xtensaeb' + + ALL = ( + ALPHA, ARMV6, ARMV7, ARMV7B, +- AARCH64, CRIS, I686, IA64, LM32, ++ AARCH64, CRIS, I686, IA64, LM32,LOONGARCH64, + M68K, MICROBLAZE, MICROBLAZEEL, MIPS, MIPSEL, + MIPS64, MIPS64EL, OPENRISC, PARISC, PARISC64, + PPC, PPCLE, PPC64, PPC64LE, PPCEMB, +diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py +index 68eece5..fba2c4c 100644 +--- a/nova/virt/libvirt/driver.py ++++ b/nova/virt/libvirt/driver.py +@@ -5353,6 +5353,8 @@ class LibvirtDriver(driver.ComputeDriver): + 'migration can break unless all compute nodes ' + 'have identical cpus. AArch64 does not support ' + 'other modes.') ++ elif arch == fields.Architecture.LOONGARCH64: ++ model = "la464" + else: + mode = "host-model" + if mode == "none": +@@ -5363,6 +5365,9 @@ class LibvirtDriver(driver.ComputeDriver): + if arch == fields.Architecture.AARCH64: + if not models: + models = ['max'] ++ if arch == fields.Architecture.LOONGARCH64: ++ if not models: ++ models = ["la464"] + + else: + if mode is None or mode == "none": +@@ -6315,6 +6320,8 @@ class LibvirtDriver(driver.ComputeDriver): + return 'virtio' + elif guestarch == fields.Architecture.MIPSEL: + return 'virtio' ++ elif guestarch == fields.Architecture.LOONGARCH64: ++ return 'virtio' + elif CONF.spice.enabled: + return 'qxl' + +@@ -6502,7 +6509,8 @@ class LibvirtDriver(driver.ComputeDriver): + caps = self._host.get_capabilities() + return self._host.supports_uefi and ( + hw_firmware_type == fields.FirmwareType.UEFI or +- caps.host.cpu.arch == fields.Architecture.AARCH64 ++ caps.host.cpu.arch == fields.Architecture.AARCH64 or ++ caps.host.cpu.arch == fields.Architecture.LOONGARCH64 + ) + + def _check_secure_boot_support( +@@ -6579,7 +6587,7 @@ class LibvirtDriver(driver.ComputeDriver): + + hw_firmware_type = image_meta.properties.get('hw_firmware_type') + +- if arch == fields.Architecture.AARCH64: ++ if arch == fields.Architecture.AARCH64 or arch == fields.Architecture.LOONGARCH64: + if not hw_firmware_type: + hw_firmware_type = fields.FirmwareType.UEFI + +@@ -6962,6 +6970,9 @@ class LibvirtDriver(driver.ComputeDriver): + 'q35' in guest.os_mach_type + ): + return True ++ if (caps.host.cpu.arch == fields.Architecture.LOONGARCH64 and ++ guest.os_mach_type.startswith('virt')): ++ return True + + return False + +@@ -7414,7 +7425,7 @@ class LibvirtDriver(driver.ComputeDriver): + # TODO(stephenfin): We might want to do this for other non-x86 + # architectures + arch = self._check_emulation_arch(image_meta) +- if arch != fields.Architecture.AARCH64: ++ if arch != fields.Architecture.AARCH64 and arch != fields.Architecture.LOONGARCH64: + return None + + bus = 'usb' +diff --git a/nova/virt/libvirt/utils.py b/nova/virt/libvirt/utils.py +index bec3b71..529b68f 100644 +--- a/nova/virt/libvirt/utils.py ++++ b/nova/virt/libvirt/utils.py +@@ -590,6 +590,8 @@ def get_cpu_model_from_arch(arch: str) -> str: + # that all the stuff it can currently emulate, both for "TCG" and "KVM" + elif arch == obj_fields.Architecture.AARCH64: + mode = 'max' ++ elif arch == obj_fields.Architecture.LOONGARCH64: ++ mode = 'la464' + return mode + + +@@ -633,6 +635,7 @@ def get_default_machine_type(arch: str) -> ty.Optional[str]: + obj_fields.Architecture.S390X: "s390-ccw-virtio", + obj_fields.Architecture.I686: "pc", + obj_fields.Architecture.X86_64: "pc", ++ obj_fields.Architecture.LOONGARCH64: "virt", + } + return default_mtypes.get(arch) + +-- +2.43.0 + diff --git a/openstack-nova.spec b/openstack-nova.spec index 129c8554b6cf96d18f5d6559181b772cdfb0b717..c991fcbc018e21ab5f3b5de4edaec6e4ff59f66f 100644 --- a/openstack-nova.spec +++ b/openstack-nova.spec @@ -17,7 +17,7 @@ Name: openstack-nova # Liberty semver reset # https://review.openstack.org/#/q/I6a35fa0dda798fad93b804d00a46af80f08d475c,n,z Version: 27.3.0 -Release: 1 +Release: 2 Summary: OpenStack Compute (nova) License: ASL 2.0 @@ -49,6 +49,7 @@ Source38: nova_migration_identity Source39: nova_migration_authorized_keys Source40: nova_migration-rootwrap.conf Source41: nova_migration-rootwrap_cold_migration +Patch001: 0001-add-loongarch64-support-for-nova-27.3.0.patch BuildArch: noarch @@ -727,6 +728,9 @@ exit 0 %endif %changelog +* Wed Jun 25 2025 Wenlong Zhang - 27.3.0-2 +- add loongarch64 support for nova-27.3.0 + * Tue May 21 2024 OpenStack_SIG - 27.3.0-1 - Upgrade package to version 27.3.0 - Update the value of qemu_version and libvirt_version macros to 2023.1 min limit