From e008a03324c6ec3769ffd71d4098dc4762042c95 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Mon, 9 Feb 2015 16:17:51 +0100 Subject: [PATCH] virsh attach-interface: Allow macvtap hotplug Our hotplug code supports macvtap insertion to guests. However, we somehow forgot about 'attach-interface' (which tries to build XML from passed arguments and use virDomainAttachDeviceFlags()). New type is accessible under 'direct' type, to keep the same type as used in domain XML. Signed-off-by: Michal Privoznik --- tools/virsh-domain.c | 4 +++- tools/virsh.pod | 14 ++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 66f17922a2..dc4a863446 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -984,6 +984,9 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd) virBufferAsprintf(&buf, "\n", virDomainNetTypeToString(typ), source); break; + case VIR_DOMAIN_NET_TYPE_DIRECT: + virBufferAsprintf(&buf, "\n", source); + break; case VIR_DOMAIN_NET_TYPE_USER: case VIR_DOMAIN_NET_TYPE_ETHERNET: @@ -992,7 +995,6 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd) case VIR_DOMAIN_NET_TYPE_CLIENT: case VIR_DOMAIN_NET_TYPE_MCAST: case VIR_DOMAIN_NET_TYPE_INTERNAL: - case VIR_DOMAIN_NET_TYPE_DIRECT: case VIR_DOMAIN_NET_TYPE_HOSTDEV: case VIR_DOMAIN_NET_TYPE_LAST: vshError(ctl, _("No support for %s in command 'attach-interface'"), diff --git a/tools/virsh.pod b/tools/virsh.pod index a3f527fe72..50de32c3e8 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -2391,12 +2391,14 @@ Likewise, I<--shareable> is an alias for I<--mode shareable>. [I<--target target>] [I<--mac mac>] [I<--script script>] [I<--model model>] [I<--config>] [I<--inbound average,peak,burst>] [I<--outbound average,peak,burst>] -Attach a new network interface to the domain. I can be either -I to indicate connection via a libvirt virtual network or -I to indicate connection via a bridge device on the host. -I indicates the source of the connection (either the name of a -network, or of a bridge device). I is used to specify the -tap/macvtap device to be used to connect the domain to the +Attach a new network interface to the domain. I can be +I to indicate connection via a libvirt virtual network, or +I to indicate connection via a bridge device on the host, or +I to indicate connection directly to one of the host's network +interfaces or bridges. I indicates the source of the +connection (the name of a network, or of a bridge device, or the +host's network interfaces or bridges). I is used to specify +the tap/macvtap device to be used to connect the domain to the source. Names starting with 'vnet' are considered as auto-generated and are blanked out/regenerated each time the interface is attached. I specifies the MAC address of the network interface; if a MAC