mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 11:31:16 +00:00
qemu: add passtStateDir to qemu driver config
...following in the patter of slirpStateDir. Signed-off-by: Laine Stump <laine@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
5af6134e70
commit
98a24813c8
@ -225,6 +225,7 @@ virQEMUDriverConfig *virQEMUDriverConfigNew(bool privileged,
|
||||
cfg->configDir = g_strdup_printf("%s/qemu", cfg->configBaseDir);
|
||||
cfg->autostartDir = g_strdup_printf("%s/qemu/autostart", cfg->configBaseDir);
|
||||
cfg->slirpStateDir = g_strdup_printf("%s/slirp", cfg->stateDir);
|
||||
cfg->passtStateDir = g_strdup_printf("%s/passt", cfg->stateDir);
|
||||
cfg->dbusStateDir = g_strdup_printf("%s/dbus", cfg->stateDir);
|
||||
|
||||
/* Set the default directory to find TLS X.509 certificates.
|
||||
@ -310,6 +311,7 @@ static void virQEMUDriverConfigDispose(void *obj)
|
||||
g_free(cfg->stateDir);
|
||||
g_free(cfg->swtpmStateDir);
|
||||
g_free(cfg->slirpStateDir);
|
||||
g_free(cfg->passtStateDir);
|
||||
g_free(cfg->dbusStateDir);
|
||||
|
||||
g_free(cfg->libDir);
|
||||
|
@ -95,6 +95,7 @@ struct _virQEMUDriverConfig {
|
||||
char *stateDir;
|
||||
char *swtpmStateDir;
|
||||
char *slirpStateDir;
|
||||
char *passtStateDir;
|
||||
char *dbusStateDir;
|
||||
/* These two directories are ones QEMU processes use (so must match
|
||||
* the QEMU user/group */
|
||||
|
@ -663,6 +663,11 @@ qemuStateInitialize(bool privileged,
|
||||
cfg->slirpStateDir);
|
||||
goto error;
|
||||
}
|
||||
if (g_mkdir_with_parents(cfg->passtStateDir, 0777) < 0) {
|
||||
virReportSystemError(errno, _("Failed to create passt state dir %s"),
|
||||
cfg->passtStateDir);
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (virDirCreate(cfg->dbusStateDir, 0770, cfg->user, cfg->group,
|
||||
VIR_DIR_CREATE_ALLOW_EXIST) < 0) {
|
||||
@ -811,6 +816,13 @@ qemuStateInitialize(bool privileged,
|
||||
(int)cfg->group);
|
||||
goto error;
|
||||
}
|
||||
if (chown(cfg->passtStateDir, cfg->user, cfg->group) < 0) {
|
||||
virReportSystemError(errno,
|
||||
_("unable to set ownership of '%s' to %d:%d"),
|
||||
cfg->passtStateDir, (int)cfg->user,
|
||||
(int)cfg->group);
|
||||
goto error;
|
||||
}
|
||||
|
||||
run_uid = cfg->user;
|
||||
run_gid = cfg->group;
|
||||
|
Loading…
Reference in New Issue
Block a user