[virt-tools-list] [RFC 1 of2] adding 802.1Qbg VSI type support to virtinst and virtmanager
Cole Robinson
crobinso at redhat.com
Wed Mar 16 16:48:53 UTC 2011
On 03/10/2011 08:59 AM, Gerhard Stenzel wrote:
> The following patch adds support for VSI type XML elements
> to virt-inst, so the respective value can be viewed and edited
> via virt-manager
>
> Signed-off-by: Gerhard Stenzel <gerhard.stenzel at de.ibm.com>
>
> Index: python-virtinst/tests/xmlparse-xml/change-nics-in.xml
> ===================================================================
> --- python-virtinst.orig/tests/xmlparse-xml/change-nics-in.xml
> +++ python-virtinst/tests/xmlparse-xml/change-nics-in.xml
> @@ -36,6 +36,14 @@
> <script path="/etc/qemu-ifup"/>
> <target dev="nic02"/>
> </interface>
> + <interface type="direct">
> + <mac address="00:11:22:33:44:55"/>
> + <source dev="eth0.1" mode="vepa"/>
> + <virtualport type="802.1Qbg">
> + <parameters managerid="12" typeid="1193046" typeidversion="1" instanceid="09b11c53-8b5c-4eeb-8f00-d84eaa0aaa3b"/>
> + </virtualport>
> + <address type="pci" domain="0x0000" bus="0x00" slot="0x07" function="0x0"/>
> + </interface>
> <input type="mouse" bus="ps2"/>
> <graphics type="sdl" display=":3.4" xauth="/tmp/.Xauthority"/>
> <console type="pty"/>
> 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
> @@ -38,6 +38,14 @@
> <source dev="eth1"/>
> <script path="/etc/qemu-ifup"/>
> </interface>
> + <interface type="direct">
> + <mac address="00:11:22:33:44:55"/>
> + <source dev="eth0.1" mode="vepa"/>
> + <virtualport type="802.1Qbg">
> + <parameters managerid="11" typeid="1193047" typeidversion="2" instanceid="09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f"/>
> + </virtualport>
> + <address type="pci" domain="0x0000" bus="0x00" slot="0x07" function="0x0"/>
> + </interface>
> <input type="mouse" bus="ps2"/>
> <graphics type="sdl" display=":3.4" xauth="/tmp/.Xauthority"/>
> <console type="pty"/>
> Index: python-virtinst/tests/xmlparse.py
> ===================================================================
> --- python-virtinst.orig/tests/xmlparse.py
> +++ python-virtinst/tests/xmlparse.py
> @@ -362,6 +362,7 @@ class XMLParseTest(unittest.TestCase):
> dev2 = guest.get_devices("interface")[1]
> dev3 = guest.get_devices("interface")[2]
> dev4 = guest.get_devices("interface")[3]
> + dev5 = guest.get_devices("interface")[4]
>
> check = self._make_checker(dev1)
> check("type", "user")
> @@ -393,6 +394,18 @@ class XMLParseTest(unittest.TestCase):
> check("target_dev", "nic03", None)
> self.assertEquals(dev4.get_source(), "eth1")
>
> + check = self._make_checker(dev5)
> + check("type", "direct")
> + check("source_dev", "eth0.1")
> +
> + virtualport = dev5._get_virtualport()
Since you do
virtualport = property(_get_virtualport)
in the VirtualPort class, the preferred way to access the structure is
dev.virtualport
> + check = self._make_checker(virtualport)
> + check("type", "802.1Qbg")
> + check("managerid", "12", "11")
> + check("typeid", "1193046", "1193047")
> + check("typeidversion", "1", "2")
> + check("instanceid", "09b11c53-8b5c-4eeb-8f00-d84eaa0aaa3b", "09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f")
> +
I generally try to avoid going over 80 chars if possible.
I made these changes, added you to AUTHORS, and pushed:
http://git.fedorahosted.org/git?p=python-virtinst.git;a=commit;h=c0865f51196fc63dc90ceaa590d81ceffedd9ca6
Thanks,
Cole
More information about the virt-tools-list
mailing list