]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Fix error handling in virsh when listing storage volumes
authorDaniel P. Berrange <berrange@redhat.com>
Fri, 12 Nov 2010 15:51:14 +0000 (15:51 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Tue, 23 Nov 2010 15:00:35 +0000 (15:00 +0000)
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

index 78a5c5b4ab8d0758b0c81c259891f416104ea7e2..0ea1930e4b0c494d8fe556f8ac4c954e2da62416 100644 (file)
@@ -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));