From 4d430e7358dbecb40dff8676da340700b52c5cbd Mon Sep 17 00:00:00 2001 From: zhaixiaojuan Date: Tue, 11 Jun 2024 23:23:07 -0400 Subject: [PATCH] Add loongarch64 support (cherry picked from commit 6d6208b551b7444d68201a10f47a2d7a59918bfc) --- add-loongarch64-support.patch | 36 +++++++++++++++++++++++++++++++++++ openstack-nova.spec | 10 ++++++++-- 2 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 add-loongarch64-support.patch diff --git a/add-loongarch64-support.patch b/add-loongarch64-support.patch new file mode 100644 index 0000000..adc6a7b --- /dev/null +++ b/add-loongarch64-support.patch @@ -0,0 +1,36 @@ +diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py +index 8719d67..db255a5 100644 +--- a/nova/virt/libvirt/driver.py ++++ b/nova/virt/libvirt/driver.py +@@ -5053,6 +5053,9 @@ class LibvirtDriver(driver.ComputeDriver): + 'migration can break unless all compute nodes ' + 'have identical cpus. AArch64 does not support ' + 'other modes.') ++ elif caps.host.cpu.arch == fields.Architecture.LOONGARCH64: ++ mode = "custom" ++ model = "la464" + else: + mode = "host-model" + if mode == "none": +@@ -5063,6 +5066,9 @@ class LibvirtDriver(driver.ComputeDriver): + if arch == fields.Architecture.AARCH64: + if not models: + models = ['max'] ++ if caps.host.cpu.arch == fields.Architecture.LOONGARCH64: ++ if not models: ++ models = ["la464"] + + else: + if mode is None or mode == "none": +diff --git a/nova/virt/libvirt/utils.py b/nova/virt/libvirt/utils.py +index da2a6e8..8708f3c 100644 +--- a/nova/virt/libvirt/utils.py ++++ b/nova/virt/libvirt/utils.py +@@ -572,6 +572,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) + diff --git a/openstack-nova.spec b/openstack-nova.spec index dfbefae..063a137 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: 23.2.2 -Release: 1 +Release: 2 Summary: OpenStack Compute (nova) License: ASL 2.0 @@ -50,6 +50,8 @@ Source39: nova_migration_authorized_keys Source40: nova_migration-rootwrap.conf Source41: nova_migration-rootwrap_cold_migration +Patch01: add-loongarch64-support.patch + BuildArch: noarch BuildRequires: openstack-macros @@ -394,7 +396,7 @@ This package contains documentation files for nova. %endif %prep -%autosetup -n nova-%{upstream_version} +%autosetup -n nova-%{upstream_version} -p1 find . \( -name .gitignore -o -name .placeholder \) -delete @@ -404,6 +406,7 @@ find nova -name \*.py -exec sed -i '/\/usr\/bin\/env python/{d;q}' {} + # to distutils requiers_dist config %py_req_cleanup + %build PYTHONPATH=. oslo-config-generator --config-file=etc/nova/nova-config-generator.conf # Generate a sample policy.yaml file for documentation purposes only @@ -723,6 +726,9 @@ exit 0 %endif %changelog +* Tue Jun 11 2024 zhaixiaojuan - 23.2.2-2 +- Add loongarch64 support + * Sat May 06 2023 wangxiyuan - 23.2.2-1 - Update to 23.2.2 -- Gitee