mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
qemu-conf: add slirp state dir
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
b0baafe92c
commit
5ac015efe1
@ -247,6 +247,8 @@ virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool privileged)
|
|||||||
goto error;
|
goto error;
|
||||||
if (virAsprintf(&cfg->autostartDir, "%s/qemu/autostart", cfg->configBaseDir) < 0)
|
if (virAsprintf(&cfg->autostartDir, "%s/qemu/autostart", cfg->configBaseDir) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
if (virAsprintf(&cfg->slirpStateDir, "%s/slirp", cfg->stateDir) < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
/* Set the default directory to find TLS X.509 certificates.
|
/* Set the default directory to find TLS X.509 certificates.
|
||||||
* This will then be used as a fallback if the service specific
|
* This will then be used as a fallback if the service specific
|
||||||
@ -335,6 +337,7 @@ static void virQEMUDriverConfigDispose(void *obj)
|
|||||||
VIR_FREE(cfg->swtpmLogDir);
|
VIR_FREE(cfg->swtpmLogDir);
|
||||||
VIR_FREE(cfg->stateDir);
|
VIR_FREE(cfg->stateDir);
|
||||||
VIR_FREE(cfg->swtpmStateDir);
|
VIR_FREE(cfg->swtpmStateDir);
|
||||||
|
VIR_FREE(cfg->slirpStateDir);
|
||||||
|
|
||||||
VIR_FREE(cfg->libDir);
|
VIR_FREE(cfg->libDir);
|
||||||
VIR_FREE(cfg->cacheDir);
|
VIR_FREE(cfg->cacheDir);
|
||||||
|
@ -96,6 +96,7 @@ struct _virQEMUDriverConfig {
|
|||||||
char *swtpmLogDir;
|
char *swtpmLogDir;
|
||||||
char *stateDir;
|
char *stateDir;
|
||||||
char *swtpmStateDir;
|
char *swtpmStateDir;
|
||||||
|
char *slirpStateDir;
|
||||||
/* These two directories are ones QEMU processes use (so must match
|
/* These two directories are ones QEMU processes use (so must match
|
||||||
* the QEMU user/group */
|
* the QEMU user/group */
|
||||||
char *libDir;
|
char *libDir;
|
||||||
|
@ -832,6 +832,11 @@ qemuStateInitialize(bool privileged,
|
|||||||
cfg->memoryBackingDir);
|
cfg->memoryBackingDir);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
if (virFileMakePath(cfg->slirpStateDir) < 0) {
|
||||||
|
virReportSystemError(errno, _("Failed to create slirp state dir %s"),
|
||||||
|
cfg->slirpStateDir);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
if ((qemu_driver->lockFD =
|
if ((qemu_driver->lockFD =
|
||||||
virPidFileAcquire(cfg->stateDir, "driver", false, getpid())) < 0)
|
virPidFileAcquire(cfg->stateDir, "driver", false, getpid())) < 0)
|
||||||
@ -971,6 +976,13 @@ qemuStateInitialize(bool privileged,
|
|||||||
(int)cfg->group);
|
(int)cfg->group);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
if (chown(cfg->slirpStateDir, cfg->user, cfg->group) < 0) {
|
||||||
|
virReportSystemError(errno,
|
||||||
|
_("unable to set ownership of '%s' to %d:%d"),
|
||||||
|
cfg->slirpStateDir, (int)cfg->user,
|
||||||
|
(int)cfg->group);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
run_uid = cfg->user;
|
run_uid = cfg->user;
|
||||||
run_gid = cfg->group;
|
run_gid = cfg->group;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user