[libvirt] [PATCH RFC 3/3] undefine: Add coresponding switches to virsh, for removing storage devices associated with domain

Daniel P. Berrange berrange at redhat.com
Thu Jul 21 17:11:26 UTC 2011

On Thu, Jul 21, 2011 at 05:12:16PM +0200, Peter Krempa wrote:
> Adds switches for the virsh command "undefine", for managing removal of associated storage devices
> for the undefined domain.
> --remove-unmanaged-disks - removes only disk images, that aren't a part of any libvirt storage pool.
> Only file-based storage devices are removed.
> --remove-managed-disks - removes only libvirt managed storage devices

I don't think this is the right level of granularity because
you really want control over individual disks to be removed,
the disctinction of whether a disk is from a storage pool or
not is not relevant to the task at hand.

eg,  Consider a VM with 4 disks in the config, sda, sdb, sdc and sdd
and you want to delete sda and sdc, but not sdb since that it on iSCSI
which we can't remote delete, and not sdd since that's a data disk we
want to keep for a future VM.

    virsh undefine foo --remove-disks=sda,sdc

Or delete all writable disks:

    virsh undefine foo --remove-disks

It would be best if virsh would print a confirmation for each disk
removed, so the admin knows whether it succeeded or not

  # virsh undefine foo --remove-disk-names=sda,sdc
  Deleted disk /path/to/disk/for/sda
  Failed to delete disk /path/to/disk/for/sdc

  # virsh undefine foo --remove-disk-names=sda,sdc
  Deleted disk /path/to/disk/for/sda
  Deleted disk /path/to/disk/for/sdc
  Undefined VM foo

|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

More information about the libvir-list mailing list