[RFC PATCH 06/11] qemu: implement dimm device hotplug on config level

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

 



The config level requires an insert or remove from domain
definition structure.

Signed-off-by: Zhu Guihua <zhugh.fnst@xxxxxxxxxxxxxx>
---
 src/qemu/qemu_driver.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index d017a84..a7a50e0 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7313,6 +7313,11 @@ qemuDomainAttachDeviceConfig(virQEMUCapsPtr qemuCaps,
         break;
 
     case VIR_DOMAIN_DEVICE_DIMM:
+        if (virDomainDimmInsert(vmdef, dev->data.dimm) < 0)
+            return -1;
+        dev->data.dimm = NULL;
+        break;
+
     case VIR_DOMAIN_DEVICE_INPUT:
     case VIR_DOMAIN_DEVICE_SOUND:
     case VIR_DOMAIN_DEVICE_VIDEO:
@@ -7349,6 +7354,7 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef,
     virDomainControllerDefPtr cont, det_cont;
     virDomainChrDefPtr chr;
     virDomainFSDefPtr fs;
+    virDomainDimmDefPtr dimm;
     int idx;
 
     switch ((virDomainDeviceType) dev->type) {
@@ -7430,6 +7436,14 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef,
         break;
 
     case VIR_DOMAIN_DEVICE_DIMM:
+        if (!(dimm = virDomainDimmRemove(vmdef, dev->data.dimm)))
+            return -1;
+
+        virDomainDimmDefFree(dimm);
+        virDomainDimmDefFree(dev->data.dimm);
+        dev->data.dimm = NULL;
+        break;
+
     case VIR_DOMAIN_DEVICE_INPUT:
     case VIR_DOMAIN_DEVICE_SOUND:
     case VIR_DOMAIN_DEVICE_VIDEO:
-- 
1.9.3

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