]> xenbits.xensource.com Git - libvirt.git/commit
virsh: volume: Fix lookup of volumes to provide better error messages
authorPeter Krempa <pkrempa@redhat.com>
Mon, 3 Mar 2014 14:21:37 +0000 (15:21 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 5 Mar 2014 08:08:32 +0000 (09:08 +0100)
commita751e3452b0280df64a9a67a6c96a09e1045026e
tree46572578b89d51ff8a2f40075ca7cf1f35a8ed22
parent6b4c0a635e1ecfdff59aad6742b0fe4de929aed1
virsh: volume: Fix lookup of volumes to provide better error messages

If a user specifies the pool explicitly, we should make sure to point
out that it's inactive instead of falling back to lookup by key/path and
failing at the end. Also if the pool isn't found there's no use in
continuing the lookup.

This changes the error in case the user-selected pool is inactive from:

 $ virsh vol-upload --pool inactivepool --vol somevolname volcontents
 error: failed to get vol 'somevolname'
 error: Storage volume not found: no storage vol with matching path
 somevolname

To a more descriptive:

 $ virsh vol-upload --pool inactivepool --vol somevolname volcontents
 error: pool 'inactivepool' is not active

And in case a user specifies an invalid pool from:

 $ virsh vol-upload --pool invalidpool --vol somevolname volcontents
 error: failed to get pool 'invalidpool'
 error: failed to get vol 'somevolname', specifying --pool might help
 error: Storage volume not found: no storage vol with matching path somevolname

To something less confusing:

 $ virsh vol-upload --pool invalidpool --vol somevolname volcontents
 error: failed to get pool 'invalidpool'
 error: Storage pool not found: no storage pool with matching name 'invalidpool'
tools/virsh-volume.c