libvirt-xen: don't request features ACPI or APIC with PV guest.

Those are HVM features only.

Also, fix unit test.

Change-Id: I5f3630626c6bc908ee3456203ca38f3c57231782
This commit is contained in:
Anthony PERARD 2014-11-24 17:13:34 +00:00
parent 3d88cfcc13
commit e4d4283119
2 changed files with 3 additions and 6 deletions

View File

@ -2564,13 +2564,9 @@ class LibvirtConnTestCase(test.NoDBTestCase):
cfg = drvr._get_guest_config(instance_ref, [], {}, disk_info) cfg = drvr._get_guest_config(instance_ref, [], {}, disk_info)
self.assertEqual(cfg.os_type, vm_mode.XEN) self.assertEqual(cfg.os_type, vm_mode.XEN)
self.assertEqual(3, len(cfg.features)) self.assertEqual(1, len(cfg.features))
self.assertIsInstance(cfg.features[0], self.assertIsInstance(cfg.features[0],
vconfig.LibvirtConfigGuestFeaturePAE) vconfig.LibvirtConfigGuestFeaturePAE)
self.assertIsInstance(cfg.features[1],
vconfig.LibvirtConfigGuestFeatureACPI)
self.assertIsInstance(cfg.features[2],
vconfig.LibvirtConfigGuestFeatureAPIC)
@mock.patch.object(objects.Flavor, 'get_by_id') @mock.patch.object(objects.Flavor, 'get_by_id')
def test_get_guest_config_with_vnc_and_spice(self, mock_flavor): def test_get_guest_config_with_vnc_and_spice(self, mock_flavor):

View File

@ -3627,7 +3627,8 @@ class LibvirtDriver(driver.ComputeDriver):
if caps.host.cpu.arch in (arch.I686, arch.X86_64): if caps.host.cpu.arch in (arch.I686, arch.X86_64):
guest.features.append(vconfig.LibvirtConfigGuestFeaturePAE()) guest.features.append(vconfig.LibvirtConfigGuestFeaturePAE())
if virt_type not in ("lxc", "uml", "parallels"): if (virt_type not in ("lxc", "uml", "parallels", "xen") or
(virt_type == "xen" and guest.os_type == vm_mode.HVM)):
guest.features.append(vconfig.LibvirtConfigGuestFeatureACPI()) guest.features.append(vconfig.LibvirtConfigGuestFeatureACPI())
guest.features.append(vconfig.LibvirtConfigGuestFeatureAPIC()) guest.features.append(vconfig.LibvirtConfigGuestFeatureAPIC())