---
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 9b8d11b..ef2f9b0 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -437,6 +437,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,
@@ -475,6 +476,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;
}
@@ -503,6 +510,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