mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-10-26 17:25:22 +03:00
guest: break out disable_hyperv_for_uefi
Having this at set_uefi time complicates the domain XML building machinery, where we don't want things to have osinfo access. Rearrange it so that editing cases call this explicitly, and the XML builder just deals with it at the set_defaults time
This commit is contained in:
parent
8c8fec6cb1
commit
d9729855ee
@ -540,6 +540,7 @@ class vmmDomain(vmmLibvirtObject):
|
||||
else:
|
||||
# Implies UEFI
|
||||
guest.set_uefi_path(loader)
|
||||
guest.disable_hyperv_for_uefi()
|
||||
|
||||
if nvram != _SENTINEL:
|
||||
guest.os.nvram = nvram
|
||||
|
@ -2223,6 +2223,8 @@ class ParserBoot(VirtCLIParser):
|
||||
|
||||
def set_uefi_cb(self, inst, val, virtarg):
|
||||
self.guest.set_uefi_path(self.guest.get_uefi_path())
|
||||
if self.editing:
|
||||
self.guest.disable_hyperv_for_uefi()
|
||||
|
||||
def set_initargs_cb(self, inst, val, virtarg):
|
||||
inst.set_initargs_string(val)
|
||||
|
@ -560,6 +560,10 @@ class Guest(XMLBuilder):
|
||||
|
||||
return path
|
||||
|
||||
def is_uefi(self):
|
||||
return bool(self.os.loader and
|
||||
self.os.loader_type == "pflash")
|
||||
|
||||
def set_uefi_path(self, path):
|
||||
"""
|
||||
Configure UEFI for the VM, but only if libvirt is advertising
|
||||
@ -582,15 +586,19 @@ class Guest(XMLBuilder):
|
||||
self.os.loader_secure = True
|
||||
self.os.machine = "q35"
|
||||
|
||||
def disable_hyperv_for_uefi(self):
|
||||
# UEFI doesn't work with hyperv bits for some OS
|
||||
if self.osinfo.broken_uefi_with_hyperv():
|
||||
self.features.hyperv_relaxed = None
|
||||
self.features.hyperv_vapic = None
|
||||
self.features.hyperv_spinlocks = None
|
||||
self.features.hyperv_spinlocks_retries = None
|
||||
for i in self.clock.timers:
|
||||
if i.name == "hypervclock":
|
||||
self.clock.timers.remove(i)
|
||||
if not self.is_uefi():
|
||||
return # pragma: no cover
|
||||
if not self.osinfo.broken_uefi_with_hyperv():
|
||||
return # pragma: no cover
|
||||
self.features.hyperv_relaxed = None
|
||||
self.features.hyperv_vapic = None
|
||||
self.features.hyperv_spinlocks = None
|
||||
self.features.hyperv_spinlocks_retries = None
|
||||
for i in self.clock.timers:
|
||||
if i.name == "hypervclock":
|
||||
self.clock.timers.remove(i)
|
||||
|
||||
def has_spice(self):
|
||||
for gfx in self.devices.graphics:
|
||||
@ -620,7 +628,7 @@ class Guest(XMLBuilder):
|
||||
def hyperv_supported(self):
|
||||
if not self.osinfo.is_windows():
|
||||
return False
|
||||
if (self.os.loader_type == "pflash" and
|
||||
if (self.is_uefi() and
|
||||
self.osinfo.broken_uefi_with_hyperv()):
|
||||
return False
|
||||
return True
|
||||
|
Loading…
Reference in New Issue
Block a user