[virt-tools-list] [PATCH] virtinst: make mode for direct interfaces selectable
Gerhard Stenzel
gstenzel at linux.vnet.ibm.com
Mon Apr 18 14:31:02 UTC 2011
The following patch adds support to select the mode for
direct interfaces
Signed-off-by: Gerhard Stenzel <gerhard.stenzel at de.ibm.com>
Index: python-virtinst/tests/xmlparse-xml/change-nics-out.xml
===================================================================
--- python-virtinst.orig/tests/xmlparse-xml/change-nics-out.xml
+++ python-virtinst/tests/xmlparse-xml/change-nics-out.xml
@@ -40,7 +40,7 @@
</interface>
<interface type="direct">
<mac address="00:11:22:33:44:55"/>
- <source dev="eth0.1" mode="vepa"/>
+ <source dev="eth0.1" mode="bridge"/>
<virtualport type="802.1Qbg">
<parameters managerid="11" typeid="1193047" typeidversion="2" instanceid="09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f"/>
</virtualport>
Index: python-virtinst/tests/xmlparse.py
===================================================================
--- python-virtinst.orig/tests/xmlparse.py
+++ python-virtinst/tests/xmlparse.py
@@ -397,6 +397,7 @@ class XMLParseTest(unittest.TestCase):
check = self._make_checker(dev5)
check("type", "direct")
check("source_dev", "eth0.1")
+ check("source_mode", "vepa", "bridge")
virtualport = dev5.virtualport
check = self._make_checker(virtualport)
Index: python-virtinst/virtinst/VirtualNetworkInterface.py
===================================================================
--- python-virtinst.orig/virtinst/VirtualNetworkInterface.py
+++ python-virtinst/virtinst/VirtualNetworkInterface.py
@@ -136,6 +136,7 @@ class VirtualNetworkInterface(VirtualDev
self._model = None
self._target_dev = None
self._source_dev = None
+ self._source_mode = "vepa"
self._virtualport = VirtualPort(conn, parsexml, parsexmlnode, caps)
# Generate _random_mac
@@ -282,6 +283,13 @@ class VirtualNetworkInterface(VirtualDev
source_dev = _xml_property(get_source_dev, set_source_dev,
xpath="./source/@dev")
+ def get_source_mode(self):
+ return self._source_mode
+ def set_source_mode(self, newmode):
+ self._source_mode = newmode
+ source_mode = _xml_property(get_source_mode, set_source_mode,
+ xpath="./source/@mode")
+
def is_conflict_net(self, conn, mac=None):
"""
is_conflict_net: determines if mac conflicts with others in system
@@ -354,7 +362,7 @@ class VirtualNetworkInterface(VirtualDev
elif self.type == self.TYPE_ETHERNET and self.source_dev:
src_xml = " <source dev='%s'/>\n" % self.source_dev
elif self.type == self.TYPE_DIRECT and self.source_dev:
- src_xml = " <source dev='%s' mode='vepa'/>\n" % self.source_dev
+ src_xml = " <source dev='%s' mode='%s'/>\n" % (self.source_dev, self.source_mode)
if self.model:
model_xml = " <model type='%s'/>\n" % self.model
===================================================================
Best regards,
Gerhard Stenzel
-------------------------------------------------------------------------------------
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschaeftsfuehrung: Dirk Wittkopp
Sitz der Gesellschaft: Boeblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
More information about the virt-tools-list
mailing list