mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-05 05:45:46 +00:00
virsh: Support alias in attach-interface
Add --alias to support custom alias in virsh attach-interface. Signed-off-by: Han Han <hhan@redhat.com> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
64c579b705
commit
e1b75dc500
@ -837,6 +837,10 @@ static const vshCmdOptDef opts_attach_interface[] = {
|
|||||||
.type = VSH_OT_STRING,
|
.type = VSH_OT_STRING,
|
||||||
.help = N_("model type")
|
.help = N_("model type")
|
||||||
},
|
},
|
||||||
|
{.name = "alias",
|
||||||
|
.type = VSH_OT_STRING,
|
||||||
|
.help = N_("custom alias name of interface device")
|
||||||
|
},
|
||||||
{.name = "inbound",
|
{.name = "inbound",
|
||||||
.type = VSH_OT_STRING,
|
.type = VSH_OT_STRING,
|
||||||
.help = N_("control domain's incoming traffics")
|
.help = N_("control domain's incoming traffics")
|
||||||
@ -910,7 +914,7 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd)
|
|||||||
virDomainPtr dom = NULL;
|
virDomainPtr dom = NULL;
|
||||||
const char *mac = NULL, *target = NULL, *script = NULL,
|
const char *mac = NULL, *target = NULL, *script = NULL,
|
||||||
*type = NULL, *source = NULL, *model = NULL,
|
*type = NULL, *source = NULL, *model = NULL,
|
||||||
*inboundStr = NULL, *outboundStr = NULL;
|
*inboundStr = NULL, *outboundStr = NULL, *alias = NULL;
|
||||||
virNetDevBandwidthRate inbound, outbound;
|
virNetDevBandwidthRate inbound, outbound;
|
||||||
virDomainNetType typ;
|
virDomainNetType typ;
|
||||||
int ret;
|
int ret;
|
||||||
@ -940,6 +944,7 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd)
|
|||||||
vshCommandOptStringReq(ctl, cmd, "mac", &mac) < 0 ||
|
vshCommandOptStringReq(ctl, cmd, "mac", &mac) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "script", &script) < 0 ||
|
vshCommandOptStringReq(ctl, cmd, "script", &script) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "model", &model) < 0 ||
|
vshCommandOptStringReq(ctl, cmd, "model", &model) < 0 ||
|
||||||
|
vshCommandOptStringReq(ctl, cmd, "alias", &alias) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "inbound", &inboundStr) < 0 ||
|
vshCommandOptStringReq(ctl, cmd, "inbound", &inboundStr) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "outbound", &outboundStr) < 0)
|
vshCommandOptStringReq(ctl, cmd, "outbound", &outboundStr) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -1037,6 +1042,9 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (model != NULL)
|
if (model != NULL)
|
||||||
virBufferAsprintf(&buf, "<model type='%s'/>\n", model);
|
virBufferAsprintf(&buf, "<model type='%s'/>\n", model);
|
||||||
|
|
||||||
|
if (alias != NULL)
|
||||||
|
virBufferAsprintf(&buf, "<alias name='%s'/>\n", alias);
|
||||||
|
|
||||||
if (inboundStr || outboundStr) {
|
if (inboundStr || outboundStr) {
|
||||||
virBufferAddLit(&buf, "<bandwidth>\n");
|
virBufferAddLit(&buf, "<bandwidth>\n");
|
||||||
virBufferAdjustIndent(&buf, 2);
|
virBufferAdjustIndent(&buf, 2);
|
||||||
|
@ -3090,7 +3090,7 @@ Likewise, I<--shareable> is an alias for I<--mode shareable>.
|
|||||||
[[[I<--live>] [I<--config>] | [I<--current>]] | [I<--persistent>]]
|
[[[I<--live>] [I<--config>] | [I<--current>]] | [I<--persistent>]]
|
||||||
[I<--target target>] [I<--mac mac>] [I<--script script>] [I<--model model>]
|
[I<--target target>] [I<--mac mac>] [I<--script script>] [I<--model model>]
|
||||||
[I<--inbound average,peak,burst,floor>] [I<--outbound average,peak,burst>]
|
[I<--inbound average,peak,burst,floor>] [I<--outbound average,peak,burst>]
|
||||||
[I<--managed>] [I<--print-xml>]
|
[I<--alias alias>] [I<--managed>] [I<--print-xml>]
|
||||||
|
|
||||||
Attach a new network interface to the domain.
|
Attach a new network interface to the domain.
|
||||||
|
|
||||||
@ -3144,6 +3144,8 @@ I<bridge> type and only for Xen domains.
|
|||||||
B<--model> specifies the network device model to be presented to the
|
B<--model> specifies the network device model to be presented to the
|
||||||
domain.
|
domain.
|
||||||
|
|
||||||
|
B<alias> can set user supplied alias.
|
||||||
|
|
||||||
B<--inbound> and B<--outbound> control the bandwidth of the
|
B<--inbound> and B<--outbound> control the bandwidth of the
|
||||||
interface. At least one from the I<average>, I<floor> pair must be
|
interface. At least one from the I<average>, I<floor> pair must be
|
||||||
specified. The other two I<peak> and I<burst> are optional, so
|
specified. The other two I<peak> and I<burst> are optional, so
|
||||||
|
Loading…
Reference in New Issue
Block a user