[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [virt-tools-list] [RFC 1 of2] adding 802.1Qbg VSI type support to virtinst and virtmanager



On Mon, 2011-03-07 at 13:45 -0500, Cole Robinson wrote:
...
> Your mailer busted the patch. Easiest solution is to just attach the patch.

ok, attached this time

...
> This part should be dropped.
done

...
> _alter_compare should only be called once at the end of the function, it
> compares the guest instance that we altered against the expected output file.
> In fact I'm surprised calling it twice like this actually works: is python
> setup.py test actually passing?
> 
> You should probably also be checking all the new interface properties you are
> adding, like
> 
> check("vsi_managerid", "12", "15")
> 
> or similar.
> 
> Additionally, take a look at the _make_checker definition, that last
> assertEquals is redundant.

partially done. I have to admit I don't fully understand yet how the
tests work ... i just copied and modified.

...
> 
> I think I asked this before, but is it possible that an interface can have
> more than 1 virtualport? If not now then in the future? If so, it might be
> better to make a class InterfaceVirtualPort or something, and have the
> VirtualInterface carry a list of those.

the virtual interface of a VM can have one virtual port. But I am happy
to make such a class, if you point me to an example (I am not really a
python expert).

> Thanks,
> Cole

Thanks for your comments so far ..

-- 
Best regards, 

Gerhard Stenzel, 
-----------------------------------------------------------------------------------------------------------------------------------
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
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 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="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.py
===================================================================
--- python-virtinst.orig/tests/xmlparse.py
+++ python-virtinst/tests/xmlparse.py
@@ -361,6 +361,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")
@@ -392,6 +393,10 @@ 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")
+
         self._alter_compare(guest.get_config_xml(), outfile)
 
     def testAlterInputs(self):
Index: python-virtinst/virtinst/VirtualNetworkInterface.py
===================================================================
--- python-virtinst.orig/virtinst/VirtualNetworkInterface.py
+++ python-virtinst/virtinst/VirtualNetworkInterface.py
@@ -83,6 +83,11 @@ class VirtualNetworkInterface(VirtualDev
         self._model = None
         self._target_dev = None
         self._source_dev = None
+        self._vsi_managerid = None
+        self._vsi_typeid = None
+        self._vsi_typeidversion = None
+        self._vsi_instanceid = None
+        self._virtualport_type = None
 
         # Generate _random_mac
         self._random_mac = None
@@ -209,6 +214,41 @@ class VirtualNetworkInterface(VirtualDev
     source_dev = _xml_property(get_source_dev, set_source_dev,
                                xpath="./source/@dev")
 
+    def get_virtualport_type(self):
+        return self._virtualport_type
+    def set_virtualport_type(self, val):
+        self._virtualport_type = val
+    virtualport_type = _xml_property(get_virtualport_type, set_virtualport_type,
+                               xpath="./virtualport/@type")
+
+    def get_vsi_managerid(self):
+        return self._vsi_managerid
+    def set_vsi_managerid(self, val):
+        self._vsi_managerid = val
+    vsi_managerid = _xml_property(get_vsi_managerid, set_vsi_managerid,
+                               xpath="./virtualport/parameters/@managerid")
+
+    def get_vsi_typeid(self):
+        return self._vsi_typeid
+    def set_vsi_typeid(self, val):
+        self._vsi_typeid = val
+    vsi_typeid = _xml_property(get_vsi_typeid, set_vsi_typeid,
+                               xpath="./virtualport/parameters/@typeid")
+
+    def get_vsi_typeidversion(self):
+        return self._vsi_typeidversion
+    def set_vsi_typeidversion(self, val):
+        self._vsi_typeidversion = val
+    vsi_typeidversion = _xml_property(get_vsi_typeidversion, set_vsi_typeidversion,
+                               xpath="./virtualport/parameters/@typeidversion")
+
+    def get_vsi_instanceid(self):
+        return self._vsi_instanceid
+    def set_vsi_instanceid(self, val):
+        self._vsi_instanceid = val
+    vsi_instanceid = _xml_property(get_vsi_instanceid, set_vsi_instanceid,
+                               xpath="./virtualport/parameters/@instanceid")
+
     def is_conflict_net(self, conn, mac=None):
         """
         is_conflict_net: determines if mac conflicts with others in system

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]