提交 de325472 编写于 作者: J Ján Tomko

qemu: assign USB addresses on redirdev hotplug too

https://bugzilla.redhat.com/show_bug.cgi?id=1375410
上级 6a586ee2
...@@ -1587,6 +1587,7 @@ int qemuDomainAttachRedirdevDevice(virConnectPtr conn, ...@@ -1587,6 +1587,7 @@ int qemuDomainAttachRedirdevDevice(virConnectPtr conn,
virJSONValuePtr secProps = NULL; virJSONValuePtr secProps = NULL;
char *tlsAlias = NULL; char *tlsAlias = NULL;
char *secAlias = NULL; char *secAlias = NULL;
bool need_release = false;
virErrorPtr orig_err; virErrorPtr orig_err;
qemuDomainPrepareChardevSourceTLS(redirdev->source, cfg); qemuDomainPrepareChardevSourceTLS(redirdev->source, cfg);
...@@ -1597,6 +1598,11 @@ int qemuDomainAttachRedirdevDevice(virConnectPtr conn, ...@@ -1597,6 +1598,11 @@ int qemuDomainAttachRedirdevDevice(virConnectPtr conn,
if (!(charAlias = qemuAliasChardevFromDevAlias(redirdev->info.alias))) if (!(charAlias = qemuAliasChardevFromDevAlias(redirdev->info.alias)))
goto cleanup; goto cleanup;
if ((rc = virDomainUSBAddressEnsure(priv->usbaddrs, &redirdev->info)) < 0)
goto cleanup;
if (rc == 1)
need_release = true;
if (!(devstr = qemuBuildRedirdevDevStr(def, redirdev, priv->qemuCaps))) if (!(devstr = qemuBuildRedirdevDevStr(def, redirdev, priv->qemuCaps)))
goto cleanup; goto cleanup;
...@@ -1649,6 +1655,8 @@ int qemuDomainAttachRedirdevDevice(virConnectPtr conn, ...@@ -1649,6 +1655,8 @@ int qemuDomainAttachRedirdevDevice(virConnectPtr conn,
audit: audit:
virDomainAuditRedirdev(vm, redirdev, "attach", ret == 0); virDomainAuditRedirdev(vm, redirdev, "attach", ret == 0);
cleanup: cleanup:
if (ret < 0 && need_release)
qemuDomainReleaseDeviceAddress(vm, &redirdev->info, NULL);
VIR_FREE(tlsAlias); VIR_FREE(tlsAlias);
virJSONValueFree(tlsProps); virJSONValueFree(tlsProps);
VIR_FREE(secAlias); VIR_FREE(secAlias);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册