mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 11:35:19 +00:00
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
This commit is contained in:
parent
174d737d95
commit
227ed26614
@ -6796,6 +6796,12 @@ cmdVolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
|
|||||||
/* Determine the number of volumes in the pool */
|
/* Determine the number of volumes in the pool */
|
||||||
numVolumes = virStoragePoolNumOfVolumes(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 */
|
/* Retrieve the list of volume names in the pool */
|
||||||
if (numVolumes > 0) {
|
if (numVolumes > 0) {
|
||||||
activeNames = vshCalloc(ctl, numVolumes, sizeof(*activeNames));
|
activeNames = vshCalloc(ctl, numVolumes, sizeof(*activeNames));
|
||||||
|
Loading…
Reference in New Issue
Block a user