Blob Blame History Raw
From 79d2f8aa7739fd4e6012a1fb48876dcc0d1efa7b Mon Sep 17 00:00:00 2001
From: Cole Robinson <crobinso@redhat.com>
Date: Thu, 9 Jan 2014 18:09:54 +0100
Subject: [RHEL-7.0 virt-manager PATCH] virt-install: Support --network source,
 source_mode, target

The latter two bits are needed for macvtap configuration.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1049041

(cherry picked from commit 95170e8892ecac6a8762990d4cbef9bac14095b2)
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Conflicts:
	tests/cli-test-xml/compare/many-devices.xml
	tests/clitest.py
	virtinst/cli.py
---
 man/virt-install.pod                        |  4 ++++
 tests/cli-test-xml/compare/many-devices.xml | 10 ++++++++++
 tests/clitest.py                            |  2 +-
 virtinst/cli.py                             |  3 +++
 4 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/man/virt-install.pod b/man/virt-install.pod
index 3534875..8e4cf09 100644
--- a/man/virt-install.pod
+++ b/man/virt-install.pod
@@ -586,6 +586,10 @@ with a name of C<default>. Use a virtual network if the host has dynamic
 networking (eg NetworkManager), or using wireless. The guest will be
 NATed to the LAN by whichever connection is active.

+=item type=direct,source=IFACE[,source_mode=MODE]
+
+Direct connect to host interface IFACE using macvtap.
+
 =item user

 Connect to the LAN using SLIRP. Only use this if running a QEMU guest as
diff --git a/tests/cli-test-xml/compare/many-devices.xml b/tests/cli-test-xml/compare/many-devices.xml
index 8773919..4f8c856 100644
--- a/tests/cli-test-xml/compare/many-devices.xml
+++ b/tests/cli-test-xml/compare/many-devices.xml
@@ -66,6 +66,11 @@
       <mac address='00:11:22:33:44:55'/>
       <model type='virtio'/>
     </interface>
+    <interface type='direct'>
+      <source dev='eth5' mode='vepa'/>
+      <mac address='00:11:22:33:44:55'/>
+      <target dev='mytap12'/>
+    </interface>
     <input type='mouse' bus='ps2'/>
     <serial type='tcp'>
       <source mode='bind' host='127.0.0.1' service='2222'/>
@@ -148,6 +153,11 @@
       <mac address='00:11:22:33:44:55'/>
       <model type='virtio'/>
     </interface>
+    <interface type='direct'>
+      <source dev='eth5' mode='vepa'/>
+      <mac address='00:11:22:33:44:55'/>
+      <target dev='mytap12'/>
+    </interface>
     <input type='mouse' bus='ps2'/>
     <serial type='tcp'>
       <source mode='bind' host='127.0.0.1' service='2222'/>
diff --git a/tests/clitest.py b/tests/clitest.py
index 86f670e..fcaac02 100644
--- a/tests/clitest.py
+++ b/tests/clitest.py
@@ -461,7 +461,7 @@ vinst.add_category("misc", "--nographics --noautoconsole")
 vinst.add_compare("misc", "", "noargs-fail")  # No arguments
 vinst.add_compare("misc", "--hvm --nodisks --pxe --print-step all", "simple-pxe")  # Diskless PXE install
 vinst.add_compare("misc", "--hvm --cdrom %(EXISTIMG2)s --file %(EXISTIMG1)s --os-variant win2k3 --wait 0 --vcpus cores=4", "w2k3-cdrom")  # HVM windows install with disk
-vinst.add_compare("misc", """--hvm --pxe --controller usb,model=ich9-ehci1,address=0:0:4.7,index=0 --controller usb,model=ich9-uhci1,address=0:0:4.0,index=0,master=0 --controller usb,model=ich9-uhci2,address=0:0:4.1,index=0,master=2 --controller usb,model=ich9-uhci3,address=0:0:4.2,index=0,master=4 --disk %(MANAGEDEXISTUPPER)s,cache=writeback,io=threads,perms=sh,serial=WD-WMAP9A966149 --disk %(NEWIMG1)s,sparse=false,size=.001,perms=ro,error_policy=enospace --disk device=cdrom,bus=sata --serial tcp,host=:2222,mode=bind,protocol=telnet --filesystem /source,/target,mode=squash --network user,mac=12:34:56:78:11:22 --network bridge=foobar,model=virtio --channel spicevmc --smartcard passthrough,type=spicevmc --security type=static,label='system_u:object_r:svirt_image_t:s0:c100,c200',relabel=yes  --numatune \\"1-3,5\\",mode=preferred --boot loader=/foo/bar """, "many-devices")  # Lot's of devices
+vinst.add_compare("misc", """--hvm --pxe --controller usb,model=ich9-ehci1,address=0:0:4.7,index=0 --controller usb,model=ich9-uhci1,address=0:0:4.0,index=0,master=0 --controller usb,model=ich9-uhci2,address=0:0:4.1,index=0,master=2 --controller usb,model=ich9-uhci3,address=0:0:4.2,index=0,master=4 --disk %(MANAGEDEXISTUPPER)s,cache=writeback,io=threads,perms=sh,serial=WD-WMAP9A966149 --disk %(NEWIMG1)s,sparse=false,size=.001,perms=ro,error_policy=enospace --disk device=cdrom,bus=sata --serial tcp,host=:2222,mode=bind,protocol=telnet --filesystem /source,/target,mode=squash --network user,mac=12:34:56:78:11:22 --network bridge=foobar,model=virtio --channel spicevmc --network type=direct,source=eth5,source_mode=vepa,target=mytap12 --smartcard passthrough,type=spicevmc --security type=static,label='system_u:object_r:svirt_image_t:s0:c100,c200',relabel=yes  --numatune \\"1-3,5\\",mode=preferred --boot loader=/foo/bar """, "many-devices")  # Lot's of devices
 vinst.add_compare("misc", "--connect %(DEFAULTURI)s --hvm --nodisks --pxe --cpuset auto --vcpus 2", "cpuset-auto")  # --cpuset=auto actually works
 vinst.add_valid("misc", "--hvm --disk path=virt-install,device=cdrom")  # Specifying cdrom media via --disk
 vinst.add_valid("misc", "--hvm --import --disk path=virt-install")  # FV Import install
diff --git a/virtinst/cli.py b/virtinst/cli.py
index 2778ecc..7c4912a 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -1761,6 +1761,9 @@ def parse_network(guest, optstring, dev=None, mac=None):
     set_param("type", "type", net_type)
     set_param("network", "network")
     set_param("bridge", "bridge")
+    set_param("source", "source")
+    set_param("source_mode", "source_mode")
+    set_param("target_dev", "target")
     set_param("model", "model")
     set_param("macaddr", "mac")

-- 
1.8.5.2