qemuhotplugtest: Verify domain XML on UPDATE

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@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
This commit is contained in:
Michal Privoznik 2023-04-21 09:56:20 +02:00
parent 11793a5311
commit 0eebdce995
9 changed files with 295 additions and 26 deletions

View File

@ -123,7 +123,7 @@ testQemuHotplugCheckResult(virDomainObj *vm,
if (!actual) if (!actual)
return -1; return -1;
if (STREQ(expected, actual)) { if (STREQ_NULLABLE(expected, actual)) {
if (fail) if (fail)
VIR_TEST_VERBOSE("domain XML should not match the expected result"); VIR_TEST_VERBOSE("domain XML should not match the expected result");
ret = 0; ret = 0;
@ -170,7 +170,9 @@ testQemuHotplug(const void *data)
virTestLoadFile(device_filename, &device_xml) < 0) virTestLoadFile(device_filename, &device_xml) < 0)
goto cleanup; goto cleanup;
if (test->action == ATTACH && if (!fail &&
(test->action == ATTACH ||
test->action == UPDATE) &&
virTestLoadFile(result_filename, &result_xml) < 0) virTestLoadFile(result_filename, &result_xml) < 0)
goto cleanup; goto cleanup;
@ -243,6 +245,9 @@ testQemuHotplug(const void *data)
case UPDATE: case UPDATE:
ret = qemuDomainUpdateDeviceLive(vm, dev, &driver, false); ret = qemuDomainUpdateDeviceLive(vm, dev, &driver, false);
if (ret == 0 || fail)
ret = testQemuHotplugCheckResult(vm, result_xml,
result_filename, fail);
} }
virObjectLock(priv->mon); virObjectLock(priv->mon);

View File

@ -0,0 +1 @@
qemuhotplug-disk-cdrom.xml

View File

@ -1,4 +1,4 @@
<domain type='qemu'> <domain type='qemu' id='7'>
<name>QEMUGuest1</name> <name>QEMUGuest1</name>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>219100</memory> <memory unit='KiB'>219100</memory>
@ -8,6 +8,9 @@
<type arch='x86_64' machine='pc'>hvm</type> <type arch='x86_64' machine='pc'>hvm</type>
<boot dev='hd'/> <boot dev='hd'/>
</os> </os>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
</cpu>
<clock offset='utc'/> <clock offset='utc'/>
<on_poweroff>destroy</on_poweroff> <on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot> <on_reboot>restart</on_reboot>
@ -18,6 +21,7 @@
<driver name='qemu' type='raw'/> <driver name='qemu' type='raw'/>
<source dev='/dev/HostVG/QEMUGuest1'/> <source dev='/dev/HostVG/QEMUGuest1'/>
<target dev='hda' bus='ide'/> <target dev='hda' bus='ide'/>
<alias name='ide0-0-0'/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk> </disk>
<disk type='file' device='cdrom'> <disk type='file' device='cdrom'>
@ -25,13 +29,27 @@
<source file='/root/boot.iso'/> <source file='/root/boot.iso'/>
<target dev='hdc' bus='ide'/> <target dev='hdc' bus='ide'/>
<readonly/> <readonly/>
<alias name='ide0-1-0'/>
<address type='drive' controller='0' bus='1' target='0' unit='0'/> <address type='drive' controller='0' bus='1' target='0' unit='0'/>
</disk> </disk>
<controller type='usb' index='0'/> <controller type='usb' index='0' model='piix3-uhci'>
<controller type='ide' index='0'/> <alias name='usb'/>
<controller type='pci' index='0' model='pci-root'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
<input type='mouse' bus='ps2'/> </controller>
<input type='keyboard' bus='ps2'/> <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'/> <memballoon model='none'/>
</devices> </devices>
</domain> </domain>

View File

@ -0,0 +1 @@
qemuhotplug-graphics-spice.xml

View File

@ -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>

View File

@ -0,0 +1 @@
qemuhotplug-graphics-spice-timeout.xml

View File

@ -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>

View File

