RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1869135 - Failed to delete shutoff vm if 'firmware=efi' to uefi guest xml via virt-manager
Summary: Failed to delete shutoff vm if 'firmware=efi' to uefi guest xml via virt-man...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: virt-manager
Version: 8.3
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: 8.0
Assignee: Pavel Hrdina
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-08-17 03:54 UTC by zhoujunqin
Modified: 2021-05-18 15:47 UTC (History)
8 users (show)

Fixed In Version: virt-manager-2.2.1-4.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-05-18 15:47:03 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description zhoujunqin 2020-08-17 03:54:28 UTC
Description of problem:
Failed to delete shutoff vm if  'firmware=efi' to uefi guest xml via virt-manager 

Version-Release number of selected component (if applicable):
virt-manager-2.2.1-3.el8.noarch
virt-install-2.2.1-3.el8.noarch
qemu-kvm-4.2.0-32.module+el8.3.0+7629+c86ce105.x86_64
libvirt-6.0.0-27.module+el8.3.0+7602+4b93512e.x86_64


How reproducible:
100%

Steps to Reproduce:
1. Prepare a uefi vm with below xml and firmware shows 'UEFI x86_64: /usr/share/edk2/ovmf/OVMF_CODE.secboot.fd' in virt-manager
# virsh dumpxml rhel8.2-efi
....
  <os>
    <type arch="x86_64" machine="pc-q35-rhel8.2.0">hvm</type>
    <loader readonly="yes" secure="yes" type="pflash">/usr/share/edk2/ovmf/OVMF_CODE.secboot.fd</loader>
    <nvram>/var/lib/libvirt/qemu/nvram/rhel8.2-efi_VARS.fd</nvram>
    <boot dev="hd"/>
  </os>
....

2. Power off vm and add "firmware='efi'" to vm's xml, check vm xml file
 
# virsh dumpxml rhel8.2-efi --inactive |grep firmware -A 5

  <os firmware="efi">
    <type arch="x86_64" machine="pc-q35-rhel8.2.0">hvm</type>
    <boot dev="hd"/>
  </os>

3. Power on vm to ensure the vm can boot up successfully.
Result: vm can start successfully

4. Power off vm again and delete it via virt-manager

Error deleting virtual machine 'rhel8.2-efi': Requested operation is not valid: cannot undefine domain with nvram

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/object/domain.py", line 1303, in delete
    self._backend.undefineFlags(flags)
  File "/usr/lib64/python3.6/site-packages/libvirt.py", line 2924, in undefineFlags
    if ret == -1: raise libvirtError ('virDomainUndefineFlags() failed', dom=self)
libvirt.libvirtError: Requested operation is not valid: cannot undefine domain with nvram

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/delete.py", line 191, in _async_delete
    vm.delete()
  File "/usr/share/virt-manager/virtManager/object/libvirtobject.py", line 66, in newfn
    ret = fn(self, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/object/domain.py", line 1307, in delete
    self._backend.undefine()
  File "/usr/lib64/python3.6/site-packages/libvirt.py", line 2888, in undefine
    if ret == -1: raise libvirtError ('virDomainUndefine() failed', dom=self)
libvirt.libvirtError: Requested operation is not valid: cannot undefine domain with nvram


Additionally, there were errors removing certain storage devices: 


Actual results:
As described.

Expected results:
Fix it.

Additional info:
The VM can be deleted by # virsh undefine $vm --nvram command, thanks.

Comment 1 Cole Robinson 2020-09-08 23:33:45 UTC
Fixed upstream now:

commit 38cd19b0c31788cb5e6d16cfa122d52a8c7f630d
Author: Cole Robinson <crobinso>
Date:   Tue Sep 8 15:15:14 2020 -0400

    domain: Fix VM deletion with firmare='efi'

Comment 5 zhoujunqin 2020-11-26 11:57:54 UTC
I can reproduce this issue with package:
virt-install-2.2.1-3.el8.noarch
virt-manager-common-2.2.1-3.el8.noarch

Steps as Comment 0.

Then try to verify this bug with new build:
virt-manager-common-2.2.1-4.el8.noarch
virt-install-2.2.1-4.el8.noarch
libvirt-6.0.0-30.module+el8.4.0+8705+34397d87.x86_64
qemu-kvm-4.2.0-37.module+el8.4.0+8837+c89bcfe6.x86_64
kernel-4.18.0-249.el8.x86_64

Steps:

1. Prepare a uefi vm with below xml and firmware shows 'UEFI x86_64: /usr/share/edk2/ovmf/OVMF_CODE.secboot.fd' in virt-manager
# virsh dumpxml rhel8.3
....
  <os>
    <type arch='x86_64' machine='pc-q35-rhel8.2.0'>hvm</type>
    <loader readonly='yes' secure='yes' type='pflash'>/usr/share/edk2/ovmf/OVMF_CODE.secboot.fd</loader>
    <nvram>/var/lib/libvirt/qemu/nvram/rhel8.3_VARS.fd</nvram>
    <boot dev='hd'/>
  </os>
....

2. Power off vm and add "firmware='efi'" to vm's xml, check vm's xml file
 
# virsh dumpxml rhel8.2-efi --inactive |grep firmware -A 5

  <os firmware="efi">
    <type arch="x86_64" machine="pc-q35-rhel8.2.0">hvm</type>
    <boot dev="hd"/>
  </os>

3. Power on vm to ensure the vm can boot up successfully.
Result: vm can start successfully

4. Power off vm again and delete it via virt-manager

Result: Vm can be deleted successfully.

5. Restart vm again and delete it via virt-manager when it's running.

Result: Vm can be deleted successfully.


So I move this bug from ON_QA to VERIFIED status based on above testing.

Comment 7 errata-xmlrpc 2021-05-18 15:47:03 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (virt-manager bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:1843


Note You need to log in before you can comment on or make changes to this bug.