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 <mprivozn(a)redhat.com>
---
tools/virsh-domain.c | 7 ++++++-
tools/virsh.pod | 14 ++++++++------
2 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index c7e4926..91b6f12 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -857,13 +857,15 @@ static int parseRateStr(const char *rateStr,
virNetDevBandwidthRatePtr rate)
typedef enum {
IFACE_TYPE_NETWORK = 0,
IFACE_TYPE_BRIDGE,
+ IFACE_TYPE_DIRECT,
IFACE_TYPE_LAST,
} vshCmdAttachInterfaceType;
VIR_ENUM_DECL(vshCmdAttachInterface)
VIR_ENUM_IMPL(vshCmdAttachInterface, IFACE_TYPE_LAST,
"network",
- "bridge")
+ "bridge",
+ "direct")
static bool
cmdAttachInterface(vshControl *ctl, const vshCmd *cmd)
@@ -951,6 +953,9 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd)
virBufferAsprintf(&buf, "<source %s='%s'/>\n",
vshCmdAttachInterfaceTypeToString(typ), source);
break;
+ case IFACE_TYPE_DIRECT:
+ virBufferAsprintf(&buf, "<source dev='%s'/>\n",
source);
+ break;
case IFACE_TYPE_LAST:
/* nada */
break;
diff --git a/tools/virsh.pod b/tools/virsh.pod
index e367e04..b89a649 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -2390,12 +2390,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<type> can be either
-I<network> to indicate connection via a libvirt virtual network or
-I<bridge> to indicate connection via a bridge device on the host.
-I<source> indicates the source of the connection (either the name of a
-network, or of a bridge device). I<target> 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<type> can be
+I<network> to indicate connection via a libvirt virtual network, or
+I<bridge> to indicate connection via a bridge device on the host, or
+I<direct> to indicate connection directly to one of the host's network
+interfaces or bridges. I<source> 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<target> 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<mac> specifies the MAC address of the network interface; if a MAC
--
2.0.5