mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-22 14:09:22 +00:00
virsh: More friendly err if no pool is specified for looking up a vol
There are 3 ways to lookup a volume, only virStorageVolLookupByName needs pool object. So if no --pool is specified, it will tries to get the volume via virStorageVolLookupByPath/virStorageVolLookupByKey. But if all 3 ways fails, and no --pool is specified, a friendly error might help the user get right way quickly.
This commit is contained in:
parent
bc4e5b43c2
commit
2f0595244b
@ -14714,8 +14714,13 @@ vshCommandOptVolBy(vshControl *ctl, const vshCmd *cmd,
|
|||||||
vol = virStorageVolLookupByPath(ctl->conn, n);
|
vol = virStorageVolLookupByPath(ctl->conn, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!vol)
|
if (!vol) {
|
||||||
|
if (pool)
|
||||||
vshError(ctl, _("failed to get vol '%s'"), n);
|
vshError(ctl, _("failed to get vol '%s'"), n);
|
||||||
|
else
|
||||||
|
vshError(ctl, _("failed to get vol '%s', specifying --pool "
|
||||||
|
"might help"), n);
|
||||||
|
}
|
||||||
|
|
||||||
if (pool)
|
if (pool)
|
||||||
virStoragePoolFree(pool);
|
virStoragePoolFree(pool);
|
||||||
|
Loading…
Reference in New Issue
Block a user