The config level requires an insert or remove from domain definition
structure.
Signed-off-by: Zhu Guihua <zhugh.fnst(a)cn.fujitsu.com>
---
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 ecdf5c6..a88f6b4 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7316,6 +7316,11 @@ qemuDomainAttachDeviceConfig(virQEMUCapsPtr qemuCaps,
break;
case VIR_DOMAIN_DEVICE_CPU:
+ if (virDomainCPUInsert(vmdef, dev->data.cpu) < 0)
+ return -1;
+ dev->data.cpu = NULL;
+ break;
+
case VIR_DOMAIN_DEVICE_INPUT:
case VIR_DOMAIN_DEVICE_SOUND:
case VIR_DOMAIN_DEVICE_VIDEO:
@@ -7352,6 +7357,7 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef,
virDomainControllerDefPtr cont, det_cont;
virDomainChrDefPtr chr;
virDomainFSDefPtr fs;
+ virDomainCPUDefPtr cpu;
int idx;
switch ((virDomainDeviceType) dev->type) {
@@ -7433,6 +7439,14 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef,
break;
case VIR_DOMAIN_DEVICE_CPU:
+ if (!(cpu = virDomainCPURemove(vmdef, dev->data.cpu)))
+ return -1;
+
+ virDomainCPUDefFree(cpu);
+ virDomainCPUDefFree(dev->data.cpu);
+ dev->data.cpu = NULL;
+ break;
+
case VIR_DOMAIN_DEVICE_INPUT:
case VIR_DOMAIN_DEVICE_SOUND:
case VIR_DOMAIN_DEVICE_VIDEO:
--
1.9.3