From 6a8181e3c40d9b4f5eb644c2cad79fc7866ba767 Mon Sep 17 00:00:00 2001 From: Jim Fehlig Date: Mon, 30 Jul 2012 21:10:19 -0600 Subject: Don't pass kernel args to Xen HVM instances The refactoring in commit c0f67877 missed setting guest.os_root for Xen PV instances only. If set for Xen HVM instances, the xen tools will invoke qemu-dm with '-append root=/dev/xxx'. qemu-dm promptly failes with '-append only allowed with -kernel option'. Change-Id: Iba8054b728e28463fb221d44417b1ddba323f596 --- nova/tests/test_libvirt.py | 9 +++++++++ nova/virt/libvirt/driver.py | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/nova/tests/test_libvirt.py b/nova/tests/test_libvirt.py index 10ed64429..6040f2d51 100644 --- a/nova/tests/test_libvirt.py +++ b/nova/tests/test_libvirt.py @@ -1422,6 +1422,15 @@ class LibvirtConnTestCase(test.TestCase): check = (lambda t: t.find('./os/kernel'), None) check_list.append(check) + # Hypervisors that only support vm_mode.HVM should + # not produce configuration that results in kernel + # arguments + if not expect_kernel and hypervisor_type in ['qemu', 'kvm']: + check = (lambda t: t.find('./os/root'), None) + check_list.append(check) + check = (lambda t: t.find('./os/cmdline'), None) + check_list.append(check) + if expect_ramdisk: check = (lambda t: t.find('./os/initrd').text.split( '/')[1], 'ramdisk' + suffix) diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index fa4fbc4c6..b8c39b3fa 100644 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -1740,7 +1740,7 @@ class LibvirtDriver(driver.ComputeDriver): guest.os_kernel = "/usr/bin/linux" guest.os_root = root_device_name or "/dev/ubda" else: - if FLAGS.libvirt_type == "xen": + if FLAGS.libvirt_type == "xen" and guest.os_type == vm_mode.XEN: guest.os_root = root_device_name or "/dev/xvda" else: guest.os_type = vm_mode.HVM -- cgit