[virt-tools-list] [QEMU][Virtual Machine Manager] Unable to delete virtual machine if snapshots have been taken.

NoxDaFox noxdafox at gmail.com
Wed Apr 18 08:36:23 UTC 2012


Greetings,

I am playing around with libvirt, virsh and virt-manager (via QEMU kvm).
For testing purpose, through libvirt, I am setting up several machines,
taking some snapshots and wiping out everything.

The weird thing is that once I open virt-manager, if my cleanup routine
hanged in someway, I still see those machines.
If I list the domains (or snapshots, or pools) through virsh I don't see
anything available.

Please note that I don't posses neither the disk image nor the (external
disks) snapshots.

So here's the problem:
If I try to delete the machine on virt-manager I get the following error:
---------------------------
Error deleting virtual machine '191da985-cc43-44b9-85be-95dde6229791':
Requested operation is not valid: cannot delete inactive domain with 3
snapshots

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/delete.py", line 176, in
_async_delete
    self.vm.delete()
  File "/usr/share/virt-manager/virtManager/domain.py", line 1127, in delete
    self._backend.undefine()
  File "/usr/lib/python2.7/dist-packages/libvirt.py", line 1364, in undefine
    if ret == -1: raise libvirtError ('virDomainUndefine() failed',
dom=self)
libvirtError: Requested operation is not valid: cannot delete inactive
domain with 3 snapshots
---------------------------

The error if fixable changing in file
/usr/share/virt-manager/virtManager/domain.py

The line # 1127
self._backend.undefine()
with
self._backend.undefineFlags(
            libvirt.VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA)

Standing to libvirt documentation is not possible to undefine a domain if
it has snapshots; a forced undefine is available through the
undefineFlags() function with the proper flag set.
I dind't provide a patch as this can be an unwanted change.
You may want to reimplement the deletion including a warning for the user
or something else.

Anyway I can't figure out where those information are stored, virsh doesn't
see anything about, on my HD no information are stored. If I restart QEMU,
libvirt-bin or even my machine the VM still are there...

Thanks for the great tools provided anyway!

NoxDaFox
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20120418/07a5502d/attachment.htm>


More information about the virt-tools-list mailing list