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;
+    }
+
     /* Retrieve the list of volume names in the pool */
     if (numVolumes > 0) {
         activeNames = vshCalloc(ctl, numVolumes, sizeof(*activeNames));
-- 
1.7.2.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to