mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-20 11:35:19 +00:00
virsh: Accept UUID as an argument for net-info and net-start
(cherry picked from commit 68fcfdb8bd33ef323c6c4c5b9a92b1a44829eb6a)
This commit is contained in:
parent
65a405dd04
commit
9274256d5b
@ -8171,7 +8171,7 @@ static const vshCmdInfo info_network_info[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const vshCmdOptDef opts_network_info[] = {
|
static const vshCmdOptDef opts_network_info[] = {
|
||||||
{"network", VSH_OT_DATA, VSH_OFLAG_REQ, N_("network name")},
|
{"network", VSH_OT_DATA, VSH_OFLAG_REQ, N_("network name or uuid")},
|
||||||
{NULL, 0, 0, NULL}
|
{NULL, 0, 0, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -8188,8 +8188,7 @@ cmdNetworkInfo(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (!vshConnectionUsability(ctl, ctl->conn))
|
if (!vshConnectionUsability(ctl, ctl->conn))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!(network = vshCommandOptNetworkBy(ctl, cmd, NULL,
|
if (!(network = vshCommandOptNetwork(ctl, cmd, NULL)))
|
||||||
VSH_BYNAME)))
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
vshPrint(ctl, "%-15s %s\n", _("Name"), virNetworkGetName(network));
|
vshPrint(ctl, "%-15s %s\n", _("Name"), virNetworkGetName(network));
|
||||||
@ -8486,7 +8485,7 @@ static const vshCmdInfo info_network_start[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const vshCmdOptDef opts_network_start[] = {
|
static const vshCmdOptDef opts_network_start[] = {
|
||||||
{"network", VSH_OT_DATA, VSH_OFLAG_REQ, N_("name of the inactive network")},
|
{"network", VSH_OT_DATA, VSH_OFLAG_REQ, N_("network name or uuid")},
|
||||||
{NULL, 0, 0, NULL}
|
{NULL, 0, 0, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -8495,19 +8494,18 @@ cmdNetworkStart(vshControl *ctl, const vshCmd *cmd)
|
|||||||
{
|
{
|
||||||
virNetworkPtr network;
|
virNetworkPtr network;
|
||||||
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 (!(network = vshCommandOptNetworkBy(ctl, cmd, NULL, VSH_BYNAME)))
|
if (!(network = vshCommandOptNetwork(ctl, cmd, &name)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (virNetworkCreate(network) == 0) {
|
if (virNetworkCreate(network) == 0) {
|
||||||
vshPrint(ctl, _("Network %s started\n"),
|
vshPrint(ctl, _("Network %s started\n"), name);
|
||||||
virNetworkGetName(network));
|
|
||||||
} else {
|
} else {
|
||||||
vshError(ctl, _("Failed to start network %s"),
|
vshError(ctl, _("Failed to start network %s"), name);
|
||||||
virNetworkGetName(network));
|
|
||||||
ret = false;
|
ret = false;
|
||||||
}
|
}
|
||||||
virNetworkFree(network);
|
virNetworkFree(network);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user