libvirt/tests/define-dev-segfault
Daniel P. Berrange b2f1863533 Explicitly represent balloon device in XML and handle PCI address
To allow compatibility with older QEMU PCI device slot assignment
it is necessary to explicitly track the balloon device in the
XML. This introduces a new device

   <memballoon model='virtio|xen'/>

It can also have a PCI address, auto-assigned if necessary.

The memballoon will be automatically added to all Xen and QEMU
guests by default.

* docs/schemas/domain.rng: Add <memballoon> element
* src/conf/domain_conf.c, src/conf/domain_conf.h: parsing
  and formatting for memballoon device. Always add a memory
  balloon device to Xen/QEMU if none exists in XML
* src/libvirt_private.syms: Export memballoon model APIs
* src/qemu/qemu_conf.c, src/qemu/qemu_conf.h: Honour the
  PCI device address in memory balloon device
* tests/*: Update to test new functionality
2010-07-21 11:33:11 +01:00

80 lines
1.7 KiB
Bash
Executable File

#!/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.
test -z "$srcdir" && srcdir=$(pwd)
test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/..
test -z "$abs_top_builddir" && abs_top_builddir=$(pwd)/..
if test "$VERBOSE" = yes; then
set -x
$abs_top_builddir/tools/virsh --version
fi
. "$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'/>
<memballoon model='virtio'/>
</devices>
</domain>
EOF
url=test:///default
$abs_top_builddir/tools/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