[libvirt] [PATCH 11/11] Fix error handling in virsh when listing storage volumes

Eric Blake eblake at redhat.com
Fri Nov 19 18:47:25 UTC 2010


On 11/12/2010 09:22 AM, Daniel P. Berrange wrote:
> virsh was not checking for a error code when listing storage
> volumes. So when listing volumes in a pool that was shutoff,
> no output was displayed
> 
> * tools/virsh.c: Fix error handling when listing volumes
> ---
>  tools/virsh.c |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/tools/virsh.c b/tools/virsh.c
> index a840758..49dcd6e 100644
> --- a/tools/virsh.c
> +++ b/tools/virsh.c
> @@ -6738,6 +6738,12 @@ cmdVolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
>      /* Determine the number of volumes in the pool */
>      numVolumes = virStoragePoolNumOfVolumes(pool);
>  
> +    if (numVolumes < 0) {
> +        vshError(ctl, "%s", _("Failed to list storage volumes"));
> +        virStoragePoolFree(pool);
> +        return FALSE;
> +    }
> +

ACK, and not dependent on the rest of the series, if you want to rebase
this and push this early.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20101119/c01b954c/attachment-0001.sig>


More information about the libvir-list mailing list