---
src/qemu/qemu_hotplug.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 7845fd1..b2f70d1 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -435,6 +435,7 @@ int qemuDomainAttachControllerDevice(virQEMUDriverPtr driver,
char *devstr = NULL;
qemuDomainObjPrivatePtr priv = vm->privateData;
bool releaseaddr = false;
+ bool addedToAddrSet = false;
if (virDomainControllerFind(vm->def, controller->type, controller->idx)
>= 0) {
virReportError(VIR_ERR_OPERATION_FAILED,
@@ -473,6 +474,12 @@ int qemuDomainAttachControllerDevice(virQEMUDriverPtr driver,
goto cleanup;
}
+ if (controller->type == VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL &&
+ virDomainVirtioSerialAddrSetAddController(priv->vioserialaddrs,
+ controller) < 0)
+ goto cleanup;
+ addedToAddrSet = true;
+
if (!(devstr = qemuBuildControllerDevStr(vm->def, controller,
priv->qemuCaps, NULL)))
goto cleanup;
}
@@ -501,6 +508,9 @@ int qemuDomainAttachControllerDevice(virQEMUDriverPtr driver,
}
cleanup:
+ if (ret != 0 && addedToAddrSet)
+ virDomainVirtioSerialAddrSetRemoveController(priv->vioserialaddrs,
+ controller);
if (ret != 0 && releaseaddr)
qemuDomainReleaseDeviceAddress(vm, &controller->info, NULL);
--
2.0.5