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

Cole Robinson crobinso at redhat.com
Tue Apr 24 15:15:57 UTC 2012


On 04/18/2012 04:36 AM, NoxDaFox wrote:
> 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)
>

Thanks for the report. That fix above isn't entirely sufficient since we have
to conditionalize it on the libvirt version, otherwise new virt-manager on an
old libvirt version will throw an exception.

Please file an upstream bug so we can track this:

http://virt-manager.org/page/BugReporting

Thanks,
Cole

> 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!
> 





More information about the virt-tools-list mailing list