mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-12-22 13:34:07 +03:00
guest: Add uefi_requested
This helps us break that virt-install dependency: parse cli to get arch/machine info, cli requests uefi, uefi needs to know arch machine info. Instead just make the 'uefi' bit set a flag, that we resolve in Guest.set_defaults once we have all the info we need.
This commit is contained in:
parent
3586d18971
commit
addff23ccb
@ -2221,8 +2221,13 @@ class ParserBoot(VirtCLIParser):
|
||||
###################
|
||||
|
||||
def set_uefi_cb(self, inst, val, virtarg):
|
||||
self.guest.set_uefi_path(self.guest.get_uefi_path())
|
||||
if self.editing:
|
||||
if not self.editing:
|
||||
# From virt-install, we just set this flag, and set_defaults()
|
||||
# will fill in everything for us, otherwise we have a circular
|
||||
# dep on determining arch/machine info
|
||||
self.guest.uefi_requested = True
|
||||
else:
|
||||
self.guest.set_uefi_path(self.guest.get_uefi_path())
|
||||
self.guest.disable_hyperv_for_uefi()
|
||||
|
||||
def set_initargs_cb(self, inst, val, virtarg):
|
||||
|
@ -230,6 +230,7 @@ class Guest(XMLBuilder):
|
||||
self.x86_cpu_default = self.cpu.SPECIAL_MODE_APP_DEFAULT
|
||||
|
||||
self.skip_default_osinfo = False
|
||||
self.uefi_requested = False
|
||||
self.__osinfo = None
|
||||
self._capsinfo = None
|
||||
self._domcaps = None
|
||||
@ -773,15 +774,19 @@ class Guest(XMLBuilder):
|
||||
|
||||
|
||||
def _set_default_uefi(self):
|
||||
if (self.prefers_uefi() and
|
||||
use_default_uefi = (self.prefers_uefi() and
|
||||
not self.os.kernel and
|
||||
not self.os.loader and
|
||||
self.os.loader_ro is None and
|
||||
self.os.nvram is None):
|
||||
self.os.nvram is None)
|
||||
|
||||
if use_default_uefi or self.uefi_requested:
|
||||
try:
|
||||
path = self.get_uefi_path()
|
||||
self.set_uefi_path(path)
|
||||
except RuntimeError as e:
|
||||
if self.uefi_requested:
|
||||
raise
|
||||
logging.debug("Error setting UEFI default",
|
||||
exc_info=True)
|
||||
logging.warning("Couldn't configure UEFI: %s", e)
|
||||
|
Loading…
Reference in New Issue
Block a user