提交 2f059524 编写于 作者: O Osier Yang

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.
上级 bc4e5b43
......@@ -14714,8 +14714,13 @@ vshCommandOptVolBy(vshControl *ctl, const vshCmd *cmd,
vol = virStorageVolLookupByPath(ctl->conn, n);
}
if (!vol)
vshError(ctl, _("failed to get vol '%s'"), n);
if (!vol) {
if (pool)
vshError(ctl, _("failed to get vol '%s'"), n);
else
vshError(ctl, _("failed to get vol '%s', specifying --pool "
"might help"), n);
}
if (pool)
virStoragePoolFree(pool);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册