Update libvirt enlightenments for Windows
libvirt has a set of enlightenments in domain XML that make it friendlier for Windows guests. We already enabled a few of these, this patch just completes the list. All of them are available in libvirt 4.7.0 (QEMU 3.0) [1], which is way below our current minimum libvirt and QEMU versions, so we don't need any extra checks. [1] https://libvirt.org/formatdomain.html#hypervisor-features Implements: bp/libvirt-update-windows-englightenments Change-Id: I008841988547573878c4e06e82f0fa55084e51b5
This commit is contained in:
parent
c53ec4e488
commit
57ab45323c
@ -2318,6 +2318,15 @@ class LibvirtConfigGuestFeatureTest(LibvirtConfigBaseTest):
|
|||||||
obj.vapic = True
|
obj.vapic = True
|
||||||
obj.spinlocks = True
|
obj.spinlocks = True
|
||||||
obj.vendorid_spoof = True
|
obj.vendorid_spoof = True
|
||||||
|
obj.vpindex = True
|
||||||
|
obj.runtime = True
|
||||||
|
obj.synic = True
|
||||||
|
obj.reset = True
|
||||||
|
obj.frequencies = True
|
||||||
|
obj.reenlightenment = True
|
||||||
|
obj.tlbflush = True
|
||||||
|
obj.ipi = True
|
||||||
|
obj.evmcs = True
|
||||||
|
|
||||||
xml = obj.to_xml()
|
xml = obj.to_xml()
|
||||||
self.assertXmlEqual(xml, """
|
self.assertXmlEqual(xml, """
|
||||||
@ -2326,6 +2335,15 @@ class LibvirtConfigGuestFeatureTest(LibvirtConfigBaseTest):
|
|||||||
<vapic state="on"/>
|
<vapic state="on"/>
|
||||||
<spinlocks state="on" retries="4095"/>
|
<spinlocks state="on" retries="4095"/>
|
||||||
<vendor_id state="on" value="1234567890ab"/>
|
<vendor_id state="on" value="1234567890ab"/>
|
||||||
|
<vpindex state='on'/>
|
||||||
|
<runtime state='on'/>
|
||||||
|
<synic state='on'/>
|
||||||
|
<reset state='on'/>
|
||||||
|
<frequencies state='on'/>
|
||||||
|
<reenlightenment state='on'/>
|
||||||
|
<tlbflush state='on'/>
|
||||||
|
<ipi state='on'/>
|
||||||
|
<evmcs state='on'/>
|
||||||
</hyperv>""")
|
</hyperv>""")
|
||||||
|
|
||||||
def test_feature_pmu(self):
|
def test_feature_pmu(self):
|
||||||
|
@ -27172,6 +27172,35 @@ class LibvirtDriverTestCase(test.NoDBTestCase, TraitsComparisonMixin):
|
|||||||
mock_get_guest.return_value.assert_not_called()
|
mock_get_guest.return_value.assert_not_called()
|
||||||
self.assertIsNone(mock_find.call_args.args[3])
|
self.assertIsNone(mock_find.call_args.args[3])
|
||||||
|
|
||||||
|
def test_set_features_windows(self):
|
||||||
|
self.flags(virt_type='kvm', group='libvirt')
|
||||||
|
guest = vconfig.LibvirtConfigGuest()
|
||||||
|
self.drvr._set_features(
|
||||||
|
guest, 'windows',
|
||||||
|
objects.ImageMeta(
|
||||||
|
properties=objects.ImageMetaProps()
|
||||||
|
),
|
||||||
|
objects.Flavor(extra_specs={})
|
||||||
|
)
|
||||||
|
features = guest.features
|
||||||
|
hv = None
|
||||||
|
for feature in features:
|
||||||
|
if feature.root_name == 'hyperv':
|
||||||
|
hv = feature
|
||||||
|
self.assertTrue(hv.relaxed)
|
||||||
|
self.assertTrue(hv.vapic)
|
||||||
|
self.assertTrue(hv.spinlocks)
|
||||||
|
self.assertEqual(8191, hv.spinlock_retries)
|
||||||
|
self.assertTrue(hv.vpindex)
|
||||||
|
self.assertTrue(hv.runtime)
|
||||||
|
self.assertTrue(hv.synic)
|
||||||
|
self.assertTrue(hv.reset)
|
||||||
|
self.assertTrue(hv.frequencies)
|
||||||
|
self.assertTrue(hv.reenlightenment)
|
||||||
|
self.assertTrue(hv.tlbflush)
|
||||||
|
self.assertTrue(hv.ipi)
|
||||||
|
self.assertTrue(hv.evmcs)
|
||||||
|
|
||||||
|
|
||||||
class LibvirtVolumeUsageTestCase(test.NoDBTestCase):
|
class LibvirtVolumeUsageTestCase(test.NoDBTestCase):
|
||||||
"""Test for LibvirtDriver.get_all_volume_usage."""
|
"""Test for LibvirtDriver.get_all_volume_usage."""
|
||||||
|
@ -2732,6 +2732,15 @@ class LibvirtConfigGuestFeatureHyperV(LibvirtConfigGuestFeature):
|
|||||||
self.vapic = False
|
self.vapic = False
|
||||||
self.spinlocks = False
|
self.spinlocks = False
|
||||||
self.spinlock_retries = self.MIN_SPINLOCK_RETRIES
|
self.spinlock_retries = self.MIN_SPINLOCK_RETRIES
|
||||||
|
self.vpindex = False
|
||||||
|
self.runtime = False
|
||||||
|
self.synic = False
|
||||||
|
self.reset = False
|
||||||
|
self.frequencies = False
|
||||||
|
self.reenlightenment = False
|
||||||
|
self.tlbflush = False
|
||||||
|
self.ipi = False
|
||||||
|
self.evmcs = False
|
||||||
self.vendorid_spoof = False
|
self.vendorid_spoof = False
|
||||||
self.vendorid = self.SPOOFED_VENDOR_ID
|
self.vendorid = self.SPOOFED_VENDOR_ID
|
||||||
|
|
||||||
@ -2748,6 +2757,24 @@ class LibvirtConfigGuestFeatureHyperV(LibvirtConfigGuestFeature):
|
|||||||
if self.vendorid_spoof:
|
if self.vendorid_spoof:
|
||||||
root.append(etree.Element("vendor_id", state="on",
|
root.append(etree.Element("vendor_id", state="on",
|
||||||
value=self.vendorid))
|
value=self.vendorid))
|
||||||
|
if self.vpindex:
|
||||||
|
root.append(etree.Element('vpindex', state='on'))
|
||||||
|
if self.runtime:
|
||||||
|
root.append(etree.Element('runtime', state='on'))
|
||||||
|
if self.synic:
|
||||||
|
root.append(etree.Element('synic', state='on'))
|
||||||
|
if self.reset:
|
||||||
|
root.append(etree.Element('reset', state='on'))
|
||||||
|
if self.frequencies:
|
||||||
|
root.append(etree.Element('frequencies', state='on'))
|
||||||
|
if self.reenlightenment:
|
||||||
|
root.append(etree.Element('reenlightenment', state='on'))
|
||||||
|
if self.tlbflush:
|
||||||
|
root.append(etree.Element('tlbflush', state='on'))
|
||||||
|
if self.ipi:
|
||||||
|
root.append(etree.Element('ipi', state='on'))
|
||||||
|
if self.evmcs:
|
||||||
|
root.append(etree.Element('evmcs', state='on'))
|
||||||
|
|
||||||
return root
|
return root
|
||||||
|
|
||||||
|
@ -6080,6 +6080,15 @@ class LibvirtDriver(driver.ComputeDriver):
|
|||||||
# with Microsoft
|
# with Microsoft
|
||||||
hv.spinlock_retries = 8191
|
hv.spinlock_retries = 8191
|
||||||
hv.vapic = True
|
hv.vapic = True
|
||||||
|
hv.vpindex = True
|
||||||
|
hv.runtime = True
|
||||||
|
hv.synic = True
|
||||||
|
hv.reset = True
|
||||||
|
hv.frequencies = True
|
||||||
|
hv.reenlightenment = True
|
||||||
|
hv.tlbflush = True
|
||||||
|
hv.ipi = True
|
||||||
|
hv.evmcs = True
|
||||||
|
|
||||||
# NOTE(kosamara): Spoofing the vendor_id aims to allow the nvidia
|
# NOTE(kosamara): Spoofing the vendor_id aims to allow the nvidia
|
||||||
# driver to work on windows VMs. At the moment, the nvidia driver
|
# driver to work on windows VMs. At the moment, the nvidia driver
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
The following enlightenments are now added by default to the libvirt XML for Windows guests:
|
||||||
|
|
||||||
|
* vpindex
|
||||||
|
* runtime
|
||||||
|
* synic
|
||||||
|
* reset
|
||||||
|
* frequencies
|
||||||
|
* reenlightenment
|
||||||
|
* tlbflush
|
||||||
|
* ipi
|
||||||
|
* evmc
|
||||||
|
|
||||||
|
This adds to the list of already existing enlightenments, namely:
|
||||||
|
|
||||||
|
* relaxed
|
||||||
|
* vapic
|
||||||
|
* spinlocks retries
|
||||||
|
* vendor_id spoofing
|
Loading…
Reference in New Issue
Block a user