summaryrefslogtreecommitdiff
blob: 81a8773def87bbf9d1b3ab527c6f1c6d2c0f103b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/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='test'>
  <name>D</name>
  <uuid>aaa3ae22-fed2-bfbd-ac02-3bea3bcfad82</uuid>
  <memory unit='KiB'>262144</memory>
  <currentMemory unit='KiB'>262144</currentMemory>
  <vcpu placement='static'>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>
    <controller type='usb' index='0'/>
    <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 type='serial' 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