mirror of https://gitee.com/openkylin/libvirt.git
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;
|
||||
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;
|
||||
|
|
Loading…
Reference in New Issue