@@ -24,7 +24,11 @@ import zbar
2424QEMU_NS = 'http://libvirt.org/schemas/domain/qemu/1.0'
2525etree .register_namespace ('qemu' , QEMU_NS )
2626
27- OVMF_PATH = '/usr/share/OVMF/OVMF_CODE.fd'
27+ OVMF_PATHS = [
28+ '/usr/share/OVMF/OVMF_CODE.fd' ,
29+ '/usr/share/OVMF/OVMF_CODE_2M.fd' ,
30+ '/usr/share/OVMF/OVMF_CODE_4M.fd'
31+ ]
2832
2933
3034class Verbosity (IntEnum ):
@@ -80,6 +84,11 @@ def ipxe_script(uuid, version, arch, bootmgr, bcd, bootsdi, bootargs):
8084 return script
8185
8286
87+ def ovmf_path ():
88+ """Determine OVMF path"""
89+ return next (x for x in OVMF_PATHS if os .path .exists (x ))
90+
91+
8392def vm_xml (virttype , name , uuid , memory , uefi , dbgfile , serfile , romfile ,
8493 booturl ):
8594 """Construct XML description of VM"""
@@ -95,7 +104,8 @@ def vm_xml(virttype, name, uuid, memory, uefi, dbgfile, serfile, romfile,
95104 x_ostype .attrib ['arch' ] = 'x86_64'
96105 if uefi :
97106 x_loader = etree .SubElement (x_os , 'loader' )
98- x_loader .text = OVMF_PATH
107+ x_loader .text = ovmf_path ()
108+ x_loader .attrib ['type' ] = 'pflash'
99109 x_features = etree .SubElement (x_domain , 'features' )
100110 x_acpi = etree .SubElement (x_features , 'acpi' )
101111 x_boot = etree .SubElement (x_os , 'boot' )
0 commit comments