Bug 2007659

Summary: The description of --nvram and --keep-nvram should update in 'virsh help undefine'
Product: Red Hat Enterprise Linux 9 Reporter: yafu <yafu>
Component: libvirtAssignee: Michal Privoznik <mprivozn>
libvirt sub component: General QA Contact: Meina Li <meili>
Status: CLOSED ERRATA Docs Contact:
Severity: unspecified    
Priority: low CC: jdenemar, jsuchane, lmen, meili, mprivozn, virt-maint, xuzhang
Version: 9.0Keywords: Triaged, Upstream
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-7.9.0-1.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-05-17 12:45:32 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version: 7.9.0
Embargoed:

Description yafu 2021-09-24 13:57:22 UTC
Description of problem:
The description of --nvram and --keep-nvram should update in 'virsh help undefine'

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

How reproducible:
100%

Steps to Reproduce:
1.Define and start a guest:
#virsh dumpxml avocado-vt-vm1
...
 <os>
    <type arch='x86_64' machine='pc-q35-rhel8.5.0'>hvm</type>
    <loader readonly='yes' type='pflash'>/usr/share/edk2/ovmf/OVMF_CODE.secboot.fd</loader>
    <nvram template='/usr/share/edk2/ovmf/OVMF_VARS.secboot.fd'>/var/lib/libvirt/qemu/nvram/avocado-vt-vm1_VARS.fd</nvram>
    <boot dev='hd'/>
  </os>
...

2.Check the nvram file
# ll /var/lib/libvirt/qemu/nvram/
total 532
-rw-------. 1 qemu qemu 540672 Sep 24 09:41 avocado-vt-vm1_VARS.fd


3.undefine the guest with --nvram
#virsh undefine avocdao-vt-vm1 --nvram

4.Check the nvram file again:
# ll /var/lib/libvirt/qemu/nvram/
total 0

5.Check the guest status:
# virsh list
 Id   Name             State
--------------------------------
 5    avocado-vt-vm1   running

Actual results:
--nvram and --keep-nvram works regardless of the guest status

Expected results:
# virsh help undefine
...
--nvram          remove nvram file, ***if inactive***
--keep-nvram     keep nvram file, ***if inactive***



Additional info:

Comment 1 Michal Privoznik 2021-10-05 07:01:22 UTC
Merged upstream:

commit 3ad069001510666e1880ec788401518f6179bcd2
Author:     Michal Prívozník <mprivozn>
AuthorDate: Thu Sep 30 16:32:19 2021 +0200
Commit:     Michal Prívozník <mprivozn>
CommitDate: Tue Oct 5 08:54:32 2021 +0200

    virsh: Fix --nvram and --keep-nvram help strings
    
    The --nvram and --keep-nvram options of the undefine command can
    be used regardless of the domain status (the only consumer so far
    - qemuDomainUndefineFlags() doesn't care about the domain
    status). Yet, their corresponding help strings say something
    about inactive domains while manpage says nothing. Remove the
    reference to domain state.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2007659
    Signed-off-by: Michal Privoznik <mprivozn>
    Reviewed-by: Andrea Bolognani <abologna>

v7.8.0-38-g3ad0690015

Comment 2 Meina Li 2021-10-27 07:35:12 UTC
Test Version:
libvirt-7.9.0-1.fc34.x86_64
qemu-kvm-5.2.0-8.fc34.x86_64

Test Result:
# virsh undefine --help
  NAME
    undefine - undefine a domain
...
    --nvram          remove nvram file
    --keep-nvram     keep nvram file

Comment 6 Meina Li 2021-11-16 09:41:13 UTC
Verified Version:
libvirt-7.9.0-1.el9.x86_64
qemu-kvm-6.1.0-6.el9.x86_64

Verified Steps:
# virsh undefine --help
  NAME
    undefine - undefine a domain
......
    --nvram          remove nvram file
    --keep-nvram     keep nvram file

Comment 8 errata-xmlrpc 2022-05-17 12:45:32 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 (new packages: libvirt), 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-2022:2390