https://bugzilla.redhat.com/show_bug.cgi?id=1447169
With this patch users can cold plug a watchdog. Things are pretty
simple because a domain can have at most one watchdog device.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/qemu/qemu_driver.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index b7824512c..583908972 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7842,6 +7842,7 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef,
virDomainFSDefPtr fs;
virDomainRedirdevDefPtr redirdev;
virDomainShmemDefPtr shmem;
+ virDomainWatchdogDefPtr watchdog;
switch ((virDomainDeviceType) dev->type) {
case VIR_DOMAIN_DEVICE_DISK:
@@ -7978,10 +7979,20 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef,
dev->data.shmem = NULL;
break;
+ case VIR_DOMAIN_DEVICE_WATCHDOG:
+ watchdog = dev->data.watchdog;
+ if (vmdef->watchdog) {
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("domain already has a watchdog"));
+ return -1;
+ }
+ vmdef->watchdog = watchdog;
+ dev->data.watchdog = NULL;
+ break;
+
case VIR_DOMAIN_DEVICE_INPUT:
case VIR_DOMAIN_DEVICE_SOUND:
case VIR_DOMAIN_DEVICE_VIDEO:
- case VIR_DOMAIN_DEVICE_WATCHDOG:
case VIR_DOMAIN_DEVICE_GRAPHICS:
case VIR_DOMAIN_DEVICE_HUB:
case VIR_DOMAIN_DEVICE_SMARTCARD:
--
2.13.5