Bug 1195667 - libvirt fails to undefine a guest with `nvram` XML element
Summary: libvirt fails to undefine a guest with `nvram` XML element
Keywords:
Status: CLOSED DEFERRED
Alias: None
Product: Fedora
Classification: Fedora
Component: libvirt
Version: 23
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Daniel Berrangé
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-02-24 10:19 UTC by Kashyap Chamarthy
Modified: 2018-03-08 14:08 UTC (History)
16 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2016-12-12 20:41:06 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Kashyap Chamarthy 2015-02-24 10:19:21 UTC
Description of problem
----------------------

libvirt fails to undefine a guest that has 'nvram' XML element with

  $ virsh undefine devstack
  error: Failed to undefine domain devstack
  error: Requested operation is not valid: cannot delete inactive domain with nvram


Version
-------

  $ uname -r; rpm -q libvirt-daemon-kvm qemu-system-aarch64
  3.18.6-200.fc21.aarch64
  libvirt-daemon-kvm-1.2.11-1.fc22.aarch64
  qemu-system-aarch64-2.2.0-5.fc22.aarch64


How reproducible: Consistently


Steps to Reproduce
------------------

1. Have a guest (AArch64 in this case) with 'nvram' XML element:

    $ virsh dumpxml devstack | grep -i nvram  -A2 -B3
      <os>
        <type arch='aarch64' machine='virt'>hvm</type>
        <loader readonly='yes' type='pflash'>/usr/share/AAVMF/AAVMF_CODE.fd</loader>
        <nvram>/var/lib/libvirt/nvram/fedora-21-aarch64-nvram</nvram>
        <boot dev='hd'/>
      </os>

2. Try to undefine it:

   $ virsh undefine devstack


Actual results
--------------

  $ virsh undefine devstack
  error: Failed to undefine domain devstack
  error: Requested operation is not valid: cannot delete inactive domain with nvram


Expected results
----------------

It should be possible to undefine the libvirt guest with 'nvram' XML element.


Additional info
---------------

Libvirt debug info:


[. . .]
2015-02-24 15:11:38.984+0000: 32759: debug : virDomainIsActive:8493 : dom=0x3ff8c119d00
2015-02-24 15:11:38.985+0000: 32760: debug : virDomainHasManagedSaveImage:9141 : dom=0x3ff840030a0, (VM: name=devstack, uuid=ef31ff36-373c-4d54-ac1f-d0c19cc629ac), flags=0
2015-02-24 15:11:38.985+0000: 32761: debug : virDomainSnapshotNum:357 : dom=0x3ff880030a0, (VM: name=devstack, uuid=ef31ff36-373c-4d54-ac1f-d0c19cc629ac), flags=0
2015-02-24 15:11:38.985+0000: 32762: debug : virDomainUndefineFlags:6557 : dom=0x3ff7c000af0, (VM: name=devstack, uuid=ef31ff36-373c-4d54-ac1f-d0c19cc629ac), flags=0
2015-02-24 15:11:38.985+0000: 32762: debug : qemuDomainUndefineFlags:6864 : Requested operation is not valid: cannot delete inactive domain with nvram
2015-02-24 15:11:38.985+0000: 32758: debug : virIdentitySetAttr:246 : ident=0x3ffbee8a910 attribute=4 value=32758
[. . .]

Comment 1 Kashyap Chamarthy 2015-02-24 10:23:00 UTC
Dan posted a patch upstream:

  http://www.redhat.com/archives/libvir-list/2015-February/msg00915.html --
  qemu: don't refuse to undefine a guest with NVRAM file

Comment 2 Cole Robinson 2015-03-31 20:30:17 UTC
Patch was posted but didn't go in, discussion died. Unsetting POST

Comment 3 Jan Kurik 2015-07-15 14:30:11 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 23 development cycle.
Changing version to '23'.

(As we did not run this process for some time, it could affect also pre-Fedora 23 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 23 End Of Life. Thank you.)

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora23

Comment 4 Dr. David Alan Gilbert 2016-03-30 18:04:00 UTC
I've just hit this with f23 virt-manager against a rhel-7.2ish host; I was trying to rename the VM.

Comment 5 Dr. David Alan Gilbert 2016-03-30 18:35:11 UTC
(In reply to Dr. David Alan Gilbert from comment #4)
> I've just hit this with f23 virt-manager against a rhel-7.2ish host; I was
> trying to rename the VM.

and   virsh domrename   worked fine.

Comment 6 Christian Horn 2016-05-09 03:17:27 UTC
This still exists on Fedora23.
Workaround for
  error: Requested operation is not valid: cannot delete inactive domain with nvram
is to remove the line from the VM config.

$ virsh edit rhel7u2a # remove the nvram line
Domain rhel7u2a XML configuration edited.
$ virsh undefine rhel7u2a
Domain rhel7u2a has been undefined

Comment 7 Fedora End Of Life 2016-11-24 11:28:55 UTC
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '23'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 23 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 8 Cole Robinson 2016-12-12 20:41:06 UTC
Dan's patch never went in AFAICT. The solution here is to use the explicit 'virsh undefine --nvram' option to remove the associated NVRAM file, even though that's suboptimal.

virt-manager does pass the --nvram equivalent, so it's no longer affected. If people still disagree with this decision it should probably be brought up on libvir-list

Closing since this is against F23 and the bug has lingered for a while


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