提交 5ac015ef 编写于 作者: M Marc-André Lureau 提交者: Michal Privoznik

qemu-conf: add slirp state dir

Signed-off-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
上级 b0baafe9
......@@ -247,6 +247,8 @@ virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool privileged)
goto error;
if (virAsprintf(&cfg->autostartDir, "%s/qemu/autostart", cfg->configBaseDir) < 0)
goto error;
if (virAsprintf(&cfg->slirpStateDir, "%s/slirp", cfg->stateDir) < 0)
goto error;
/* Set the default directory to find TLS X.509 certificates.
* 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->stateDir);
VIR_FREE(cfg->swtpmStateDir);
VIR_FREE(cfg->slirpStateDir);
VIR_FREE(cfg->libDir);
VIR_FREE(cfg->cacheDir);
......
......@@ -96,6 +96,7 @@ struct _virQEMUDriverConfig {
char *swtpmLogDir;
char *stateDir;
char *swtpmStateDir;
char *slirpStateDir;
/* These two directories are ones QEMU processes use (so must match
* the QEMU user/group */
char *libDir;
......
......@@ -832,6 +832,11 @@ qemuStateInitialize(bool privileged,
cfg->memoryBackingDir);
goto error;
}
if (virFileMakePath(cfg->slirpStateDir) < 0) {
virReportSystemError(errno, _("Failed to create slirp state dir %s"),
cfg->slirpStateDir);
goto error;
}
if ((qemu_driver->lockFD =
virPidFileAcquire(cfg->stateDir, "driver", false, getpid())) < 0)
......@@ -971,6 +976,13 @@ qemuStateInitialize(bool privileged,
(int)cfg->group);
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_gid = cfg->group;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册