Skip to content

Commit 8dd6f15

Browse files
committed
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
1 parent 0d3f08f commit 8dd6f15

3 files changed

Lines changed: 3 additions & 1 deletion

File tree

lib/nova

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ function configure_nova {
259259
if [ ! -e /dev/kvm ]; then
260260
echo "WARNING: Switching to QEMU"
261261
LIBVIRT_TYPE=qemu
262+
LIBVIRT_CPU_MODE=none
262263
if which selinuxenabled >/dev/null 2>&1 && selinuxenabled; then
263264
# https://bugzilla.redhat.com/show_bug.cgi?id=753589
264265
sudo setsebool virt_use_execmem on

lib/nova_plugins/hypervisor-libvirt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function cleanup_nova_hypervisor {
3939
function configure_nova_hypervisor {
4040
configure_libvirt
4141
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"
4343
# Do not enable USB tablet input devices to avoid QEMU CPU overhead.
4444
iniset $NOVA_CONF DEFAULT pointer_model "ps2mouse"
4545
iniset $NOVA_CONF libvirt live_migration_uri "qemu+ssh://$STACK_USER@%s/system"

stackrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,7 @@ VIRT_DRIVER=${VIRT_DRIVER:-$DEFAULT_VIRT_DRIVER}
625625
case "$VIRT_DRIVER" in
626626
ironic|libvirt)
627627
LIBVIRT_TYPE=${LIBVIRT_TYPE:-kvm}
628+
LIBVIRT_CPU_MODE=${LIBVIRT_CPU_MODE:-none}
628629
if [[ "$os_VENDOR" =~ (Debian|Ubuntu) ]]; then
629630
# The groups change with newer libvirt. Older Ubuntu used
630631
# 'libvirtd', but now uses libvirt like Debian. Do a quick check

0 commit comments

Comments
 (0)