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 1522706 - Inexact error info when undefine a running uefi guest without flags
Summary: Inexact error info when undefine a running uefi guest without flags
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.5
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: rc
: ---
Assignee: Michal Privoznik
QA Contact: Meina Li
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-12-06 09:53 UTC by Meina Li
Modified: 2018-10-30 09:51 UTC (History)
6 users (show)

Fixed In Version: libvirt-4.3.0-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-10-30 09:50:00 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2018:3113 0 None None None 2018-10-30 09:51:23 UTC

Description Meina Li 2017-12-06 09:53:14 UTC
Description of problem:
Inexact error info when undefine a running uefi guest without flags

Version-Release number of selected component (if applicable):
libvirt-3.9.0-3.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Prepare a running uefi guest:
# virsh dumpxml lmo
...
  <os>
    <type arch='x86_64' machine='pc-q35-rhel7.5.0'>hvm</type>
    <loader readonly='yes' secure='yes' type='pflash'>/usr/share/OVMF/OVMF_CODE.secboot.fd</loader>
    <nvram>/var/lib/libvirt/qemu/nvram/lmo_VARS.fd</nvram>
    <acpi>
      <table type='slic'>/var/lib/libvirt/images/slic.dat</table>
    </acpi>
    <bootmenu enable='yes' timeout='3000'/>
    <smbios mode='sysinfo'/>
  </os>
...
# virsh start lmo

2. Undefine the running guest. 
# virsh undefine lmo
error: Failed to undefine domain lmo
error: Requested operation is not valid: cannot delete inactive domain with nvram

3. Undefine the shut off guest.
# virsh destroy lmo
# virsh undefine lmo
error: Failed to undefine domain lmo
error: Requested operation is not valid: cannot delete inactive domain with nvram

Actual results:
As above step2, the guest is actually a active domain.

Expected results:
# virsh undefine lmo
error: Failed to undefine domain lmo
error: Requested operation is not valid: cannot delete active domain with nvram

Additional info:
#man virsh  
--nvram and --keep-nvram specify accordingly to delete or keep
nvram (/domain/os/nvram/) file. If the domain has an nvram file and
the flags are omitted, the undefine will fail.

Comment 2 Jaroslav Suchanek 2017-12-06 11:44:18 UTC
Well, undefine of live domain with nvram should be used with --nvram I guess.
So I would say that the fail is expectable. The error could be probably
better, but this is nothing serious.

Comment 3 Michal Privoznik 2017-12-11 06:58:45 UTC
Patch proposed on upstream list:

https://www.redhat.com/archives/libvir-list/2017-December/msg00327.html

Comment 4 Michal Privoznik 2017-12-11 12:31:09 UTC
Moving to POST:

commit 3446750bab844f16ee2176164e610a876e95a1d7
Author:     Michal Privoznik <mprivozn>
AuthorDate: Sun Dec 10 15:25:42 2017 +0100
Commit:     Michal Privoznik <mprivozn>
CommitDate: Mon Dec 11 13:23:30 2017 +0100

    qemuDomainUndefineFlags: Fix error message
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1522706
    
    If domain is active, but the undefine API was called without the
    VIR_DOMAIN_UNDEFINE_KEEP_NVRAM flag set, the following incorrect
    error message is produced:
    
    error: Requested operation is not valid: cannot delete inactive domain with nvram
    
    Signed-off-by: Michal Privoznik <mprivozn>

v3.10.0-47-g3446750ba

Comment 6 Meina Li 2018-06-22 01:59:03 UTC
Verified on libvirt-4.4.0-2.el7.x86_64 and qemu-kvm-rhev-2.12.0-4.el7.x86_64.

Steps:
1. Prepare a running uefi guest:
# virsh dumpxml ovmf76
...
   <os>
    <type arch='x86_64' machine='pc-q35-rhel7.5.0'>hvm</type>
    <loader readonly='yes' secure='yes' type='pflash'>/usr/share/OVMF/OVMF_CODE.secboot.fd</loader>
    <nvram>/var/lib/libvirt/qemu/nvram/ovmf76_VARS.fd</nvram>
    <boot dev='hd'/>
  </os>
...
# virsh start ovmf76

2. Undefine the running and shutoff guest.
# virsh undefine ovmf76
 error: Failed to undefine domain ovmf76
 error: Requested operation is not valid: cannot undefine domain with nvram

# virsh destroy ovmf76

# virsh undefine ovmf76
 error: Failed to undefine domain ovmf76
 error: Requested operation is not valid: cannot undefine domain with nvram

3. Undefine guest with --keep-nvram
# virsh undefine ovmf76 --keep-nvram
Domain ovmf76 has been undefined

# ll /var/lib/libvirt/qemu/nvram/ovmf76_VARS.fd 
-rw-------. 1 root root 540672 Jun 21 06:03 /var/lib/libvirt/qemu/nvram/ovmf76_VARS.fd

4. Undefine guest with --nvram
# virsh undefine ovmf76 --nvram
Domain ovmf76 has been undefined

# ll /var/lib/libvirt/qemu/nvram/ovmf76_VARS.fd 
ls: cannot access /var/lib/libvirt/qemu/nvram/ovmf76_VARS.fd: No such file or directory

All the results are expected.

Comment 8 errata-xmlrpc 2018-10-30 09:50:00 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, 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/RHSA-2018:3113


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