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 [. . .]
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
Patch was posted but didn't go in, discussion died. Unsetting POST
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
I've just hit this with f23 virt-manager against a rhel-7.2ish host; I was trying to rename the VM.
(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.
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
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.
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