]> xenbits.xensource.com Git - libvirt.git/commit
qemu_hotplug.c: adding qemuDomainGetUnplugTimeout
authorDaniel Henrique Barboza <danielhb413@gmail.com>
Fri, 18 Oct 2019 18:36:32 +0000 (15:36 -0300)
committerCole Robinson <crobinso@redhat.com>
Wed, 13 Nov 2019 20:03:40 +0000 (15:03 -0500)
commite03e27ee087e7de75786b11ab42b9224fa0d4185
treea439d6a66fd9d04045eb58ecf7026890aee1d8a9
parent4670f062c2bf51ec935baf4b166639f39be95075
qemu_hotplug.c: adding qemuDomainGetUnplugTimeout

For some architectures and setups, device removal can take
longer than the default 5 seconds. This results in commands
such as 'virsh setvcpus' to fire timeout messages even if
the operation were successful in the guest, confusing the
user.

This patch sets a new 10 seconds unplug timeout for PPC64
guests. All other archs will keep the default 5 seconds
timeout.

Instead of putting 'if PPC64' conditionals inside qemu_hotplug.c
to set the new timeout value, a new function called
qemuDomainGetUnplugTimeout was added. The timeout value is then
retrieved when needed, by passing the correspondent DomainDef
object. This approach allows for different guest architectures
to have distint unplug timeout intervals, regardless of the
host architecture. This design also makes it easier to
modify/enhance the unplug timeout logic in the future
(allow for special timeouts for TCG domains, for example).

A new mock file was created to work with qemuhotplugtest.c,
given that the test timeout is significantly shorter than
the actual timeout value in qemu_hotplug.c.

The now unused 'qemuDomainRemoveDeviceWaitTime' global can't
be simply erased from qemu_hotplug.c though. Next patch will
remove it properly.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Suggested-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
src/qemu/qemu_hotplug.c
src/qemu/qemu_hotplug.h
tests/Makefile.am
tests/qemuhotplugmock.c [new file with mode: 0644]
tests/qemuhotplugtest.c