Just like we check the resulting domain XML after ATTACH and DETACH, we should do the same after UPDATE action. This is as simple as calling testQemuHotplugCheckResult() and providing missing XMLs. For those test cases where no change is done, we can just make the expected XML a symlink to the input XML. Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> --- tests/qemuhotplugtest.c | 9 +- ...hotplug-disk-cdrom+disk-cdrom-nochange.xml | 1 + .../qemuhotplug-disk-cdrom.xml | 30 ++++- ...graphics-spice+graphics-spice-nochange.xml | 1 + ...graphics-spice-listen-network-password.xml | 71 +++++++++++ ...imeout+graphics-spice-timeout-nochange.xml | 1 + ...imeout+graphics-spice-timeout-password.xml | 117 ++++++++++++++++++ .../qemuhotplug-graphics-spice-timeout.xml | 50 ++++++-- .../qemuhotplug-graphics-spice.xml | 41 ++++-- 9 files changed, 295 insertions(+), 26 deletions(-) create mode 120000 tests/qemuhotplugtestdomains/qemuhotplug-disk-cdrom+disk-cdrom-nochange.xml create mode 120000 tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice+graphics-spice-nochange.xml create mode 100644 tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-listen-network+graphics-spice-listen-network-password.xml create mode 120000 tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-timeout+graphics-spice-timeout-nochange.xml create mode 100644 tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-timeout+graphics-spice-timeout-password.xml diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index fffb4a3410..091fcc4d49 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -123,7 +123,7 @@ testQemuHotplugCheckResult(virDomainObj *vm, if (!actual) return -1; - if (STREQ(expected, actual)) { + if (STREQ_NULLABLE(expected, actual)) { if (fail) VIR_TEST_VERBOSE("domain XML should not match the expected result"); ret = 0; @@ -170,7 +170,9 @@ testQemuHotplug(const void *data) virTestLoadFile(device_filename, &device_xml) < 0) goto cleanup; - if (test->action == ATTACH && + if (!fail && + (test->action == ATTACH || + test->action == UPDATE) && virTestLoadFile(result_filename, &result_xml) < 0) goto cleanup; @@ -243,6 +245,9 @@ testQemuHotplug(const void *data) case UPDATE: ret = qemuDomainUpdateDeviceLive(vm, dev, &driver, false); + if (ret == 0 || fail) + ret = testQemuHotplugCheckResult(vm, result_xml, + result_filename, fail); } virObjectLock(priv->mon); diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-disk-cdrom+disk-cdrom-nochange.xml b/tests/qemuhotplugtestdomains/qemuhotplug-disk-cdrom+disk-cdrom-nochange.xml new file mode 120000 index 0000000000..e07b01b301 --- /dev/null +++ b/tests/qemuhotplugtestdomains/qemuhotplug-disk-cdrom+disk-cdrom-nochange.xml @@ -0,0 +1 @@ +qemuhotplug-disk-cdrom.xml \ No newline at end of file diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-disk-cdrom.xml b/tests/qemuhotplugtestdomains/qemuhotplug-disk-cdrom.xml index 3acf55ab17..bcf4cf9bf8 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-disk-cdrom.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-disk-cdrom.xml @@ -1,4 +1,4 @@ -<domain type='qemu'> +<domain type='qemu' id='7'> <name>QEMUGuest1</name> <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> <memory unit='KiB'>219100</memory> @@ -8,6 +8,9 @@ <type arch='x86_64' machine='pc'>hvm</type> <boot dev='hd'/> </os> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>qemu64</model> + </cpu> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> @@ -18,6 +21,7 @@ <driver name='qemu' type='raw'/> <source dev='/dev/HostVG/QEMUGuest1'/> <target dev='hda' bus='ide'/> + <alias name='ide0-0-0'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> <disk type='file' device='cdrom'> @@ -25,13 +29,27 @@ <source file='/root/boot.iso'/> <target dev='hdc' bus='ide'/> <readonly/> + <alias name='ide0-1-0'/> <address type='drive' controller='0' bus='1' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> - <controller type='ide' index='0'/> - <controller type='pci' index='0' model='pci-root'/> - <input type='mouse' bus='ps2'/> - <input type='keyboard' bus='ps2'/> + <controller type='usb' index='0' model='piix3-uhci'> + <alias name='usb'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> + <controller type='ide' index='0'> + <alias name='ide'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> + <controller type='pci' index='0' model='pci-root'> + <alias name='pci.0'/> + </controller> + <input type='mouse' bus='ps2'> + <alias name='input0'/> + </input> + <input type='keyboard' bus='ps2'> + <alias name='input1'/> + </input> + <audio id='1' type='none'/> <memballoon model='none'/> </devices> </domain> diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice+graphics-spice-nochange.xml b/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice+graphics-spice-nochange.xml new file mode 120000 index 0000000000..4f731cb8db --- /dev/null +++ b/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice+graphics-spice-nochange.xml @@ -0,0 +1 @@ +qemuhotplug-graphics-spice.xml \ No newline at end of file diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-listen-network+graphics-spice-listen-network-password.xml b/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-listen-network+graphics-spice-listen-network-password.xml new file mode 100644 index 0000000000..9cc273435a --- /dev/null +++ b/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-listen-network+graphics-spice-listen-network-password.xml @@ -0,0 +1,71 @@ +<domain type='qemu' id='7'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>qemu64</model> + </cpu> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <disk type='block' device='disk'> + <driver name='qemu' type='raw'/> + <source dev='/dev/HostVG/QEMUGuest1'/> + <target dev='hda' bus='ide'/> + <alias name='ide0-0-0'/> + <address type='drive' controller='0' bus='0' target='0' unit='0'/> + </disk> + <controller type='usb' index='0' model='piix3-uhci'> + <alias name='usb'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> + <controller type='ide' index='0'> + <alias name='ide'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> + <controller type='pci' index='0' model='pci-root'> + <alias name='pci.0'/> + </controller> + <input type='mouse' bus='ps2'> + <alias name='input0'/> + </input> + <input type='keyboard' bus='ps2'> + <alias name='input1'/> + </input> + <graphics type='spice' port='5900' tlsPort='5901' autoport='yes' listen='10.65.210.231' keymap='en-us' passwd='password2' passwdValidTo='2013-06-20T01:34:37' connected='disconnect'> + <listen type='network' address='10.65.210.231' network='vdsm-rhevm'/> + <channel name='main' mode='secure'/> + <channel name='display' mode='secure'/> + <channel name='inputs' mode='secure'/> + <channel name='cursor' mode='secure'/> + <channel name='playback' mode='secure'/> + <channel name='record' mode='secure'/> + <channel name='smartcard' mode='secure'/> + <channel name='usbredir' mode='secure'/> + </graphics> + <audio id='1' type='spice'/> + <video> + <model type='qxl' ram='65536' vram='32768' vgamem='16384' heads='1' primary='yes'/> + <alias name='video0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </video> + <video> + <model type='qxl' ram='65536' vram='32768' vgamem='16384' heads='1'/> + <alias name='video1'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </video> + <memballoon model='virtio'> + <alias name='balloon0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-timeout+graphics-spice-timeout-nochange.xml b/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-timeout+graphics-spice-timeout-nochange.xml new file mode 120000 index 0000000000..3a5bce52e4 --- /dev/null +++ b/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-timeout+graphics-spice-timeout-nochange.xml @@ -0,0 +1 @@ +qemuhotplug-graphics-spice-timeout.xml \ No newline at end of file diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-timeout+graphics-spice-timeout-password.xml b/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-timeout+graphics-spice-timeout-password.xml new file mode 100644 index 0000000000..03964ad01c --- /dev/null +++ b/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-timeout+graphics-spice-timeout-password.xml @@ -0,0 +1,117 @@ +<domain type='kvm' id='7'> + <name>f14</name> + <uuid>553effab-b5e1-2d80-dfe3-da4344826c43</uuid> + <memory unit='KiB'>1048576</memory> + <currentMemory unit='KiB'>1048576</currentMemory> + <vcpu placement='static'>2</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='cdrom'/> + <boot dev='hd'/> + <bootmenu enable='yes'/> + </os> + <features> + <acpi/> + <apic/> + <pae/> + </features> + <cpu mode='custom' match='exact' check='partial'> + <model fallback='allow'>core2duo</model> + <vendor>Intel</vendor> + <topology sockets='1' dies='1' cores='2' threads='1'/> + <feature policy='require' name='lahf_lm'/> + <feature policy='require' name='xtpr'/> + <feature policy='require' name='cx16'/> + <feature policy='require' name='tm2'/> + <feature policy='require' name='est'/> + <feature policy='require' name='vmx'/> + <feature policy='require' name='ds_cpl'/> + <feature policy='require' name='pbe'/> + <feature policy='require' name='tm'/> + <feature policy='require' name='ht'/> + <feature policy='require' name='ss'/> + <feature policy='require' name='acpi'/> + <feature policy='require' name='ds'/> + </cpu> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>restart</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <disk type='file' device='disk'> + <driver name='qemu' type='qcow2'/> + <source file='/var/lib/libvirt/images/f14.img'/> + <target dev='vda' bus='virtio'/> + <alias name='virtio-disk0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </disk> + <disk type='file' device='cdrom'> + <driver name='qemu' type='raw'/> + <source file='/var/lib/libvirt/Fedora-14-x86_64-Live-KDE.iso'/> + <target dev='hdc' bus='ide'/> + <readonly/> + <alias name='ide0-1-0'/> + <address type='drive' controller='0' bus='1' target='0' unit='0'/> + </disk> + <controller type='ide' index='0'> + <alias name='ide'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> + <controller type='virtio-serial' index='0'> + <alias name='virtio-serial0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> + </controller> + <controller type='usb' index='0' model='piix3-uhci'> + <alias name='usb'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> + <controller type='pci' index='0' model='pci-root'> + <alias name='pci.0'/> + </controller> + <interface type='ethernet'> + <mac address='52:54:00:71:70:89'/> + <script path='/etc/qemu-ifup'/> + <model type='rtl8139'/> + <alias name='net0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/> + </interface> + <serial type='pty'> + <target type='isa-serial' port='0'> + <model name='isa-serial'/> + </target> + <alias name='serial0'/> + </serial> + <console type='pty'> + <target type='serial' port='0'/> + <alias name='serial0'/> + </console> + <input type='tablet' bus='usb'> + <alias name='input0'/> + <address type='usb' bus='0' port='1'/> + </input> + <input type='mouse' bus='ps2'> + <alias name='input1'/> + </input> + <input type='keyboard' bus='ps2'> + <alias name='input2'/> + </input> + <graphics type='spice' port='5900' autoport='no' passwd='secret' passwdValidTo='2013-05-31T16:11:22' connected='disconnect'> + <listen type='address'/> + </graphics> + <sound model='ac97'> + <alias name='sound0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </sound> + <audio id='1' type='spice'/> + <video> + <model type='vga' vram='16384' heads='1' primary='yes'/> + <alias name='video0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </video> + <memballoon model='virtio'> + <alias name='balloon0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-timeout.xml b/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-timeout.xml index 0e96033fc8..e6b0cc833a 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-timeout.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice-timeout.xml @@ -1,4 +1,4 @@ -<domain type='kvm'> +<domain type='kvm' id='7'> <name>f14</name> <uuid>553effab-b5e1-2d80-dfe3-da4344826c43</uuid> <memory unit='KiB'>1048576</memory> @@ -15,10 +15,10 @@ <apic/> <pae/> </features> - <cpu match='exact'> - <model>core2duo</model> + <cpu mode='custom' match='exact' check='partial'> + <model fallback='allow'>core2duo</model> <vendor>Intel</vendor> - <topology sockets='1' cores='2' threads='1'/> + <topology sockets='1' dies='1' cores='2' threads='1'/> <feature policy='require' name='lahf_lm'/> <feature policy='require' name='xtpr'/> <feature policy='require' name='cx16'/> @@ -43,6 +43,7 @@ <driver name='qemu' type='qcow2'/> <source file='/var/lib/libvirt/images/f14.img'/> <target dev='vda' bus='virtio'/> + <alias name='virtio-disk0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </disk> <disk type='file' device='cdrom'> @@ -50,37 +51,66 @@ <source file='/var/lib/libvirt/Fedora-14-x86_64-Live-KDE.iso'/> <target dev='hdc' bus='ide'/> <readonly/> + <alias name='ide0-1-0'/> <address type='drive' controller='0' bus='1' target='0' unit='0'/> </disk> <controller type='ide' index='0'> + <alias name='ide'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> </controller> <controller type='virtio-serial' index='0'> + <alias name='virtio-serial0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> </controller> + <controller type='usb' index='0' model='piix3-uhci'> + <alias name='usb'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> + <controller type='pci' index='0' model='pci-root'> + <alias name='pci.0'/> + </controller> <interface type='ethernet'> <mac address='52:54:00:71:70:89'/> <script path='/etc/qemu-ifup'/> + <model type='rtl8139'/> + <alias name='net0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/> </interface> <serial type='pty'> - <target port='0'/> + <target type='isa-serial' port='0'> + <model name='isa-serial'/> + </target> + <alias name='serial0'/> </serial> <console type='pty'> <target type='serial' port='0'/> + <alias name='serial0'/> </console> - <input type='tablet' bus='usb'/> - <input type='mouse' bus='ps2'/> - <input type='keyboard' bus='ps2'/> - <graphics type='spice' port='5900' autoport='no' passwd='sercet' passwdValidTo='2011-05-31T16:11:22' connected='disconnect'/> + <input type='tablet' bus='usb'> + <alias name='input0'/> + <address type='usb' bus='0' port='1'/> + </input> + <input type='mouse' bus='ps2'> + <alias name='input1'/> + </input> + <input type='keyboard' bus='ps2'> + <alias name='input2'/> + </input> + <graphics type='spice' port='5900' autoport='no' passwd='sercet' passwdValidTo='2011-05-31T16:11:22' connected='disconnect'> + <listen type='address'/> + </graphics> <sound model='ac97'> + <alias name='sound0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </sound> + <audio id='1' type='spice'/> <video> - <model type='vga' vram='16384' heads='1'/> + <model type='vga' vram='16384' heads='1' primary='yes'/> + <alias name='video0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> + <alias name='balloon0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> </memballoon> </devices> diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice.xml b/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice.xml index ec761d6619..c4924eae09 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-graphics-spice.xml @@ -1,4 +1,4 @@ -<domain type='qemu'> +<domain type='qemu' id='7'> <name>QEMUGuest1</name> <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> <memory unit='KiB'>219136</memory> @@ -8,6 +8,9 @@ <type arch='x86_64' machine='pc'>hvm</type> <boot dev='hd'/> </os> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>qemu64</model> + </cpu> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> @@ -15,15 +18,29 @@ <devices> <emulator>/usr/bin/qemu-system-x86_64</emulator> <disk type='block' device='disk'> + <driver name='qemu' type='raw'/> <source dev='/dev/HostVG/QEMUGuest1'/> <target dev='hda' bus='ide'/> + <alias name='ide0-0-0'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> - <controller type='usb' index='0'/> - <controller type='ide' index='0'/> - <controller type='pci' index='0' model='pci-root'/> - <input type='mouse' bus='ps2'/> - <input type='keyboard' bus='ps2'/> + <controller type='usb' index='0' model='piix3-uhci'> + <alias name='usb'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> + <controller type='ide' index='0'> + <alias name='ide'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> + </controller> + <controller type='pci' index='0' model='pci-root'> + <alias name='pci.0'/> + </controller> + <input type='mouse' bus='ps2'> + <alias name='input0'/> + </input> + <input type='keyboard' bus='ps2'> + <alias name='input1'/> + </input> <graphics type='spice' port='5903' tlsPort='5904' autoport='no' listen='127.0.0.1' defaultMode='secure'> <listen type='address' address='127.0.0.1'/> <channel name='main' mode='secure'/> @@ -36,12 +53,20 @@ <clipboard copypaste='no'/> <filetransfer enable='no'/> </graphics> + <audio id='1' type='spice'/> <video> - <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/> + <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1' primary='yes'/> + <alias name='video0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <video> <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/> + <alias name='video1'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </video> - <memballoon model='virtio'/> + <memballoon model='virtio'> + <alias name='balloon0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </memballoon> </devices> </domain> -- 2.39.2