mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
backup: qemu: Add directory for tracking checkpoints
This is similar to the existing directory for snapshots; the domain will save one xml file per checkpoint, for reloading on the next libvirtd restart. Fortunately, since checkpoints mandate RNG validation, we are assured that the checkpoint name will be usable as a file name (no abuse of '../escape' as a checkpoint name, for example). Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
3f93884a4d
commit
63b9c21dd2
@ -160,6 +160,8 @@ virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool privileged)
|
||||
goto error;
|
||||
if (virAsprintf(&cfg->snapshotDir, "%s/snapshot", cfg->libDir) < 0)
|
||||
goto error;
|
||||
if (virAsprintf(&cfg->checkpointDir, "%s/checkpoint", cfg->libDir) < 0)
|
||||
goto error;
|
||||
if (virAsprintf(&cfg->autoDumpPath, "%s/dump", cfg->libDir) < 0)
|
||||
goto error;
|
||||
if (virAsprintf(&cfg->channelTargetDir,
|
||||
@ -223,6 +225,8 @@ virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool privileged)
|
||||
goto error;
|
||||
if (virAsprintf(&cfg->snapshotDir, "%s/qemu/snapshot", cfg->configBaseDir) < 0)
|
||||
goto error;
|
||||
if (virAsprintf(&cfg->checkpointDir, "%s/qemu/checkpoint", cfg->configBaseDir) < 0)
|
||||
goto error;
|
||||
if (virAsprintf(&cfg->autoDumpPath, "%s/qemu/dump", cfg->configBaseDir) < 0)
|
||||
goto error;
|
||||
if (virAsprintf(&cfg->channelTargetDir,
|
||||
@ -335,6 +339,7 @@ static void virQEMUDriverConfigDispose(void *obj)
|
||||
VIR_FREE(cfg->cacheDir);
|
||||
VIR_FREE(cfg->saveDir);
|
||||
VIR_FREE(cfg->snapshotDir);
|
||||
VIR_FREE(cfg->checkpointDir);
|
||||
VIR_FREE(cfg->channelTargetDir);
|
||||
VIR_FREE(cfg->nvramDir);
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "capabilities.h"
|
||||
#include "network_conf.h"
|
||||
#include "domain_conf.h"
|
||||
#include "checkpoint_conf.h"
|
||||
#include "snapshot_conf.h"
|
||||
#include "domain_event.h"
|
||||
#include "virthread.h"
|
||||
@ -101,6 +102,7 @@ struct _virQEMUDriverConfig {
|
||||
char *cacheDir;
|
||||
char *saveDir;
|
||||
char *snapshotDir;
|
||||
char *checkpointDir;
|
||||
char *channelTargetDir;
|
||||
char *nvramDir;
|
||||
char *swtpmStorageDir;
|
||||
|
@ -656,6 +656,11 @@ qemuStateInitialize(bool privileged,
|
||||
cfg->snapshotDir);
|
||||
goto error;
|
||||
}
|
||||
if (virFileMakePath(cfg->checkpointDir) < 0) {
|
||||
virReportSystemError(errno, _("Failed to create checkpoint dir %s"),
|
||||
cfg->checkpointDir);
|
||||
goto error;
|
||||
}
|
||||
if (virFileMakePath(cfg->autoDumpPath) < 0) {
|
||||
virReportSystemError(errno, _("Failed to create dump dir %s"),
|
||||
cfg->autoDumpPath);
|
||||
@ -767,6 +772,13 @@ qemuStateInitialize(bool privileged,
|
||||
(int)cfg->group);
|
||||
goto error;
|
||||
}
|
||||
if (chown(cfg->checkpointDir, cfg->user, cfg->group) < 0) {
|
||||
virReportSystemError(errno,
|
||||
_("unable to set ownership of '%s' to %d:%d"),
|
||||
cfg->checkpointDir, (int)cfg->user,
|
||||
(int)cfg->group);
|
||||
goto error;
|
||||
}
|
||||
if (chown(cfg->autoDumpPath, cfg->user, cfg->group) < 0) {
|
||||
virReportSystemError(errno,
|
||||
_("unable to set ownership of '%s' to %d:%d"),
|
||||
|
Loading…
x
Reference in New Issue
Block a user