aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2010-11-12 15:51:14 +0000
committerDaniel P. Berrange <berrange@redhat.com>2010-11-23 15:00:35 +0000
commit227ed26614b5747cc5b73d7b922c112a1f623949 (patch)
tree8cd3da4f02124d5dc6304f81c596cf9d05bd0461
parentImprove SCSI volume name generation (diff)
downloadlibvirt-227ed26614b5747cc5b73d7b922c112a1f623949.tar.gz
libvirt-227ed26614b5747cc5b73d7b922c112a1f623949.tar.bz2
libvirt-227ed26614b5747cc5b73d7b922c112a1f623949.zip
Fix error handling in virsh when listing storage volumes
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
-rw-r--r--tools/virsh.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/virsh.c b/tools/virsh.c
index 78a5c5b4a..0ea1930e4 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -6796,6 +6796,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;
+ }
+
/* Retrieve the list of volume names in the pool */
if (numVolumes > 0) {
activeNames = vshCalloc(ctl, numVolumes, sizeof(*activeNames));