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

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

 



Daniel Veillard <veillard@xxxxxxxxxx> wrote:
> On Fri, Jan 16, 2009 at 12:09:33AM +0000, Daniel P. Berrange wrote:
>> On Thu, Jan 15, 2009 at 10:17:56PM +0100, Jim Meyering wrote:
>> > "Daniel P. Berrange" <berrange@xxxxxxxxxx> 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.
>
>   Maybe that can be debugged separately, I would like to see the
> patch fixed, maybe we can isolate the problem in the test driver (if
> any) but it should not block the initial patch from being commited,

Cole, can you commit your fix?

As soon as that's in, I'll commit the following simple test
to exercise it:

It's similar to a previous patch, but with the following changes
  - uses test:///default driver rather than the qemu: one,
      per Daniel Berrange's suggestion
  - adjusts its input XML so that it's identical to dumpxml output

I'm sure Dan and I will be talking about bigger, long-term testing
framework changes in the next week or so.

Jim

>From bc7d653b1c7039da3edb63528a83bdc9609c7b6f Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@xxxxxxxxxx>
Date: Thu, 15 Jan 2009 19:51:39 +0100
Subject: [PATCH] exercise a bug that could make libvirtd segfault

* tests/define-dev-segfault: New file.
* tests/Makefile.am (test_scripts): Add define-dev-segfault.
---
 tests/Makefile.am         |    1 +
 tests/define-dev-segfault |   76 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 77 insertions(+), 0 deletions(-)
 create mode 100755 tests/define-dev-segfault

diff --git a/tests/Makefile.am b/tests/Makefile.am
index c735d62..39b5727 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -60,6 +60,7 @@ if WITH_LIBVIRTD
 test_scripts +=			\
 	cpuset			\
 	daemon-conf		\
+	define-dev-segfault	\
 	int-overflow		\
 	libvirtd-fail		\
 	libvirtd-pool		\
diff --git a/tests/define-dev-segfault b/tests/define-dev-segfault
new file mode 100755
index 0000000..4ae286f
--- /dev/null
+++ b/tests/define-dev-segfault
@@ -0,0 +1,76 @@
+#!/bin/sh
+# Exercise a bug whereby defining a valid domain could kill libvirtd.
+# The bug can also be exercised with a simple define/dumpxml pair to virsh.
+
+if test "$VERBOSE" = yes; then
+  set -x
+  virsh --version
+fi
+
+test -z "$srcdir" && srcdir=$(pwd)
+test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/..
+. "$srcdir/test-lib.sh"
+
+fail=0
+
+# Domain definition from Cole Robinson.
+cat <<\EOF > D.xml || fail=1
+<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>
+    <serial type='pty'>
+      <target port='0'/>
+    </serial>
+    <serial type='pty'>
+      <target port='1'/>
+    </serial>
+    <serial type='pty'>
+      <target port='2'/>
+    </serial>
+    <parallel type='pty'>
+      <target port='0'/>
+    </parallel>
+    <parallel type='pty'>
+      <target port='1'/>
+    </parallel>
+    <parallel type='pty'>
+      <target port='2'/>
+    </parallel>
+    <console type='pty'>
+      <target port='0'/>
+    </console>
+    <sound model='pcspk'/>
+    <sound model='es1370'/>
+  </devices>
+</domain>
+EOF
+
+url=test:///default
+virsh --connect "$url" 'define D.xml; dumpxml D' > out 2>&1 || fail=1
+
+cat > exp <<EOF || fail=1
+Domain D defined from D.xml
+
+$(cat D.xml)
+
+EOF
+
+compare exp out || fail=1
+
+exit $fail
--
1.6.1.258.g7ff14

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]