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

qemu: Add prefix for vsock vhostfd

Alter qemuBuildVsockDevStr to allow passing a prefix for
the vhostfd file descriptor name. Domain startup uses
the numeric value of fd without a prefix, but hotplug
will need to use a prefix because passed file descriptor
names cannot start with a number.

https://bugzilla.redhat.com/show_bug.cgi?id=1291851Signed-off-by: NJán Tomko <jtomko@redhat.com>
Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
上级 5048aa52
......@@ -9915,7 +9915,8 @@ qemuBuildSeccompSandboxCommandLine(virCommandPtr cmd,
static char *
qemuBuildVsockDevStr(virDomainDefPtr def,
virDomainVsockDefPtr vsock,
virQEMUCapsPtr qemuCaps)
virQEMUCapsPtr qemuCaps,
const char *fdprefix)
{
qemuDomainVsockPrivatePtr priv = (qemuDomainVsockPrivatePtr)vsock->privateData;
virBuffer buf = VIR_BUFFER_INITIALIZER;
......@@ -9925,7 +9926,7 @@ qemuBuildVsockDevStr(virDomainDefPtr def,
virBufferAsprintf(&buf, "%s", device);
virBufferAsprintf(&buf, ",id=%s", vsock->info.alias);
virBufferAsprintf(&buf, ",guest-cid=%u", vsock->guest_cid);
virBufferAsprintf(&buf, ",vhostfd=%u", priv->vhostfd);
virBufferAsprintf(&buf, ",vhostfd=%s%u", fdprefix, priv->vhostfd);
if (qemuBuildDeviceAddressStr(&buf, def, &vsock->info, qemuCaps) < 0)
goto cleanup;
......@@ -9950,7 +9951,7 @@ qemuBuildVsockCommandLine(virCommandPtr cmd,
char *devstr = NULL;
int ret = -1;
if (!(devstr = qemuBuildVsockDevStr(def, vsock, qemuCaps)))
if (!(devstr = qemuBuildVsockDevStr(def, vsock, qemuCaps, "")))
goto cleanup;
virCommandPassFD(cmd, priv->vhostfd, VIR_COMMAND_PASS_FD_CLOSE_PARENT);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册