提交 65a405dd 编写于 作者: O Osier Yang 提交者: Cole Robinson

virsh: Accept UUID as an argument for storage commands

Affected commands are: pool-start, vol-create-from.
(cherry picked from commit 05f8917f)
上级 b24a9f3e
...@@ -11037,7 +11037,7 @@ static const vshCmdInfo info_pool_start[] = { ...@@ -11037,7 +11037,7 @@ static const vshCmdInfo info_pool_start[] = {
}; };
static const vshCmdOptDef opts_pool_start[] = { static const vshCmdOptDef opts_pool_start[] = {
{"pool", VSH_OT_DATA, VSH_OFLAG_REQ, N_("name of the inactive pool")}, {"pool", VSH_OT_DATA, VSH_OFLAG_REQ, N_("name or uuid of the inactive pool")},
{NULL, 0, 0, NULL} {NULL, 0, 0, NULL}
}; };
...@@ -11046,18 +11046,18 @@ cmdPoolStart(vshControl *ctl, const vshCmd *cmd) ...@@ -11046,18 +11046,18 @@ cmdPoolStart(vshControl *ctl, const vshCmd *cmd)
{ {
virStoragePoolPtr pool; virStoragePoolPtr pool;
bool ret = true; bool ret = true;
const char *name = NULL;
if (!vshConnectionUsability(ctl, ctl->conn)) if (!vshConnectionUsability(ctl, ctl->conn))
return false; return false;
if (!(pool = vshCommandOptPoolBy(ctl, cmd, "pool", NULL, VSH_BYNAME))) if (!(pool = vshCommandOptPool(ctl, cmd, "pool", &name)))
return false; return false;
if (virStoragePoolCreate(pool, 0) == 0) { if (virStoragePoolCreate(pool, 0) == 0) {
vshPrint(ctl, _("Pool %s started\n"), vshPrint(ctl, _("Pool %s started\n"), name);
virStoragePoolGetName(pool));
} else { } else {
vshError(ctl, _("Failed to start pool %s"), virStoragePoolGetName(pool)); vshError(ctl, _("Failed to start pool %s"), name);
ret = false; ret = false;
} }
...@@ -11380,7 +11380,7 @@ static const vshCmdInfo info_vol_create_from[] = { ...@@ -11380,7 +11380,7 @@ static const vshCmdInfo info_vol_create_from[] = {
}; };
static const vshCmdOptDef opts_vol_create_from[] = { static const vshCmdOptDef opts_vol_create_from[] = {
{"pool", VSH_OT_DATA, VSH_OFLAG_REQ, N_("pool name")}, {"pool", VSH_OT_DATA, VSH_OFLAG_REQ, N_("pool name or uuid")},
{"file", VSH_OT_DATA, VSH_OFLAG_REQ, N_("file containing an XML vol description")}, {"file", VSH_OT_DATA, VSH_OFLAG_REQ, N_("file containing an XML vol description")},
{"vol", VSH_OT_DATA, VSH_OFLAG_REQ, N_("input vol name or key")}, {"vol", VSH_OT_DATA, VSH_OFLAG_REQ, N_("input vol name or key")},
{"inputpool", VSH_OT_STRING, 0, N_("pool name or uuid of the input volume's pool")}, {"inputpool", VSH_OT_STRING, 0, N_("pool name or uuid of the input volume's pool")},
...@@ -11399,7 +11399,7 @@ cmdVolCreateFrom(vshControl *ctl, const vshCmd *cmd) ...@@ -11399,7 +11399,7 @@ cmdVolCreateFrom(vshControl *ctl, const vshCmd *cmd)
if (!vshConnectionUsability(ctl, ctl->conn)) if (!vshConnectionUsability(ctl, ctl->conn))
goto cleanup; goto cleanup;
if (!(pool = vshCommandOptPoolBy(ctl, cmd, "pool", NULL, VSH_BYNAME))) if (!(pool = vshCommandOptPool(ctl, cmd, "pool", NULL)))
goto cleanup; goto cleanup;
if (vshCommandOptString(cmd, "file", &from) <= 0) { if (vshCommandOptString(cmd, "file", &from) <= 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册