mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-13 16:15:19 +00:00
qemu: Build nvram directory at driver startup
Similar to what was done for the channel socket in the previous commit. (cherry picked from commit 19425d110b0ca2ea3588dbf880ce48d81edea89c)
This commit is contained in:
parent
9ed89d783b
commit
ab87fb1cbc
@ -1961,7 +1961,6 @@ exit 0
|
|||||||
%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/qemu/
|
%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/qemu/
|
||||||
%ghost %dir %attr(0700, root, root) %{_localstatedir}/run/libvirt/qemu/
|
%ghost %dir %attr(0700, root, root) %{_localstatedir}/run/libvirt/qemu/
|
||||||
%dir %attr(0750, %{qemu_user}, %{qemu_group}) %{_localstatedir}/lib/libvirt/qemu/
|
%dir %attr(0750, %{qemu_user}, %{qemu_group}) %{_localstatedir}/lib/libvirt/qemu/
|
||||||
%dir %attr(0711, %{qemu_user}, %{qemu_group}) %{_localstatedir}/lib/libvirt/qemu/nvram/
|
|
||||||
%dir %attr(0750, %{qemu_user}, %{qemu_group}) %{_localstatedir}/cache/libvirt/qemu/
|
%dir %attr(0750, %{qemu_user}, %{qemu_group}) %{_localstatedir}/cache/libvirt/qemu/
|
||||||
%{_datadir}/augeas/lenses/libvirtd_qemu.aug
|
%{_datadir}/augeas/lenses/libvirtd_qemu.aug
|
||||||
%{_datadir}/augeas/lenses/tests/test_libvirtd_qemu.aug
|
%{_datadir}/augeas/lenses/tests/test_libvirtd_qemu.aug
|
||||||
@ -2062,7 +2061,6 @@ exit 0
|
|||||||
%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.qemu
|
%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.qemu
|
||||||
%ghost %dir %attr(0700, root, root) %{_localstatedir}/run/libvirt/qemu/
|
%ghost %dir %attr(0700, root, root) %{_localstatedir}/run/libvirt/qemu/
|
||||||
%dir %attr(0750, %{qemu_user}, %{qemu_group}) %{_localstatedir}/lib/libvirt/qemu/
|
%dir %attr(0750, %{qemu_user}, %{qemu_group}) %{_localstatedir}/lib/libvirt/qemu/
|
||||||
%dir %attr(0711, %{qemu_user}, %{qemu_group}) %{_localstatedir}/lib/libvirt/qemu/nvram/
|
|
||||||
%dir %attr(0750, %{qemu_user}, %{qemu_group}) %{_localstatedir}/cache/libvirt/qemu/
|
%dir %attr(0750, %{qemu_user}, %{qemu_group}) %{_localstatedir}/cache/libvirt/qemu/
|
||||||
%{_datadir}/augeas/lenses/libvirtd_qemu.aug
|
%{_datadir}/augeas/lenses/libvirtd_qemu.aug
|
||||||
%{_datadir}/augeas/lenses/tests/test_libvirtd_qemu.aug
|
%{_datadir}/augeas/lenses/tests/test_libvirtd_qemu.aug
|
||||||
|
@ -2685,7 +2685,6 @@ if WITH_SANLOCK
|
|||||||
endif WITH_SANLOCK
|
endif WITH_SANLOCK
|
||||||
if WITH_QEMU
|
if WITH_QEMU
|
||||||
$(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/qemu"
|
$(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/qemu"
|
||||||
$(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/qemu/nvram"
|
|
||||||
$(MKDIR_P) "$(DESTDIR)$(localstatedir)/run/libvirt/qemu"
|
$(MKDIR_P) "$(DESTDIR)$(localstatedir)/run/libvirt/qemu"
|
||||||
$(MKDIR_P) "$(DESTDIR)$(localstatedir)/cache/libvirt/qemu"
|
$(MKDIR_P) "$(DESTDIR)$(localstatedir)/cache/libvirt/qemu"
|
||||||
$(MKDIR_P) "$(DESTDIR)$(localstatedir)/log/libvirt/qemu"
|
$(MKDIR_P) "$(DESTDIR)$(localstatedir)/log/libvirt/qemu"
|
||||||
|
@ -208,6 +208,8 @@ virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool privileged)
|
|||||||
if (virAsprintf(&cfg->channelTargetDir,
|
if (virAsprintf(&cfg->channelTargetDir,
|
||||||
"%s/channel/target", cfg->libDir) < 0)
|
"%s/channel/target", cfg->libDir) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
if (virAsprintf(&cfg->nvramDir, "%s/nvram", cfg->libDir) < 0)
|
||||||
|
goto error;
|
||||||
} else {
|
} else {
|
||||||
char *rundir;
|
char *rundir;
|
||||||
char *cachedir;
|
char *cachedir;
|
||||||
@ -250,6 +252,9 @@ virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool privileged)
|
|||||||
if (virAsprintf(&cfg->channelTargetDir,
|
if (virAsprintf(&cfg->channelTargetDir,
|
||||||
"%s/qemu/channel/target", cfg->configBaseDir) < 0)
|
"%s/qemu/channel/target", cfg->configBaseDir) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
if (virAsprintf(&cfg->nvramDir,
|
||||||
|
"%s/qemu/nvram", cfg->configBaseDir) < 0)
|
||||||
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virAsprintf(&cfg->configDir, "%s/qemu", cfg->configBaseDir) < 0)
|
if (virAsprintf(&cfg->configDir, "%s/qemu", cfg->configBaseDir) < 0)
|
||||||
@ -349,6 +354,7 @@ static void virQEMUDriverConfigDispose(void *obj)
|
|||||||
VIR_FREE(cfg->saveDir);
|
VIR_FREE(cfg->saveDir);
|
||||||
VIR_FREE(cfg->snapshotDir);
|
VIR_FREE(cfg->snapshotDir);
|
||||||
VIR_FREE(cfg->channelTargetDir);
|
VIR_FREE(cfg->channelTargetDir);
|
||||||
|
VIR_FREE(cfg->nvramDir);
|
||||||
|
|
||||||
VIR_FREE(cfg->vncTLSx509certdir);
|
VIR_FREE(cfg->vncTLSx509certdir);
|
||||||
VIR_FREE(cfg->vncListen);
|
VIR_FREE(cfg->vncListen);
|
||||||
|
@ -105,6 +105,7 @@ struct _virQEMUDriverConfig {
|
|||||||
char *saveDir;
|
char *saveDir;
|
||||||
char *snapshotDir;
|
char *snapshotDir;
|
||||||
char *channelTargetDir;
|
char *channelTargetDir;
|
||||||
|
char *nvramDir;
|
||||||
|
|
||||||
bool vncAutoUnixSocket;
|
bool vncAutoUnixSocket;
|
||||||
bool vncTLS;
|
bool vncTLS;
|
||||||
|
@ -709,6 +709,11 @@ qemuStateInitialize(bool privileged,
|
|||||||
virStrerror(errno, ebuf, sizeof(ebuf)));
|
virStrerror(errno, ebuf, sizeof(ebuf)));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
if (virFileMakePath(cfg->nvramDir) < 0) {
|
||||||
|
VIR_ERROR(_("Failed to create nvram dir '%s': %s"),
|
||||||
|
cfg->nvramDir, virStrerror(errno, ebuf, sizeof(ebuf)));
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
qemu_driver->qemuImgBinary = virFindFileInPath("kvm-img");
|
qemu_driver->qemuImgBinary = virFindFileInPath("kvm-img");
|
||||||
if (!qemu_driver->qemuImgBinary)
|
if (!qemu_driver->qemuImgBinary)
|
||||||
@ -825,6 +830,13 @@ qemuStateInitialize(bool privileged,
|
|||||||
(int) cfg->group);
|
(int) cfg->group);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
if (chown(cfg->nvramDir, cfg->user, cfg->group) < 0) {
|
||||||
|
virReportSystemError(errno,
|
||||||
|
_("unable to set ownership of '%s' to %d:%d"),
|
||||||
|
cfg->nvramDir, (int) cfg->user,
|
||||||
|
(int) cfg->group);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
run_uid = cfg->user;
|
run_uid = cfg->user;
|
||||||
run_gid = cfg->group;
|
run_gid = cfg->group;
|
||||||
|
@ -4216,8 +4216,8 @@ qemuPrepareNVRAM(virQEMUDriverConfigPtr cfg,
|
|||||||
/* Autogenerate nvram path if needed.*/
|
/* Autogenerate nvram path if needed.*/
|
||||||
if (!loader->nvram) {
|
if (!loader->nvram) {
|
||||||
if (virAsprintf(&loader->nvram,
|
if (virAsprintf(&loader->nvram,
|
||||||
"%s/lib/libvirt/qemu/nvram/%s_VARS.fd",
|
"%s/%s_VARS.fd",
|
||||||
LOCALSTATEDIR, vm->def->name) < 0)
|
cfg->nvramDir, vm->def->name) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
generated = true;
|
generated = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user