@ -1,4 +1,4 @@
<domain type='kvm'> <domain type='kvm' id='7'>
<name>f14</name> <name>f14</name>
<uuid>553effab-b5e1-2d80-dfe3-da4344826c43</uuid> <uuid>553effab-b5e1-2d80-dfe3-da4344826c43</uuid>
<memory unit='KiB'>1048576</memory> <memory unit='KiB'>1048576</memory>
@ -15,10 +15,10 @@
<apic/> <apic/>
<pae/> <pae/>
</features> </features>
<cpu match='exact'> <cpu mode='custom' match='exact' check='partial'>
<model>core2duo</model> <model fallback='allow'>core2duo</model>
<vendor>Intel</vendor> <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='lahf_lm'/>
<feature policy='require' name='xtpr'/> <feature policy='require' name='xtpr'/>
<feature policy='require' name='cx16'/> <feature policy='require' name='cx16'/>
@ -43,6 +43,7 @@
<driver name='qemu' type='qcow2'/> <driver name='qemu' type='qcow2'/>
<source file='/var/lib/libvirt/images/f14.img'/> <source file='/var/lib/libvirt/images/f14.img'/>
<target dev='vda' bus='virtio'/> <target dev='vda' bus='virtio'/>
<alias name='virtio-disk0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</disk> </disk>
<disk type='file' device='cdrom'> <disk type='file' device='cdrom'>
@ -50,37 +51,66 @@
<source file='/var/lib/libvirt/Fedora-14-x86_64-Live-KDE.iso'/> <source file='/var/lib/libvirt/Fedora-14-x86_64-Live-KDE.iso'/>
<target dev='hdc' bus='ide'/> <target dev='hdc' bus='ide'/>
<readonly/> <readonly/>
<alias name='ide0-1-0'/>
<address type='drive' controller='0' bus='1' target='0' unit='0'/> <address type='drive' controller='0' bus='1' target='0' unit='0'/>
</disk> </disk>
<controller type='ide' index='0'> <controller type='ide' index='0'>
<alias name='ide'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
</controller> </controller>
<controller type='virtio-serial' index='0'> <controller type='virtio-serial' index='0'>
<alias name='virtio-serial0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</controller> </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'> <interface type='ethernet'>
<mac address='52:54:00:71:70:89'/> <mac address='52:54:00:71:70:89'/>
<script path='/etc/qemu-ifup'/> <script path='/etc/qemu-ifup'/>
<model type='rtl8139'/>
<alias name='net0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
</interface> </interface>
<serial type='pty'> <serial type='pty'>
<target port='0'/> <target type='isa-serial' port='0'>
<model name='isa-serial'/>
</target>
<alias name='serial0'/>
</serial> </serial>
<console type='pty'> <console type='pty'>
<target type='serial' port='0'/> <target type='serial' port='0'/>
<alias name='serial0'/>
</console> </console>
<input type='tablet' bus='usb'/> <input type='tablet' bus='usb'>
<input type='mouse' bus='ps2'/> <alias name='input0'/>
<input type='keyboard' bus='ps2'/> <address type='usb' bus='0' port='1'/>
<graphics type='spice' port='5900' autoport='no' passwd='sercet' passwdValidTo='2011-05-31T16:11:22' connected='disconnect'/> </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'> <sound model='ac97'>
<alias name='sound0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</sound> </sound>
<audio id='1' type='spice'/>
<video> <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'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video> </video>
<memballoon model='virtio'> <memballoon model='virtio'>
<alias name='balloon0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</memballoon> </memballoon>
</devices> </devices>

View File

@ -1,4 +1,4 @@
<domain type='qemu'> <domain type='qemu' id='7'>
<name>QEMUGuest1</name> <name>QEMUGuest1</name>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>219136</memory> <memory unit='KiB'>219136</memory>
@ -8,6 +8,9 @@
<type arch='x86_64' machine='pc'>hvm</type> <type arch='x86_64' machine='pc'>hvm</type>
<boot dev='hd'/> <boot dev='hd'/>
</os> </os>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
</cpu>
<clock offset='utc'/> <clock offset='utc'/>
<on_poweroff>destroy</on_poweroff> <on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot> <on_reboot>restart</on_reboot>
@ -15,15 +18,29 @@
<devices> <devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator> <emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type='block' device='disk'> <disk type='block' device='disk'>
<driver name='qemu' type='raw'/>
<source dev='/dev/HostVG/QEMUGuest1'/> <source dev='/dev/HostVG/QEMUGuest1'/>
<target dev='hda' bus='ide'/> <target dev='hda' bus='ide'/>
<alias name='ide0-0-0'/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk> </disk>
<controller type='usb' index='0'/> <controller type='usb' index='0' model='piix3-uhci'>
<controller type='ide' index='0'/> <alias name='usb'/>
<controller type='pci' index='0' model='pci-root'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
<input type='mouse' bus='ps2'/> </controller>
<input type='keyboard' bus='ps2'/> <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'> <graphics type='spice' port='5903' tlsPort='5904' autoport='no' listen='127.0.0.1' defaultMode='secure'>
<listen type='address' address='127.0.0.1'/> <listen type='address' address='127.0.0.1'/>
<channel name='main' mode='secure'/> <channel name='main' mode='secure'/>
@ -36,12 +53,20 @@
<clipboard copypaste='no'/> <clipboard copypaste='no'/>
<filetransfer enable='no'/> <filetransfer enable='no'/>
</graphics> </graphics>
<audio id='1' type='spice'/>
<video> <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>
<video> <video>
<model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/> <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> </video>
<memballoon model='virtio'/> <memballoon model='virtio'>
<alias name='balloon0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</memballoon>
</devices> </devices>
</domain> </domain>