From 8dd6f153d6b8dfd8ae976e7f1c9df06019a159b9 Mon Sep 17 00:00:00 2001 From: Carlos Goncalves Date: Mon, 20 Jan 2020 07:24:17 +0100 Subject: [PATCH] Add LIBVIRT_CPU_MODE to set CPU mode In same cases, the hypervisor presents to the guest OS a named CPU model is similar to the host CPU and adds extra features to approximate the host model. However, this does not guarantee all features will be precisely match. This patch adds LIBVIRT_CPU_MODE to allow users to define the CPU mode they want to use, for example "host-passthrough". Change-Id: I83792c776b50d1d22584be2a37cc6a166f09c72b --- lib/nova | 1 + lib/nova_plugins/hypervisor-libvirt | 2 +- stackrc | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/nova b/lib/nova index 7557a51196..0893ed7084 100644 --- a/lib/nova +++ b/lib/nova @@ -259,6 +259,7 @@ function configure_nova { if [ ! -e /dev/kvm ]; then echo "WARNING: Switching to QEMU" LIBVIRT_TYPE=qemu + LIBVIRT_CPU_MODE=none 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 7d3ace8c1c..d1b3d784b7 100644 --- a/lib/nova_plugins/hypervisor-libvirt +++ b/lib/nova_plugins/hypervisor-libvirt @@ -39,7 +39,7 @@ function cleanup_nova_hypervisor { function configure_nova_hypervisor { configure_libvirt iniset $NOVA_CONF libvirt virt_type "$LIBVIRT_TYPE" - iniset $NOVA_CONF libvirt cpu_mode "none" + iniset $NOVA_CONF libvirt cpu_mode "$LIBVIRT_CPU_MODE" # 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 2d3a599a36..d581e48530 100644 --- a/stackrc +++ b/stackrc @@ -625,6 +625,7 @@ 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} 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