[PATCH 1/4] qemu: cold-plug of watchdog

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux