[virt-tools-list] [PATCH] Test test case with many console devices wrt new libvirt

Daniel P. Berrange berrange at redhat.com
Thu Nov 3 20:04:11 UTC 2011


From: "Daniel P. Berrange" <berrange at redhat.com>

Current libvirt does not support multiple <console> devices in
the XML. The virtinst test suite creates these configurations,
but the second device has always been ignored by libvirt.

The next libvirt (0.9.7) will now support multiple console
devices, but with the restriction that only the first console
may be a clone of the <serial> device. The current virtinst
test suite XML is creating a config where the second console
is being treated as clone, due to lack of any target type.

So with the new libvirt the virtinst test suite is now broken
because the previously ignored XML is now being validated and
shown to be non-compliant.

The trivial fix is to just reverse the order of the <console>
devices in the virtinst test
---
 tests/xmlconfig-xml/boot-many-chars.xml |    2 +-
 tests/xmlconfig.py                      |    2 +-
 tests/xmlparse-xml/change-chars-in.xml  |    2 +-
 tests/xmlparse-xml/change-chars-out.xml |    2 +-
 tests/xmlparse.py                       |    8 ++++----
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/tests/xmlconfig-xml/boot-many-chars.xml b/tests/xmlconfig-xml/boot-many-chars.xml
index 0d81ddb..2f425dd 100644
--- a/tests/xmlconfig-xml/boot-many-chars.xml
+++ b/tests/xmlconfig-xml/boot-many-chars.xml
@@ -32,10 +32,10 @@
       <source mode='bind' host='my.bind.host' service='1111'/>
       <source mode='connect' host='my.source.host' service='2222'/>
     </parallel>
+    <console type='pty'/>
     <console type='pty'>
       <target type='virtio'/>
     </console>
-    <console type='pty'/>
     <channel type='pty'>
       <target type='virtio' name='foo.bar.frob'/>
     </channel>
diff --git a/tests/xmlconfig.py b/tests/xmlconfig.py
index 7855a8a..1f16404 100644
--- a/tests/xmlconfig.py
+++ b/tests/xmlconfig.py
@@ -666,11 +666,11 @@ class TestXMLConfig(unittest.TestCase):
         dev6 = VirtualCharDevice.get_dev_instance(g.conn,
                                                   VirtualCharDevice.DEV_CONSOLE,
                                                   VirtualCharDevice.CHAR_PTY)
-        dev6.target_type = dev5.CHAR_CONSOLE_TARGET_VIRTIO
 
         dev7 = VirtualCharDevice.get_dev_instance(g.conn,
                                                   VirtualCharDevice.DEV_CONSOLE,
                                                   VirtualCharDevice.CHAR_PTY)
+        dev7.target_type = dev5.CHAR_CONSOLE_TARGET_VIRTIO
 
         dev8 = VirtualCharDevice.get_dev_instance(g.conn,
                                                   VirtualCharDevice.DEV_CHANNEL,
diff --git a/tests/xmlparse-xml/change-chars-in.xml b/tests/xmlparse-xml/change-chars-in.xml
index 91333ec..e36c45c 100644
--- a/tests/xmlparse-xml/change-chars-in.xml
+++ b/tests/xmlparse-xml/change-chars-in.xml
@@ -32,11 +32,11 @@
       <source mode="bind" host="my.bind.host" service="1111"/>
       <source mode="connect" host="my.source.host" service="2222"/>
     </parallel>
+    <console type="pty"/>
     <console type="file">
       <source path="/tmp/foo.img"/>
       <target type="virtio"/>
     </console>
-    <console type="pty"/>
     <channel type="pty">
       <target type="virtio" name="foo.bar.frob"/>
     </channel>
diff --git a/tests/xmlparse-xml/change-chars-out.xml b/tests/xmlparse-xml/change-chars-out.xml
index 4b02b6d..1dd0e88 100644
--- a/tests/xmlparse-xml/change-chars-out.xml
+++ b/tests/xmlparse-xml/change-chars-out.xml
@@ -32,11 +32,11 @@
       <source mode="bind" host="my.foo.host" service="1357"/>
       <source mode="connect" host="source.foo.host" service="7777"/>
     </parallel>
+    <console type="pty"/>
     <console type="file">
       <target type="virtio"/>
       <source path="/root/foo"/>
     </console>
-    <console type="pty"/>
     <channel type="pty">
       <target type="virtio" name="test.changed"/>
     </channel>
diff --git a/tests/xmlparse.py b/tests/xmlparse.py
index 674f28e..a781f2c 100644
--- a/tests/xmlparse.py
+++ b/tests/xmlparse.py
@@ -312,15 +312,15 @@ class XMLParseTest(unittest.TestCase):
         check("source_host", "my.source.host", "source.foo.host")
 
         check = self._make_checker(console1)
+        check("char_type", "pty")
+        check("target_type", None)
+
+        check = self._make_checker(console2)
         check("char_type", "file")
         check("source_path", "/tmp/foo.img", None)
         check("source_path", None, "/root/foo")
         check("target_type", "virtio")
 
-        check = self._make_checker(console2)
-        check("char_type", "pty")
-        check("target_type", None)
-
         check = self._make_checker(channel1)
         check("char_type", "pty")
         check("target_type", "virtio")
-- 
1.7.6.4




More information about the virt-tools-list mailing list