mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-24 22:55:23 +00:00
qemu: assign USB addresses on redirdev hotplug too
https://bugzilla.redhat.com/show_bug.cgi?id=1375410
This commit is contained in:
parent
6a586ee2d9
commit
de325472cc
@ -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,
|
|||||||
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,
|
|||||||
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);
|
||||||
|
Loading…
Reference in New Issue
Block a user