[virt-manager PATCH v2 3/4] virtinst: bhyve: properly configure loader
Roman Bogorodskiy
bogorodskiy at gmail.com
Thu Feb 11 15:41:12 UTC 2021
Bhyve requires explicit loader configuration. So query
domain capabilities, try to find the "official"
firmware and configure all the necessary loader options.
Signed-off-by: Roman Bogorodskiy <bogorodskiy at gmail.com>
---
.../cli/compare/virt-install-bhyve-default-f27.xml | 1 +
tests/test_cli.py | 2 +-
virtinst/domcapabilities.py | 11 +++++++++++
virtinst/guest.py | 2 +-
4 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/tests/data/cli/compare/virt-install-bhyve-default-f27.xml b/tests/data/cli/compare/virt-install-bhyve-default-f27.xml
index 0afe1d58..766f5f98 100644
--- a/tests/data/cli/compare/virt-install-bhyve-default-f27.xml
+++ b/tests/data/cli/compare/virt-install-bhyve-default-f27.xml
@@ -11,6 +11,7 @@
<vcpu>2</vcpu>
<os>
<type arch="x86_64">hvm</type>
+ <loader readonly="yes" type="pflash">/usr/local/share/uefi-firmware/BHYVE_UEFI.fd</loader>
<boot dev="hd"/>
</os>
<clock offset="utc"/>
diff --git a/tests/test_cli.py b/tests/test_cli.py
index 455f90f2..fffb1968 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -1120,7 +1120,7 @@ c.add_compare("""
########################
c = vinst.add_category("bhyve", "--name foobhyve --noautoconsole --connect " + utils.URIs.bhyve)
-c.add_compare("--os-variant fedora27", "bhyve-default-f27")
+c.add_compare("--os-variant fedora27 --boot uefi", "bhyve-default-f27")
diff --git a/virtinst/domcapabilities.py b/virtinst/domcapabilities.py
index 81f664ed..7f81e5e8 100644
--- a/virtinst/domcapabilities.py
+++ b/virtinst/domcapabilities.py
@@ -211,6 +211,17 @@ class DomainCapabilities(XMLBuilder):
if not self.arch_can_uefi():
return # pragma: no cover
+ if self.conn.is_bhyve():
+ firmware_files = [f.value for f in self.os.loader.values]
+ if not firmware_files:
+ return
+
+ for firmware_file in firmware_files:
+ if 'BHYVE_UEFI.fd' in firmware_file:
+ return firmware_file
+
+ return firmware_files[0]
+
patterns = self._uefi_arch_patterns.get(self.arch)
for pattern in patterns:
for path in [v.value for v in self.os.loader.values]:
diff --git a/virtinst/guest.py b/virtinst/guest.py
index 3269f72e..5306dfb4 100644
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -512,7 +512,7 @@ class Guest(XMLBuilder):
arm+machvirt prefers UEFI since it's required for traditional
install methods
"""
- return self.os.is_arm_machvirt()
+ return self.os.is_arm_machvirt() or self.conn.is_bhyve()
def get_uefi_path(self):
"""
--
2.30.0
More information about the virt-tools-list
mailing list