mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-12-21 09:34:12 +03:00
virt-xml: implement --edit --boot uefi=off
Disable all UEFI config bits for an existing VM Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
cfcd63b74e
commit
2f8f0e8151
20
tests/data/cli/compare/virt-xml-edit-boot-uefi-off.xml
Normal file
20
tests/data/cli/compare/virt-xml-edit-boot-uefi-off.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<memory unit="KiB">134217728</memory>
|
||||
<currentMemory unit="KiB">67108864</currentMemory>
|
||||
<vcpu placement="static">2</vcpu>
|
||||
- <os firmware="efi">
|
||||
+ <os>
|
||||
<type arch="i686">hvm</type>
|
||||
- <firmware>
|
||||
- <feature enabled="yes" name="enrolled-keys"/>
|
||||
- <feature enabled="yes" name="secure-boot"/>
|
||||
- </firmware>
|
||||
- <loader readonly="yes" secure="yes" type="pflash" format="qcow2">/usr/share/edk2/ovmf/OVMF_CODE.secboot.fd.qcow2</loader>
|
||||
- <nvram template="/usr/share/OVMF/OVMF_VARS.fd.qcow2" type="file" format="qcow2">
|
||||
- <source file="/var/lib/libvirt/nvram/guest_VARS.fd"/>
|
||||
- </nvram>
|
||||
<boot dev="hd"/>
|
||||
</os>
|
||||
<cpu mode="host-model"/>
|
||||
|
||||
Domain 'test-alternate-devs' defined successfully.
|
||||
Changes will take effect after the domain is fully powered off.
|
@ -718,7 +718,15 @@ test-many-devices, like an alternate RNG, EOL OS ID, title field
|
||||
<vcpu>2</vcpu>
|
||||
<cpu mode='host-model'/>
|
||||
<os firmware='efi'>
|
||||
<firmware>
|
||||
<feature enabled='yes' name='enrolled-keys'/>
|
||||
<feature enabled='yes' name='secure-boot'/>
|
||||
</firmware>
|
||||
<type arch='i686'>hvm</type>
|
||||
<loader format="qcow2" readonly='yes' secure='yes' type='pflash'>/usr/share/edk2/ovmf/OVMF_CODE.secboot.fd.qcow2</loader>
|
||||
<nvram type='file' format='qcow2' template='/usr/share/OVMF/OVMF_VARS.fd.qcow2'>
|
||||
<source file='/var/lib/libvirt/nvram/guest_VARS.fd'/>
|
||||
</nvram>
|
||||
<boot dev='hd'/>
|
||||
</os>
|
||||
<clock offset='utc'/>
|
||||
|
@ -1446,7 +1446,7 @@ c.add_compare("--confirm 1 --edit --cpu host-passthrough", "prompt-response", in
|
||||
c.add_compare("--edit --print-diff --qemu-commandline clearxml=yes", "edit-clearxml-qemu-commandline", input_file=(_VIRTXMLDIR + "virtxml-qemu-commandline-clear.xml"))
|
||||
c.add_compare("--print-diff --remove-device --serial 1", "remove-console-dup", input_file=(_VIRTXMLDIR + "virtxml-console-dup.xml"))
|
||||
c.add_compare("--print-diff --define --connect %(URI-KVM-X86)s test --edit --boot uefi", "edit-boot-uefi")
|
||||
c.add_invalid("--print-diff --define --connect %(URI-KVM-X86)s test-alternate-devs --edit --boot uefi=off", grep="NotImplementedError")
|
||||
c.add_compare("--print-diff --define --connect %(URI-KVM-X86)s test-alternate-devs --edit --boot uefi=off", "edit-boot-uefi-off")
|
||||
c.add_compare("--print-diff --define --connect %(URI-KVM-X86)s test-many-devices --edit --cpu host-copy", "edit-cpu-host-copy", precompare_check="10.1.0")
|
||||
c.add_compare("--connect %(URI-KVM-X86)s test-many-devices --build-xml --disk source.pool=pool-disk,source.volume=sdfg1", "build-pool-logical-disk")
|
||||
c.add_compare("test --add-device --network default --update --confirm", "update-succeed", env={"VIRTXML_TESTSUITE_UPDATE_IGNORE_FAIL": "1", "VIRTINST_TEST_SUITE_INCREMENT_MACADDR": "1"}, input_text="yes\nyes\n") # test hotplug success
|
||||
|
@ -711,11 +711,7 @@ class vmmDomain(vmmLibvirtObject):
|
||||
# preserve NVRAM paths, so skip clearing all the properties
|
||||
# and let libvirt do it for us.
|
||||
if firmware is None:
|
||||
# Implies 'default', so clear everything
|
||||
guest.os.loader_ro = None
|
||||
guest.os.loader_type = None
|
||||
guest.os.nvram = None
|
||||
guest.os.nvram_template = None
|
||||
guest.disable_uefi()
|
||||
else:
|
||||
# Implies UEFI
|
||||
guest.set_uefi_path(loader)
|
||||
|
@ -2849,8 +2849,9 @@ class ParserBoot(VirtCLIParser):
|
||||
self.guest.uefi_requested = val
|
||||
else:
|
||||
if not val:
|
||||
raise NotImplementedError()
|
||||
self.guest.enable_uefi()
|
||||
self.guest.disable_uefi()
|
||||
else:
|
||||
self.guest.enable_uefi()
|
||||
|
||||
def set_initargs_cb(self, inst, val, virtarg):
|
||||
inst.set_initargs_string(val)
|
||||
|
@ -600,6 +600,22 @@ class Guest(XMLBuilder):
|
||||
log.debug("Setting default UEFI path=%s", path)
|
||||
self.set_uefi_path(path)
|
||||
|
||||
def disable_uefi(self):
|
||||
self.os.firmware = None
|
||||
self.os.loader = None
|
||||
self.os.loader_ro = None
|
||||
self.os.loader_type = None
|
||||
self.os.loader_secure = None
|
||||
self.os.nvram = None
|
||||
self.os.nvram_template = None
|
||||
for feature in self.os.firmware_features:
|
||||
self.os.remove_child(feature)
|
||||
|
||||
# Force remove any properties we don't know about
|
||||
self._xmlstate.xmlapi.node_force_remove("./os/firmware")
|
||||
self._xmlstate.xmlapi.node_force_remove("./os/nvram")
|
||||
self._xmlstate.xmlapi.node_force_remove("./os/loader")
|
||||
|
||||
def has_spice(self):
|
||||
for gfx in self.devices.graphics:
|
||||
if gfx.type == gfx.TYPE_SPICE:
|
||||
|
Loading…
Reference in New Issue
Block a user