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

[virt-tools-list] Problems with virtinst NIC tests



On one of my machines I have bridging setup and this confuses the
virtinst test suite:

======================================================================
FAIL: testAlterNics (tests.xmlparse.XMLParseTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/lib/builder/source-root/virtinst/tests/xmlparse.py", line 368, in testAlterNics
    check("bridge", None, "newbr0")
  File "/var/lib/builder/source-root/virtinst/tests/xmlparse.py", line 81, in check
    return self._set_and_check(obj, name, initval, newval)
  File "/var/lib/builder/source-root/virtinst/tests/xmlparse.py", line 71, in _set_and_check
    self.assertEquals(initval, curval)
AssertionError: None != ['bridge', 'br0']


The root cause is VirtualNetworkInterface.py in

    def get_bridge(self):
        if not self._bridge and self.type == self.TYPE_BRIDGE:
            return self._generate_default_bridge()
        return self._bridge

Because my machine has several bridges present, _generate_default_bridge()
is filling one in, so instead of returning 'None', it returns '[bridge, br0]'

The hack solution is to change the order in the test suite, so we try
to query the bridge name before setting the type

diff -r c71298ab7565 tests/xmlparse.py
--- a/tests/xmlparse.py	Thu Feb 10 12:53:32 2011 -0500
+++ b/tests/xmlparse.py	Fri Feb 11 11:59:10 2011 +0000
@@ -363,9 +363,9 @@
 
         check = self._make_checker(dev2)
         self.assertEquals(dev2.get_source(), "default")
+        check("bridge", None, "newbr0")
         check("type", "network", "bridge")
         check("network", "default", None)
-        check("bridge", None, "newbr0")
         check("model", "e1000", "virtio")
 
         check = self._make_checker(dev3)


Once that's done I see another failure because change-nics-out.xml
has XML elements in the wrong order:


diff -r c71298ab7565 tests/xmlparse-xml/change-nics-out.xml
--- a/tests/xmlparse-xml/change-nics-out.xml	Thu Feb 10 12:53:32 2011 -0500
+++ b/tests/xmlparse-xml/change-nics-out.xml	Fri Feb 11 11:59:10 2011 +0000
@@ -24,9 +24,9 @@
       <source bridge="br0" network="route"/>
     </interface>
     <interface type="bridge">
+      <source bridge="newbr0"/>
       <mac address="11:22:33:44:55:66"/>
       <model type="virtio"/>
-      <source bridge="newbr0"/>
     </interface>
     <interface type="bridge">
       <source bridge="newfoo0" network="default"/>


Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|


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