virt-install: Support --network source, source_mode, target

The latter two bits are needed for macvtap configuration.
This commit is contained in:
Cole Robinson 2014-01-06 15:17:32 -05:00
parent b5da599aef
commit 95170e8892
4 changed files with 20 additions and 2 deletions

View File

@ -634,6 +634,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

View File

@ -74,6 +74,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"/>
@ -173,6 +178,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"/>

View File

@ -506,6 +506,7 @@ c.add_compare("""--hvm --pxe \
--filesystem /source,/target,mode=squash \
--network user,mac=12:34:56:78:11:22 \
--network bridge=foobar,model=virtio \
--network type=direct,source=eth5,source_mode=vepa,target=mytap12 \
--channel spicevmc \
--smartcard passthrough,type=spicevmc \
--tpm /dev/tpm0 \

View File

@ -1516,8 +1516,10 @@ def parse_network(guest, optstr, dev):
if "type" not in opts:
if "network" in opts:
opts["type"] = virtinst.VirtualNetworkInterface.TYPE_VIRTUAL
opts["source"] = opts.pop("network")
elif "bridge" in opts:
opts["type"] = virtinst.VirtualNetworkInterface.TYPE_BRIDGE
opts["source"] = opts.pop("bridge")
def convert_mac(key, val):
ignore = key
@ -1526,8 +1528,9 @@ def parse_network(guest, optstr, dev):
return val
set_param("type", "type")
set_param("source", "network")
set_param("source", "bridge")
set_param("source", "source")
set_param("source_mode", "source_mode")
set_param("target_dev", "target")
set_param("model", "model")
set_param("macaddr", "mac", convert_cb=convert_mac)
set_param("filterref", "filterref")