Browse code

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

Carlos Goncalves authored on 2020/01/20 15:24:17
Showing 3 changed files
... ...
@@ -259,6 +259,7 @@ function configure_nova {
259 259
                 if [ ! -e /dev/kvm ]; then
260 260
                     echo "WARNING: Switching to QEMU"
261 261
                     LIBVIRT_TYPE=qemu
262
+                    LIBVIRT_CPU_MODE=none
262 263
                     if which selinuxenabled >/dev/null 2>&1 && selinuxenabled; then
263 264
                         # https://bugzilla.redhat.com/show_bug.cgi?id=753589
264 265
                         sudo setsebool virt_use_execmem on
... ...
@@ -39,7 +39,7 @@ function cleanup_nova_hypervisor {
39 39
 function configure_nova_hypervisor {
40 40
     configure_libvirt
41 41
     iniset $NOVA_CONF libvirt virt_type "$LIBVIRT_TYPE"
42
-    iniset $NOVA_CONF libvirt cpu_mode "none"
42
+    iniset $NOVA_CONF libvirt cpu_mode "$LIBVIRT_CPU_MODE"
43 43
     # Do not enable USB tablet input devices to avoid QEMU CPU overhead.
44 44
     iniset $NOVA_CONF DEFAULT pointer_model "ps2mouse"
45 45
     iniset $NOVA_CONF libvirt live_migration_uri "qemu+ssh://$STACK_USER@%s/system"
... ...
@@ -625,6 +625,7 @@ VIRT_DRIVER=${VIRT_DRIVER:-$DEFAULT_VIRT_DRIVER}
625 625
 case "$VIRT_DRIVER" in
626 626
     ironic|libvirt)
627 627
         LIBVIRT_TYPE=${LIBVIRT_TYPE:-kvm}
628
+        LIBVIRT_CPU_MODE=${LIBVIRT_CPU_MODE:-none}
628 629
         if [[ "$os_VENDOR" =~ (Debian|Ubuntu) ]]; then
629 630
             # The groups change with newer libvirt. Older Ubuntu used
630 631
             # 'libvirtd', but now uses libvirt like Debian. Do a quick check