[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 3/3] virsh: Expose new VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE flag



On Tue, Jan 24, 2012 at 18:37:45 +0100, Michal Privoznik wrote:
> to cmdSnapshotCreate and cmdSnapshotCreateAs.
> ---
>  tools/virsh.c   |    6 ++++++
>  tools/virsh.pod |   14 ++++++++++++--
>  2 files changed, 18 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/virsh.c b/tools/virsh.c
> index 5560988..999941c 100644
> --- a/tools/virsh.c
> +++ b/tools/virsh.c
> @@ -14662,6 +14662,7 @@ static const vshCmdOptDef opts_snapshot_create[] = {
>      {"halt", VSH_OT_BOOL, 0, N_("halt domain after snapshot is created")},
>      {"disk-only", VSH_OT_BOOL, 0, N_("capture disk state but not vm state")},
>      {"reuse-external", VSH_OT_BOOL, 0, N_("reuse any existing external files")},
> +    {"quiesce", VSH_OT_BOOL, 0, N_("quiesce guest's file systems")},
>      {NULL, 0, 0, NULL}
>  };
>  
> @@ -14686,6 +14687,8 @@ cmdSnapshotCreate(vshControl *ctl, const vshCmd *cmd)
>          flags |= VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY;
>      if (vshCommandOptBool(cmd, "reuse-external"))
>          flags |= VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT;
> +    if (vshCommandOptBool(cmd, "quiesce"))
> +        flags |= VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE;
>  
>      if (!vshConnectionUsability(ctl, ctl->conn))
>          goto cleanup;
> @@ -14795,6 +14798,7 @@ static const vshCmdOptDef opts_snapshot_create_as[] = {
>      {"halt", VSH_OT_BOOL, 0, N_("halt domain after snapshot is created")},
>      {"disk-only", VSH_OT_BOOL, 0, N_("capture disk state but not vm state")},
>      {"reuse-external", VSH_OT_BOOL, 0, N_("reuse any existing external files")},
> +    {"quiesce", VSH_OT_BOOL, 0, N_("quiesce guest's file systems")},
>      {"diskspec", VSH_OT_ARGV, 0,
>       N_("disk attributes: disk[,snapshot=type][,driver=type][,file=name]")},
>      {NULL, 0, 0, NULL}
> @@ -14820,6 +14824,8 @@ cmdSnapshotCreateAs(vshControl *ctl, const vshCmd *cmd)
>          flags |= VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY;
>      if (vshCommandOptBool(cmd, "reuse-external"))
>          flags |= VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT;
> +    if (vshCommandOptBool(cmd, "quiesce"))
> +        flags |= VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE;
>  
>      if (!vshConnectionUsability(ctl, ctl->conn))
>          goto cleanup;
> diff --git a/tools/virsh.pod b/tools/virsh.pod
> index 72c6d8f..b1f75de 100644
> --- a/tools/virsh.pod
> +++ b/tools/virsh.pod
> @@ -2046,7 +2046,8 @@ used to represent properties of snapshots.
>  =over 4
>  
>  =item B<snapshot-create> I<domain> [I<xmlfile>] {[I<--redefine> [I<--current>]]
> -| [I<--no-metadata>] [I<--halt>] [I<--disk-only>] [I<--reuse-external]}
> +| [I<--no-metadata>] [I<--halt>] [I<--disk-only>] [I<--reuse-external]
> +[I<--quiesce>]}
>  
>  Create a snapshot for domain I<domain> with the properties specified in
>  I<xmlfile>.  Normally, the only properties settable for a domain snapshot
> @@ -2088,6 +2089,10 @@ external snapshot with a destination of an existing file, then the
>  existing file is truncated and reused; otherwise, a snapshot is refused
>  to avoid losing contents of the existing files.
>  
> +If I<--quiesce> is specified, libvirt will try to use guest agent
> +to freeze and unfreeze domain's mounted file systems. However,
> +currently this requires I<--disk-only> to be passed as well.
> +

I'm not a native speaker but I feel like "libvirt will try to use guest agent"
suggests that the snapshot will still be created even though guest agent
couldn't be used for freezing guest's file systems. I'd rather be explicit
about the fact that no guest agent implies no snapshot.

>  Existence of snapshot metadata will prevent attempts to B<undefine>
>  a persistent domain.  However, for transient domains, snapshot
>  metadata is silently lost when the domain quits running (whether
> @@ -2095,7 +2100,8 @@ by command such as B<destroy> or by internal guest action).
>  
>  =item B<snapshot-create-as> I<domain> {[I<--print-xml>]
>  | [I<--no-metadata>] [I<--halt>] [I<--reuse-existing>]} [I<name>]
> -[I<description>] [I<--disk-only> [[I<--diskspec>] B<diskspec>]...]
> +[I<description>] [I<--disk-only> [I<--quiesce>]
> +[[I<--diskspec>] B<diskspec>]...]
>  
>  Create a snapshot for domain I<domain> with the given <name> and
>  <description>; if either value is omitted, libvirt will choose a
> @@ -2123,6 +2129,10 @@ option requests an external snapshot with a destination of an existing
>  file, then the existing file is truncated and reused; otherwise, a
>  snapshot is refused to avoid losing contents of the existing files.
>  
> +If I<--quiesce> is specified, libvirt will try to use guest agent
> +to freeze and unfreeze domain's mounted file systems. However,
> +currently this requires I<--disk-only> to be passed as well.
> +

And here as well.

>  If I<--no-metadata> is specified, then the snapshot data is created,
>  but any metadata is immediately discarded (that is, libvirt does not
>  treat the snapshot as current, and cannot revert to the snapshot

Jirka


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]