From e06d954229fc4fca827105f5bb0809a19075d590 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Thu, 21 Oct 2021 08:15:12 -0700 Subject: [PATCH] Use Nehalem CPU model by default CentOS/RHEL 9 are being compiled for the x86_64-v2 architecture which is newer than the qemu default of qemu64. This means that for devstack to boot these instances we need a newer CPU model. Nehalem is apparently the oldest model that works for x86_64-v2 and is expected to work on Intel and AMD cpus with kvm or qemu. Switch devstack to this model by default. Note that we cannot use host-passthrough or host-model because we want to support live migration between devstack deployed nova-compute instances and even within the CI instances that we get the host CPUs can differ. Also, we should run this change against as many clouds as possible to ensure that the newer model works across all of our clouds. There is some fear that the virtual CPUs presented to us in some clouds may not be able to run these newer CPU models. Change-Id: Ibd6e11b59f3c8655bc60ace7383a08458b2177f2 --- lib/nova | 3 ++- lib/nova_plugins/hypervisor-libvirt | 3 +++ stackrc | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/nova b/lib/nova index bbb1039199..9aae2c4a9c 100644 --- a/lib/nova +++ b/lib/nova @@ -260,7 +260,8 @@ function configure_nova { if [ ! -e /dev/kvm ]; then echo "WARNING: Switching to QEMU" LIBVIRT_TYPE=qemu - LIBVIRT_CPU_MODE=none + LIBVIRT_CPU_MODE=custom + LIBVIRT_CPU_MODEL=Nehalem if which selinuxenabled >/dev/null 2>&1 && selinuxenabled; then # https://bugzilla.redhat.com/show_bug.cgi?id=753589 sudo setsebool virt_use_execmem on diff --git a/lib/nova_plugins/hypervisor-libvirt b/lib/nova_plugins/hypervisor-libvirt index 321775d324..c1cd132548 100644 --- a/lib/nova_plugins/hypervisor-libvirt +++ b/lib/nova_plugins/hypervisor-libvirt @@ -40,6 +40,9 @@ function configure_nova_hypervisor { configure_libvirt iniset $NOVA_CONF libvirt virt_type "$LIBVIRT_TYPE" iniset $NOVA_CONF libvirt cpu_mode "$LIBVIRT_CPU_MODE" + if [ "$LIBVIRT_CPU_MODE" == "custom" ] ; then + iniset $NOVA_CONF libvirt cpu_model "$LIBVIRT_CPU_MODEL" + fi # Do not enable USB tablet input devices to avoid QEMU CPU overhead. iniset $NOVA_CONF DEFAULT pointer_model "ps2mouse" iniset $NOVA_CONF libvirt live_migration_uri "qemu+ssh://$STACK_USER@%s/system" diff --git a/stackrc b/stackrc index 3dc800af2d..ebe472c033 100755 --- a/stackrc +++ b/stackrc @@ -623,7 +623,8 @@ VIRT_DRIVER=${VIRT_DRIVER:-$DEFAULT_VIRT_DRIVER} case "$VIRT_DRIVER" in ironic|libvirt) LIBVIRT_TYPE=${LIBVIRT_TYPE:-kvm} - LIBVIRT_CPU_MODE=${LIBVIRT_CPU_MODE:-none} + LIBVIRT_CPU_MODE=${LIBVIRT_CPU_MODE:-custom} + LIBVIRT_CPU_MODEL=${LIBVIRT_CPU_MODEL:-Nehalem} if [[ "$os_VENDOR" =~ (Debian|Ubuntu) ]]; then # The groups change with newer libvirt. Older Ubuntu used # 'libvirtd', but now uses libvirt like Debian. Do a quick check