mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-09-04 05:44:18 +03:00
domcapabilities: Get arch from caps XML
This commit is contained in:
@@ -830,7 +830,7 @@ class vmmDetails(vmmGObjectUI):
|
|||||||
self.widget("overview-firmware-label").set_visible(
|
self.widget("overview-firmware-label").set_visible(
|
||||||
not self.is_customize_dialog)
|
not self.is_customize_dialog)
|
||||||
show_firmware = ((self.conn.is_qemu() or self.conn.is_test_conn()) and
|
show_firmware = ((self.conn.is_qemu() or self.conn.is_test_conn()) and
|
||||||
domcaps.arch_can_uefi(arch) and
|
domcaps.arch_can_uefi() and
|
||||||
not self.vm.is_management_domain())
|
not self.vm.is_management_domain())
|
||||||
uiutil.set_grid_row_visible(
|
uiutil.set_grid_row_visible(
|
||||||
self.widget("overview-firmware-title"), show_firmware)
|
self.widget("overview-firmware-title"), show_firmware)
|
||||||
|
@@ -457,10 +457,17 @@ class VirtualConnection(object):
|
|||||||
# if needed
|
# if needed
|
||||||
if "domcaps" in opts:
|
if "domcaps" in opts:
|
||||||
domcapsxml = file(opts.pop("domcaps")).read()
|
domcapsxml = file(opts.pop("domcaps")).read()
|
||||||
def fake_domcaps(*args, **kwargs):
|
def fake_domcaps(emulator, arch, machine, virttype, flags=0):
|
||||||
ignore = args
|
ignore = emulator
|
||||||
ignore = kwargs
|
ignore = flags
|
||||||
return domcapsxml
|
ignore = machine
|
||||||
|
ignore = virttype
|
||||||
|
|
||||||
|
ret = domcapsxml
|
||||||
|
if arch:
|
||||||
|
ret = re.sub("arch>.+</arch", "arch>%s</arch" % arch, ret)
|
||||||
|
return ret
|
||||||
|
|
||||||
conn.getDomainCapabilities = fake_domcaps
|
conn.getDomainCapabilities = fake_domcaps
|
||||||
|
|
||||||
if ("qemu" in opts) or ("xen" in opts) or ("lxc" in opts):
|
if ("qemu" in opts) or ("xen" in opts) or ("lxc" in opts):
|
||||||
|
@@ -107,24 +107,24 @@ class DomainCapabilities(XMLBuilder):
|
|||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
def find_uefi_path_for_arch(self, arch):
|
def find_uefi_path_for_arch(self):
|
||||||
"""
|
"""
|
||||||
Search the loader paths for one that matches the passed arch
|
Search the loader paths for one that matches the passed arch
|
||||||
"""
|
"""
|
||||||
if not self.arch_can_uefi(arch):
|
if not self.arch_can_uefi():
|
||||||
return
|
return
|
||||||
|
|
||||||
patterns = self._uefi_arch_patterns.get(arch)
|
patterns = self._uefi_arch_patterns.get(self.arch)
|
||||||
for pattern in patterns:
|
for pattern in patterns:
|
||||||
for path in [v.value for v in self.os.loader.values]:
|
for path in [v.value for v in self.os.loader.values]:
|
||||||
if re.match(pattern, path):
|
if re.match(pattern, path):
|
||||||
return path
|
return path
|
||||||
|
|
||||||
def arch_can_uefi(self, arch):
|
def arch_can_uefi(self):
|
||||||
"""
|
"""
|
||||||
Return True if we know how to setup UEFI for the passed arch
|
Return True if we know how to setup UEFI for the passed arch
|
||||||
"""
|
"""
|
||||||
return arch in self._uefi_arch_patterns.keys()
|
return self.arch in self._uefi_arch_patterns.keys()
|
||||||
|
|
||||||
def supports_uefi_xml(self):
|
def supports_uefi_xml(self):
|
||||||
"""
|
"""
|
||||||
@@ -137,3 +137,5 @@ class DomainCapabilities(XMLBuilder):
|
|||||||
_XML_ROOT_NAME = "domainCapabilities"
|
_XML_ROOT_NAME = "domainCapabilities"
|
||||||
os = XMLChildProperty(_OS, is_single=True)
|
os = XMLChildProperty(_OS, is_single=True)
|
||||||
devices = XMLChildProperty(_Devices, is_single=True)
|
devices = XMLChildProperty(_Devices, is_single=True)
|
||||||
|
|
||||||
|
arch = XMLProperty("./arch")
|
||||||
|
@@ -544,12 +544,12 @@ class Guest(XMLBuilder):
|
|||||||
if not domcaps.supports_uefi_xml():
|
if not domcaps.supports_uefi_xml():
|
||||||
raise RuntimeError(_("Libvirt version does not support UEFI."))
|
raise RuntimeError(_("Libvirt version does not support UEFI."))
|
||||||
|
|
||||||
if not domcaps.arch_can_uefi(self.os.arch):
|
if not domcaps.arch_can_uefi():
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
_("Don't know how to setup UEFI for arch '%s'") %
|
_("Don't know how to setup UEFI for arch '%s'") %
|
||||||
self.os.arch)
|
self.os.arch)
|
||||||
|
|
||||||
path = domcaps.find_uefi_path_for_arch(self.os.arch)
|
path = domcaps.find_uefi_path_for_arch()
|
||||||
if not path:
|
if not path:
|
||||||
raise RuntimeError(_("Did not find any UEFI binary path for "
|
raise RuntimeError(_("Did not find any UEFI binary path for "
|
||||||
"arch '%s'") % self.os.arch)
|
"arch '%s'") % self.os.arch)
|
||||||
|
Reference in New Issue
Block a user