[libvirt] [PATCH] Fix vm define error with back compat console device

Daniel P. Berrange berrange at redhat.com
Fri Jan 16 10:04:56 UTC 2009


On Fri, Jan 16, 2009 at 09:24:33AM +0100, Jim Meyering wrote:
> "Daniel P. Berrange" <berrange at redhat.com> wrote:
> > On Thu, Jan 15, 2009 at 10:17:56PM +0100, Jim Meyering wrote:
> >> "Daniel P. Berrange" <berrange at redhat.com> wrote:
> >> ...
> >> >>   + virsh --connect qemu:///session define devs.xml
> >> >
> >> > Shouldn't use qemu:///session for test cases like this - this is what
> >> > the test:///default driver is for, avoiding the fragility & danger of
> >> > using the daemon & live hypervisor drivers.
> >>
> >> There's no failure with test:///default.
> >
> > I'm rather surprised at that - both drivers use identical XML formating
> > routines here, so given the same config, both should fail just as badly.
> > Is this perhaps a case where we need to run it under valgrind to make
> > it reliably fail.
> 
> Note that virsh itself doesn't fail, in either case.
> It sends info to libvirtd that causes *it* to segfault,
> so in order to trigger the bug, I have to run libvirtd.

virsh SEGV's nicely enough for me

$ ./src/virsh --connect test:///default
Welcome to lt-virsh, the virtualization interactive terminal.

Type:  'help' for help with commands
       'quit' to quit

virsh # define a.xml
Domain D defined from a.xml

virsh # dumpxml D
Segmentation fault


In fact running virsh at all is redundant - this fails nicely enough if
it is just added as a new datafile to the qemuxml2xmltest test case.

Index: tests/qemuxml2xmltest.c
===================================================================
RCS file: /data/cvs/libvirt/tests/qemuxml2xmltest.c,v
retrieving revision 1.25
diff -u -p -u -p -r1.25 qemuxml2xmltest.c
--- tests/qemuxml2xmltest.c	12 Jan 2009 15:09:19 -0000	1.25
+++ tests/qemuxml2xmltest.c	16 Jan 2009 10:04:07 -0000
@@ -120,6 +120,7 @@ mymain(int argc, char **argv)
     DO_TEST("serial-many");
     DO_TEST("parallel-tcp");
     DO_TEST("console-compat");
+    DO_TEST("console-overflow");
 
     DO_TEST("hostdev-usb-product");
     DO_TEST("hostdev-usb-address");
Index: tests/qemuxml2argvdata/qemuxml2argv-console-overflow.xml
===================================================================
RCS file: tests/qemuxml2argvdata/qemuxml2argv-console-overflow.xml
diff -N tests/qemuxml2argvdata/qemuxml2argv-console-overflow.xml
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/qemuxml2argvdata/qemuxml2argv-console-overflow.xml	16 Jan 2009 10:04:07 -0000
@@ -0,0 +1,61 @@
+<?xml version="1.0"?>
+<domain type="kvm">
+  <name>D</name>
+  <uuid>aaa3ae22-fed2-bfbd-ac02-3bea3bcfad82</uuid>
+  <memory>262144</memory>
+  <currentMemory>262144</currentMemory>
+  <vcpu>1</vcpu>
+  <os>
+    <type arch="i686" machine="pc">hvm</type>
+    <boot dev="cdrom"/>
+  </os>
+  <features>
+    <acpi/>
+  </features>
+  <clock offset="utc"/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-kvm</emulator>
+    <disk type="file" device="cdrom">
+      <target dev="hdc" bus="ide"/>
+      <readonly/>
+    </disk>
+    <disk type="file" device="floppy">
+      <target dev="fdb" bus="fdc"/>
+    </disk>
+    <disk type="file" device="cdrom">
+      <target dev="sda" bus="scsi"/>
+      <readonly/>
+    </disk>
+    <interface type="network">
+      <mac address="54:52:00:6c:a0:ca"/>
+      <source network="aaaaaa"/>
+    </interface>
+    <interface type="network">
+      <mac address="54:52:00:6c:bb:ca"/>
+      <source network="default"/>
+    </interface>
+    <serial type="pty"/>
+    <serial type="pty"/>
+    <serial type="pty"/>
+    <parallel type="pty"/>
+    <parallel type="pty"/>
+    <parallel type="pty"/>
+    <input type="mouse" bus="ps2"/>
+    <sound model="pcspk"/>
+    <sound model="es1370"/>
+    <hostdev mode="subsystem" type="usb">
+      <source>
+        <address bus="3" device="3"/>
+      </source>
+    </hostdev>
+    <hostdev mode="subsystem" type="usb">
+      <source>
+        <vendor id="0x0483"/>
+        <product id="0x2016"/>
+      </source>
+    </hostdev>
+  </devices>
+</domain>



Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list