guest: Enable Hyper-v Enlightenments for Windows VMs
These are the recommended defaults for all windows VMs, when using a new enough libvirt + kvm. Some more details in this boxes bug report: https://bugzilla.gnome.org/show_bug.cgi?id=732811
This commit is contained in:
parent
cbb18b0e96
commit
8ea634f9e4
|
@ -13,6 +13,11 @@
|
|||
<acpi/>
|
||||
<apic/>
|
||||
<pae/>
|
||||
<hyperv>
|
||||
<relaxed state="on"/>
|
||||
<vapic state="on"/>
|
||||
<spinlocks state="on" retries="8191"/>
|
||||
</hyperv>
|
||||
</features>
|
||||
<cpu mode="custom" match="exact">
|
||||
<model>core2duo</model>
|
||||
|
@ -21,6 +26,7 @@
|
|||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
<timer name="hpet" present="no"/>
|
||||
<timer name="hypervclock" present="yes"/>
|
||||
</clock>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>destroy</on_reboot>
|
||||
|
@ -73,6 +79,11 @@
|
|||
<acpi/>
|
||||
<apic/>
|
||||
<pae/>
|
||||
<hyperv>
|
||||
<relaxed state="on"/>
|
||||
<vapic state="on"/>
|
||||
<spinlocks state="on" retries="8191"/>
|
||||
</hyperv>
|
||||
</features>
|
||||
<cpu mode="custom" match="exact">
|
||||
<model>core2duo</model>
|
||||
|
@ -81,6 +92,7 @@
|
|||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
<timer name="hpet" present="no"/>
|
||||
<timer name="hypervclock" present="yes"/>
|
||||
</clock>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>destroy</on_reboot>
|
||||
|
@ -133,6 +145,11 @@
|
|||
<acpi/>
|
||||
<apic/>
|
||||
<pae/>
|
||||
<hyperv>
|
||||
<relaxed state="on"/>
|
||||
<vapic state="on"/>
|
||||
<spinlocks state="on" retries="8191"/>
|
||||
</hyperv>
|
||||
</features>
|
||||
<cpu mode="custom" match="exact">
|
||||
<model>core2duo</model>
|
||||
|
@ -141,6 +158,7 @@
|
|||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
<timer name="hpet" present="no"/>
|
||||
<timer name="hypervclock" present="yes"/>
|
||||
</clock>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
|
|
|
@ -13,6 +13,11 @@
|
|||
<acpi/>
|
||||
<apic/>
|
||||
<pae/>
|
||||
<hyperv>
|
||||
<relaxed state="on"/>
|
||||
<vapic state="on"/>
|
||||
<spinlocks state="on" retries="8191"/>
|
||||
</hyperv>
|
||||
</features>
|
||||
<cpu>
|
||||
<topology sockets="1" cores="4" threads="1"/>
|
||||
|
@ -54,6 +59,11 @@
|
|||
<acpi/>
|
||||
<apic/>
|
||||
<pae/>
|
||||
<hyperv>
|
||||
<relaxed state="on"/>
|
||||
<vapic state="on"/>
|
||||
<spinlocks state="on" retries="8191"/>
|
||||
</hyperv>
|
||||
</features>
|
||||
<cpu>
|
||||
<topology sockets="1" cores="4" threads="1"/>
|
||||
|
@ -95,6 +105,11 @@
|
|||
<acpi/>
|
||||
<apic/>
|
||||
<pae/>
|
||||
<hyperv>
|
||||
<relaxed state="on"/>
|
||||
<vapic state="on"/>
|
||||
<spinlocks state="on" retries="8191"/>
|
||||
</hyperv>
|
||||
</features>
|
||||
<cpu>
|
||||
<topology sockets="1" cores="4" threads="1"/>
|
||||
|
|
|
@ -12,11 +12,17 @@
|
|||
<features>
|
||||
<acpi/>
|
||||
<apic/>
|
||||
<hyperv>
|
||||
<relaxed state="on"/>
|
||||
<vapic state="on"/>
|
||||
<spinlocks state="on" retries="8191"/>
|
||||
</hyperv>
|
||||
</features>
|
||||
<clock offset="localtime">
|
||||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
<timer name="hpet" present="no"/>
|
||||
<timer name="hypervclock" present="yes"/>
|
||||
</clock>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>destroy</on_reboot>
|
||||
|
|
|
@ -11,11 +11,17 @@
|
|||
<features>
|
||||
<acpi/>
|
||||
<apic/>
|
||||
<hyperv>
|
||||
<relaxed state="on"/>
|
||||
<vapic state="on"/>
|
||||
<spinlocks state="on" retries="8191"/>
|
||||
</hyperv>
|
||||
</features>
|
||||
<clock offset="localtime">
|
||||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
<timer name="hpet" present="no"/>
|
||||
<timer name="hypervclock" present="yes"/>
|
||||
</clock>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>destroy</on_reboot>
|
||||
|
|
|
@ -11,11 +11,17 @@
|
|||
<features>
|
||||
<acpi/>
|
||||
<apic/>
|
||||
<hyperv>
|
||||
<relaxed state="on"/>
|
||||
<vapic state="on"/>
|
||||
<spinlocks state="on" retries="8191"/>
|
||||
</hyperv>
|
||||
</features>
|
||||
<clock offset="localtime">
|
||||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
<timer name="hpet" present="no"/>
|
||||
<timer name="hypervclock" present="yes"/>
|
||||
</clock>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
|
|
|
@ -31,7 +31,8 @@ class _ClockTimer(XMLBuilder):
|
|||
class Clock(XMLBuilder):
|
||||
_XML_ROOT_NAME = "clock"
|
||||
|
||||
TIMER_NAMES = ["platform", "pit", "rtc", "hpet", "tsc", "kvmclock"]
|
||||
TIMER_NAMES = ["platform", "pit", "rtc", "hpet", "tsc", "kvmclock",
|
||||
"hypervclock"]
|
||||
|
||||
offset = XMLProperty("./@offset")
|
||||
timers = XMLChildProperty(_ClockTimer)
|
||||
|
|
|
@ -697,6 +697,9 @@ class Guest(XMLBuilder):
|
|||
# pit: While it has no effect on windows, it doesn't hurt and
|
||||
# is beneficial for linux
|
||||
#
|
||||
# If libvirt/qemu supports it and using a windows VM, also
|
||||
# specify hypervclock.
|
||||
#
|
||||
# This is what has been recommended by the RH qemu guys :)
|
||||
|
||||
rtc = self.clock.add_timer()
|
||||
|
@ -711,6 +714,12 @@ class Guest(XMLBuilder):
|
|||
hpet.name = "hpet"
|
||||
hpet.present = False
|
||||
|
||||
if (self._lookup_osdict_key("hyperv_features", False) and
|
||||
self.conn.check_support(self.conn.SUPPORT_CONN_HYPERV_CLOCK)):
|
||||
hyperv = self.clock.add_timer()
|
||||
hyperv.name = "hypervclock"
|
||||
hyperv.present = True
|
||||
|
||||
def _set_emulator_defaults(self):
|
||||
if self.os.is_xenpv():
|
||||
self.emulator = None
|
||||
|
@ -766,6 +775,17 @@ class Guest(XMLBuilder):
|
|||
if self.features.pae == "default":
|
||||
self.features.pae = self.conn.caps.support_pae()
|
||||
|
||||
if (self._lookup_osdict_key("hyperv_features", False) and
|
||||
self.conn.check_support(self.conn.SUPPORT_CONN_HYPERV_VAPIC)):
|
||||
if self.features.hyperv_relaxed is None:
|
||||
self.features.hyperv_relaxed = True
|
||||
if self.features.hyperv_vapic is None:
|
||||
self.features.hyperv_vapic = True
|
||||
if self.features.hyperv_spinlocks is None:
|
||||
self.features.hyperv_spinlocks = True
|
||||
if self.features.hyperv_spinlocks_retries is None:
|
||||
self.features.hyperv_spinlocks_retries = 8191
|
||||
|
||||
def _add_implied_controllers(self):
|
||||
for dev in self.get_all_devices():
|
||||
# Add spapr-vio controller if needed
|
||||
|
|
|
@ -151,6 +151,7 @@ class _OSVariant(object):
|
|||
@xen_disable_acpi: If True, disable acpi/apic for this OS if on old xen.
|
||||
This corresponds with the SUPPORT_CONN_CAN_DEFAULT_ACPI check
|
||||
@qemu_ga: If True, this distro has qemu_ga available by default
|
||||
@hyperv_features: If True, this distro prefers Hyper-V enlightenments
|
||||
|
||||
The rest of the parameters are about setting device/guest defaults
|
||||
based on the OS. They should be self explanatory. See guest.py for
|
||||
|
@ -166,7 +167,7 @@ class _OSVariant(object):
|
|||
videomodel=_SENTINEL, virtionet=_SENTINEL,
|
||||
virtiodisk=_SENTINEL, virtiommio=_SENTINEL,
|
||||
virtioconsole=_SENTINEL, xen_disable_acpi=_SENTINEL,
|
||||
qemu_ga=_SENTINEL):
|
||||
qemu_ga=_SENTINEL, hyperv_features=_SENTINEL):
|
||||
if is_type:
|
||||
if parent != _SENTINEL:
|
||||
raise RuntimeError("OS types must not specify parent")
|
||||
|
@ -229,6 +230,7 @@ class _OSVariant(object):
|
|||
self.virtiommio = _get_default("virtiommio", virtiommio)
|
||||
self.virtioconsole = _get_default("virtioconsole", virtioconsole)
|
||||
self.qemu_ga = _get_default("qemu_ga", qemu_ga)
|
||||
self.hyperv_features = _get_default("hyperv_features", hyperv_features)
|
||||
|
||||
def get_recommended_resources(self, arch):
|
||||
ignore1 = arch
|
||||
|
@ -396,6 +398,11 @@ class _OsVariantOsInfo(_OSVariant):
|
|||
return int(self._os.get_version()) >= 18 or _SENTINEL
|
||||
return _SENTINEL
|
||||
|
||||
def _is_hyperv_features(self):
|
||||
if _OsVariantOsInfo.is_windows(self._os):
|
||||
return True
|
||||
return _SENTINEL
|
||||
|
||||
def _get_typename(self):
|
||||
if self._os.get_family() in ['linux']:
|
||||
return "linux"
|
||||
|
@ -467,6 +474,7 @@ class _OsVariantOsInfo(_OSVariant):
|
|||
xen_disable_acpi = self._get_xen_disable_acpi()
|
||||
virtiommio = self._is_virtiommio()
|
||||
qemu_ga = self._is_qemu_ga()
|
||||
hyperv_features = self._is_hyperv_features()
|
||||
virtioconsole = lambda: self._is_virtioconsole()
|
||||
netmodel = lambda: self._get_netmodel()
|
||||
videomodel = lambda: self._get_videomodel()
|
||||
|
@ -483,7 +491,8 @@ class _OsVariantOsInfo(_OSVariant):
|
|||
inputtype=inputtype, inputbus=inputbus, videomodel=videomodel,
|
||||
virtionet=virtionet, virtiodisk=virtiodisk,
|
||||
virtiommio=virtiommio, virtioconsole=virtioconsole,
|
||||
xen_disable_acpi=xen_disable_acpi, qemu_ga=qemu_ga)
|
||||
xen_disable_acpi=xen_disable_acpi, qemu_ga=qemu_ga,
|
||||
hyperv_features=hyperv_features)
|
||||
|
||||
def get_recommended_resources(self, arch):
|
||||
ret = {}
|
||||
|
|
|
@ -294,6 +294,10 @@ SUPPORT_CONN_POOL_GLUSTERFS = _make(version="1.2.0")
|
|||
SUPPORT_CONN_CPU_MODEL_NAMES = _make(function="virConnect.getCPUModelNames",
|
||||
run_args=("x86_64", 0))
|
||||
SUPPORT_CONN_BARE_BACKINGSTORE = _make(version="1.2.4")
|
||||
SUPPORT_CONN_HYPERV_VAPIC = _make(
|
||||
version="1.1.0", hv_version={"qemu": "1.1.0", "test": 0})
|
||||
SUPPORT_CONN_HYPERV_CLOCK = _make(
|
||||
version="1.2.2", hv_version={"qemu": "2.0.0", "test": 0})
|
||||
|
||||
|
||||
# Domain checks
|
||||
|
|
Loading…
Reference in New Issue