Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@xxxxxxxxxxxxx> --- docs/manpages/virsh.rst | 8 +++++++- tools/virsh-snapshot.c | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index 5f5ccfeafe..64f0eec4a2 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -6948,7 +6948,7 @@ snapshot-create snapshot-create domain [xmlfile] {[--redefine [--current]] | [--no-metadata] [--halt] [--disk-only] [--reuse-external] - [--quiesce] [--atomic] [--live]} [--validate] + [--quiesce] [--atomic] [--live]} [--validate] [--instant] Create a snapshot for domain *domain* with the properties specified in *xmlfile*. Optionally, the *--validate* option can be passed to @@ -7010,6 +7010,12 @@ the guest is running. Both disk snapshot and domain memory snapshot are taken. This increases the size of the memory image of the external snapshot. This is currently supported only for full system external snapshots. +If *--instant* is specified then snapshot will be at the moment the +snapshot is called. Ordinary snapshot is done at the moment the call +is finished. The time difference can be significant if domain memory +is large. The flag only makes sense in case of snapshots with memory. + + Existence of snapshot metadata will prevent attempts to ``undefine`` a persistent guest. However, for transient domains, snapshot metadata is silently lost when the domain quits running (whether diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c index 154e82b48b..72ed1b2a52 100644 --- a/tools/virsh-snapshot.c +++ b/tools/virsh-snapshot.c @@ -152,6 +152,10 @@ static const vshCmdOptDef opts_snapshot_create[] = { .type = VSH_OT_BOOL, .help = N_("validate the XML against the schema"), }, + {.name = "instant", + .type = VSH_OT_BOOL, + .help = N_("snapshot at the moment of call"), + }, {.name = NULL} }; @@ -183,6 +187,8 @@ cmdSnapshotCreate(vshControl *ctl, const vshCmd *cmd) flags |= VIR_DOMAIN_SNAPSHOT_CREATE_LIVE; if (vshCommandOptBool(cmd, "validate")) flags |= VIR_DOMAIN_SNAPSHOT_CREATE_VALIDATE; + if (vshCommandOptBool(cmd, "instant")) + flags |= VIR_DOMAIN_SNAPSHOT_CREATE_INSTANT; if (!(dom = virshCommandOptDomain(ctl, cmd, NULL))) return false; -- 2.27.0