diff options
-rw-r--r-- | tests/data/cli/compare/virt-install-bhyve-uefi.xml | 59 | ||||
-rw-r--r-- | tests/test_cli.py | 3 | ||||
-rw-r--r-- | virtinst/domcapabilities.py | 11 |
3 files changed, 65 insertions, 8 deletions
diff --git a/tests/data/cli/compare/virt-install-bhyve-uefi.xml b/tests/data/cli/compare/virt-install-bhyve-uefi.xml new file mode 100644 index 00000000..8cb5a23f --- /dev/null +++ b/tests/data/cli/compare/virt-install-bhyve-uefi.xml @@ -0,0 +1,59 @@ +<domain type="bhyve"> + <name>foobhyve</name> + <uuid>00000000-1111-2222-3333-444444444444</uuid> + <memory>262144</memory> + <currentMemory>262144</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch="x86_64">hvm</type> + <loader readonly="yes" type="pflash">/usr/local/share/uefi-firmware/BHYVE_UEFI.fd</loader> + <boot dev="network"/> + </os> + <clock offset="utc"/> + <on_reboot>destroy</on_reboot> + <devices> + <emulator>bhyve</emulator> + <interface type="bridge"> + <source bridge="testsuitebr0"/> + <mac address="00:11:22:33:44:55"/> + <model type="e1000"/> + </interface> + <console type="nmdm"> + <source master="/dev/nmdm00000000-1111-2222-3333-444444444444A" slave="/dev/nmdm00000000-1111-2222-3333-444444444444B"/> + </console> + <input type="tablet" bus="usb"/> + <graphics type="vnc" port="-1"/> + <video> + <model type="vga"/> + </video> + </devices> +</domain> +<domain type="bhyve"> + <name>foobhyve</name> + <uuid>00000000-1111-2222-3333-444444444444</uuid> + <memory>262144</memory> + <currentMemory>262144</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch="x86_64">hvm</type> + <loader readonly="yes" type="pflash">/usr/local/share/uefi-firmware/BHYVE_UEFI.fd</loader> + <boot dev="network"/> + </os> + <clock offset="utc"/> + <devices> + <emulator>bhyve</emulator> + <interface type="bridge"> + <source bridge="testsuitebr0"/> + <mac address="00:11:22:33:44:55"/> + <model type="e1000"/> + </interface> + <console type="nmdm"> + <source master="/dev/nmdm00000000-1111-2222-3333-444444444444A" slave="/dev/nmdm00000000-1111-2222-3333-444444444444B"/> + </console> + <input type="tablet" bus="usb"/> + <graphics type="vnc" port="-1"/> + <video> + <model type="vga"/> + </video> + </devices> +</domain> diff --git a/tests/test_cli.py b/tests/test_cli.py index fffb1968..e67fe0c8 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -1120,7 +1120,8 @@ c.add_compare(""" ######################## c = vinst.add_category("bhyve", "--name foobhyve --noautoconsole --connect " + utils.URIs.bhyve) -c.add_compare("--os-variant fedora27 --boot uefi", "bhyve-default-f27") +c.add_compare("--boot uefi --disk none --ram 256 --pxe", "bhyve-uefi") +c.add_compare("--os-variant fedora27", "bhyve-default-f27") diff --git a/virtinst/domcapabilities.py b/virtinst/domcapabilities.py index 7f81e5e8..b90942b4 100644 --- a/virtinst/domcapabilities.py +++ b/virtinst/domcapabilities.py @@ -211,20 +211,17 @@ class DomainCapabilities(XMLBuilder): if not self.arch_can_uefi(): return # pragma: no cover + firmware_files = [f.value for f in self.os.loader.values] 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] + return (firmware_files and + firmware_files[0] or None) # pragma: no cover patterns = self._uefi_arch_patterns.get(self.arch) for pattern in patterns: - for path in [v.value for v in self.os.loader.values]: + for path in firmware_files: if re.match(pattern, path): return path |