[virt-manager PATCH 2/2] virtinst: bhyve: properly configure loader

Roman Bogorodskiy bogorodskiy at gmail.com
Sat Feb 6 13:18:53 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>
---
 virtinst/domain/os.py | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/virtinst/domain/os.py b/virtinst/domain/os.py
index 59fbc43e..4a9fbc81 100644
--- a/virtinst/domain/os.py
+++ b/virtinst/domain/os.py
@@ -127,3 +127,19 @@ class DomainOs(XMLBuilder):
                 self.init = "/sbin/init"
             else:
                 self.init = "/bin/sh"
+        if self.conn.is_bhyve():
+            dom_caps = guest.lookup_domcaps()
+            firmware_files = [f.value for f in dom_caps.os.loader.values]
+            if not firmware_files:
+                return
+            # Prefer the known BHYVE_UEFI.fd firmware
+            # from the sysutils/bhyve-firmware port. If not found,
+            # just pick the first one
+            firmware_file = None
+            for f in firmware_files:
+                if 'BHYVE_UEFI.fd' in f:
+                    firmware_file = f
+                    break
+            self.loader = firmware_file or firmware_files[0]
+            self.loader_type = "pflash"
+            self.loader_ro = True
-- 
2.30.0




More information about the virt-tools-list mailing list