mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
qemu: do not put virtiofs socket in private data
Reconstruct the socket path from priv->libDir in every user. Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
cf5b3482c1
commit
e7801a490c
@ -2035,14 +2035,16 @@ qemuBuildDisksCommandLine(virCommand *cmd,
|
||||
|
||||
static char *
|
||||
qemuBuildVHostUserFsChardevStr(const virDomainFSDef *fs,
|
||||
const char *chardev_alias)
|
||||
const char *chardev_alias,
|
||||
qemuDomainObjPrivate *priv)
|
||||
{
|
||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||
g_autofree char *socket_path = qemuDomainGetVHostUserFSSocketPath(priv, fs);
|
||||
|
||||
virBufferAddLit(&buf, "socket");
|
||||
virBufferAsprintf(&buf, ",id=%s", chardev_alias);
|
||||
virBufferAddLit(&buf, ",path=");
|
||||
virQEMUBuildBufferEscapeComma(&buf, QEMU_DOMAIN_FS_PRIVATE(fs)->vhostuser_fs_sock);
|
||||
virQEMUBuildBufferEscapeComma(&buf, socket_path);
|
||||
return virBufferContentAndReset(&buf);
|
||||
}
|
||||
|
||||
@ -2088,7 +2090,7 @@ qemuBuildVHostUserFsCommandLine(virCommand *cmd,
|
||||
g_autofree char *devstr = NULL;
|
||||
|
||||
chardev_alias = qemuDomainGetVhostUserChrAlias(fs->info.alias);
|
||||
chrdevstr = qemuBuildVHostUserFsChardevStr(fs, chardev_alias);
|
||||
chrdevstr = qemuBuildVHostUserFsChardevStr(fs, chardev_alias, priv);
|
||||
|
||||
virCommandAddArg(cmd, "-chardev");
|
||||
virCommandAddArg(cmd, chrdevstr);
|
||||
|
@ -196,10 +196,8 @@ qemuExtDevicesStart(virQEMUDriver *driver,
|
||||
for (i = 0; i < def->nfss; i++) {
|
||||
virDomainFSDef *fs = def->fss[i];
|
||||
|
||||
if (fs->fsdriver == VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS) {
|
||||
if (fs->sock)
|
||||
QEMU_DOMAIN_FS_PRIVATE(fs)->vhostuser_fs_sock = g_strdup(fs->sock);
|
||||
else if (qemuVirtioFSStart(logManager, driver, vm, fs) < 0)
|
||||
if (fs->fsdriver == VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS && !fs->sock) {
|
||||
if (qemuVirtioFSStart(logManager, driver, vm, fs) < 0)
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -183,8 +183,7 @@ qemuVirtioFSStart(virLogManager *logManager,
|
||||
if (!(pidfile = qemuVirtioFSCreatePidFilename(vm, fs->info.alias)))
|
||||
goto cleanup;
|
||||
|
||||
if (!(socket_path = qemuVirtioFSCreateSocketFilename(vm, fs->info.alias)))
|
||||
goto cleanup;
|
||||
socket_path = qemuDomainGetVHostUserFSSocketPath(vm->privateData, fs);
|
||||
|
||||
if ((fd = qemuVirtioFSOpenChardev(driver, vm, socket_path)) < 0)
|
||||
goto cleanup;
|
||||
@ -251,12 +250,9 @@ qemuVirtioFSStart(virLogManager *logManager,
|
||||
goto error;
|
||||
}
|
||||
|
||||
QEMU_DOMAIN_FS_PRIVATE(fs)->vhostuser_fs_sock = g_steal_pointer(&socket_path);
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
if (socket_path)
|
||||
unlink(socket_path);
|
||||
return ret;
|
||||
|
||||
error:
|
||||
@ -264,6 +260,8 @@ qemuVirtioFSStart(virLogManager *logManager,
|
||||
virProcessKillPainfully(pid, true);
|
||||
if (pidfile)
|
||||
unlink(pidfile);
|
||||
if (socket_path)
|
||||
unlink(socket_path);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -284,8 +282,10 @@ qemuVirtioFSStop(virQEMUDriver *driver G_GNUC_UNUSED,
|
||||
if (virPidFileForceCleanupPathFull(pidfile, true) < 0) {
|
||||
VIR_WARN("Unable to kill virtiofsd process");
|
||||
} else {
|
||||
if (QEMU_DOMAIN_FS_PRIVATE(fs)->vhostuser_fs_sock)
|
||||
unlink(QEMU_DOMAIN_FS_PRIVATE(fs)->vhostuser_fs_sock);
|
||||
g_autofree char *socket_path = NULL;
|
||||
|
||||
socket_path = qemuDomainGetVHostUserFSSocketPath(vm->privateData, fs);
|
||||
unlink(socket_path);
|
||||
}
|
||||
|
||||
cleanup:
|
||||
|
@ -436,18 +436,6 @@ testCompareXMLToArgvCreateArgs(virQEMUDriver *drv,
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < vm->def->nfss; i++) {
|
||||
virDomainFSDef *fs = vm->def->fss[i];
|
||||
char *s;
|
||||
|
||||
if (fs->fsdriver != VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS ||
|
||||
QEMU_DOMAIN_FS_PRIVATE(fs)->vhostuser_fs_sock)
|
||||
continue;
|
||||
|
||||
s = g_strdup_printf("/tmp/lib/domain--1-guest/fs%zu-fs.sock", i);
|
||||
QEMU_DOMAIN_FS_PRIVATE(fs)->vhostuser_fs_sock = s;
|
||||
}
|
||||
|
||||
if (vm->def->vsock) {
|
||||
virDomainVsockDef *vsock = vm->def->vsock;
|
||||
qemuDomainVsockPrivate *vsockPriv =
|
||||
|
Loading…
Reference in New Issue
Block a user