now, libvirt exposes enough support to create disk checkpoints
independently from a backup operation
via <code>virDomainCheckpointCreateXML()</code> <span class="since">since
- 5.6.0</span>.
+ 5.6.0</span>. Likewise, the creation of checkpoints when
+ external snapshots exist is currently forbidden, although future
+ work will make it possible to integrate these two concepts.
</p>
<p>
Attributes of libvirt checkpoints are stored as child elements
sets that snapshot as current, and the prior current snapshot is
the parent of the new snapshot. Branches in the hierarchy can
be formed by reverting to a snapshot with a child, then creating
- another snapshot.
+ another snapshot. For now, the creation of external snapshots
+ when checkpoints exist is forbidden, although future work will
+ make it possible to integrate these two concepts.
</p>
<p>
The top-level <code>domainsnapshot</code> element may contain
if (!(vm = qemuDomObjFromDomain(domain)))
goto cleanup;
+ if (virDomainListCheckpoints(vm->checkpoints, NULL, domain, NULL, 0) > 0) {
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+ _("cannot create snapshot while checkpoint exists"));
+ goto cleanup;
+ }
+
cfg = virQEMUDriverGetConfig(driver);
if (virDomainSnapshotCreateXMLEnsureACL(domain->conn, vm->def, flags) < 0)
if (virDomainBlockRebaseEnsureACL(dom->conn, vm->def) < 0)
goto cleanup;
+ if (virDomainListCheckpoints(vm->checkpoints, NULL, dom, NULL, 0) > 0) {
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+ _("cannot perform block rebase while checkpoint exists"));
+ goto cleanup;
+ }
+
/* For normal rebase (enhanced blockpull), the common code handles
* everything, including vm cleanup. */
if (!(flags & VIR_DOMAIN_BLOCK_REBASE_COPY))
if (virDomainBlockCopyEnsureACL(dom->conn, vm->def) < 0)
goto cleanup;
+ if (virDomainListCheckpoints(vm->checkpoints, NULL, dom, NULL, 0) > 0) {
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+ _("cannot perform block copy while checkpoint exists"));
+ goto cleanup;
+ }
+
for (i = 0; i < nparams; i++) {
virTypedParameterPtr param = ¶ms[i];
return -1;
}
+ if (virDomainListCheckpoints(vm->checkpoints, NULL, dom, NULL, 0) > 0) {
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+ _("cannot perform block pull while checkpoint exists"));
+ virDomainObjEndAPI(&vm);
+ return -1;
+ }
+
return qemuDomainBlockPullCommon(dom->conn->privateData,
vm, path, NULL, bandwidth, flags);
}
if (virDomainBlockCommitEnsureACL(dom->conn, vm->def) < 0)
goto cleanup;
+ if (virDomainListCheckpoints(vm->checkpoints, NULL, dom, NULL, 0) > 0) {
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+ _("cannot perform block commit while checkpoint exists"));
+ goto cleanup;
+ }
+
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
goto cleanup;
goto endjob;
}
+ if (virDomainListCheckpoints(vm->checkpoints, NULL, dom, NULL, flags) > 0) {
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ "%s", _("cannot rename domain with checkpoints"));
+ goto endjob;
+ }
+
if (virDomainObjListRename(driver->domains, vm, new_name, flags,
qemuDomainRenameCallback, driver) < 0)
goto endjob;
if (!(vm = testDomObjFromDomain(domain)))
goto cleanup;
+ if (virDomainListCheckpoints(vm->checkpoints, NULL, domain, NULL, 0) > 0) {
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+ _("cannot create snapshot while checkpoint exists"));
+ goto cleanup;
+ }
+
if (!vm->persistent && (flags & VIR_DOMAIN_SNAPSHOT_CREATE_HALT)) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("cannot halt after transient domain snapshot"));
if (!(vm = testDomObjFromDomain(domain)))
goto cleanup;
+ if (virDomainSnapshotObjListNum(vm->snapshots, NULL, 0) > 0) {
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+ _("cannot create checkpoint while snapshot exists"));
+ goto cleanup;
+ }
+
if (!virDomainObjIsActive(vm)) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
_("cannot create checkpoint for inactive domain"));
checkpoint-create-as test c1
checkpoint-create-as test c3
checkpoint-create-as test c2
+ # snapshots cannot be created while checkpoints exist
+ echo --err marker
+ snapshot-create-as test s1
+ echo --err marker
# Checking tree view (siblings sorted alphabetically)
checkpoint-list test --tree
# Demonstrate list filtering
Domain checkpoint c3 created
Domain checkpoint c2 created
+
+
+
c1
|
+- c3
cat <<EOF > exp || fail=1
error: operation failed: domain moment c1 already exists
+error: marker
+error: Operation not supported: cannot create snapshot while checkpoint exists
+error: marker
EOF
compare exp err || fail=1
snapshot-revert test s1
snapshot-create-as test s7
snapshot-create-as test s8
+ # checkpoints cannot be created while snapshots exist
+ echo --err marker
+ checkpoint-create-as test c1
+ echo --err marker
# Checking tree view (siblings sorted alphabetically)
snapshot-list test --tree
# Current was last one created, but we can change that
Domain snapshot s7 created
Domain snapshot s8 created
+
+
+
s1
|
+- s3
cat <<EOF > exp || fail=1
error: operation failed: domain moment s1 already exists
error: marker
+error: Operation not supported: cannot create checkpoint while snapshot exists
+error: marker
+error: marker
error: domain 'test' has no current snapshot
error: marker
EOF
metadata is silently lost when the domain quits running (whether
by command such as B<destroy> or by internal guest action).
+For now, it is not possible to create snapshots in a domain that has
+checkpoints, although this restriction will be lifted in a future
+release.
+
=item B<snapshot-create-as> I<domain> {[I<--print-xml>]
[I<--no-metadata>] [I<--halt>] [I<--reuse-external>]} [I<name>]
[I<description>] [I<--disk-only> [I<--quiesce>]] [I<--atomic>]
running. This increases the size of the memory image of the external
snapshot. This is currently supported only for external full system snapshots.
+For now, it is not possible to create snapshots in a domain that has
+checkpoints, although this restriction will be lifted in a future
+release.
+
=item B<snapshot-current> I<domain> {[I<--name>] | [I<--security-info>]
| [I<snapshotname>]}
metadata is silently lost when the domain quits running (whether
by command such as B<destroy> or by internal guest action).
+For now, it is not possible to create checkpoints in a domain that has
+snapshots, although this restriction will be lifted in a future
+release.
+
=item B<checkpoint-create-as> I<domain> [I<--print-xml>]
[I<name>] [I<description>] [I<--quiesce>] [I<--diskspec>] B<diskspec>]...
to freeze and unfreeze domain's mounted file systems. However,
if domain has no guest agent, checkpoint creation will fail.
+For now, it is not possible to create checkpoints in a domain that has
+snapshots, although this restriction will be lifted in a future
+release.
+
=item B<checkpoint-edit> I<domain> I<checkpointname>
Edit the XML configuration file for I<checkpointname> of a domain.