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

Re: [libvirt] [PATCH v3 2/2] virsh: introduce flage --direct for save command




On 03/08/2017 11:22 PM, Chen Hanxiao wrote:
> From: Chen Hanxiao <chenhanxiao gmail com>
> 
> Base upon patches from Roy Keene <rkeene knightpoint com>
> 
> This patch introduces --direct flag for save command.
> 
> We could use this flag to save vm to a PIPE.
> 
> We could saving a VM state directly to Ceph RBD images
> without having an intermediate file.
> 
> How to test:
> fifo="$(mktemp -u)"; mkfifo "${fifo}" && virsh save --pipe cirros  "${fifo}" &
> cat "${fifo}" | rbd --id cinder import - hotsnapshot/test1234 & wait; rm -f "${fifo}"

Is there a way to do this without rbd at the other end?  Is there
another example to provide...  Perhaps something that would be
documented else where was well rather than just in the bowels of virsh.
Perhaps somewhere where the other VIR_DOMAIN_SAVE_* flags are described.

> 
> Signed-off-by: Roy Keene <rkeene knightpoint com>
> Signed-off-by: Chen Hanxiao <chenhanxiao gmail com>
> ---
> v3:
>   rebase on upstream
> 
> v2-resend:
>   rebase on upstream
> 
> v2:
>   rename VIR_DOMAIN_SAVE_PIPE to VIR_DOMAIN_SAVE_DIRECT
> 
>  tools/virsh-domain.c | 6 ++++++
>  tools/virsh.pod      | 5 ++++-
>  2 files changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
> index 09a9f82..d96e894 100644
> --- a/tools/virsh-domain.c
> +++ b/tools/virsh-domain.c
> @@ -4192,6 +4192,10 @@ static const vshCmdOptDef opts_save[] = {
>       .type = VSH_OT_BOOL,
>       .help = N_("set domain to be paused on restore")
>      },
> +    {.name = "direct",
> +     .type = VSH_OT_BOOL,
> +     .help = N_("write the file directly, needed by PIPE/FIFO")

remove ", needed by PIPE/FIFO"

> +    },
>      {.name = "verbose",
>       .type = VSH_OT_BOOL,
>       .help = N_("display the progress of save")
> @@ -4228,6 +4232,8 @@ doSave(void *opaque)
>          flags |= VIR_DOMAIN_SAVE_RUNNING;
>      if (vshCommandOptBool(cmd, "paused"))
>          flags |= VIR_DOMAIN_SAVE_PAUSED;
> +    if (vshCommandOptBool(cmd, "direct"))
> +        flags |= VIR_DOMAIN_SAVE_DIRECT;
>  
>      if (vshCommandOptStringReq(ctl, cmd, "xml", &xmlfile) < 0)
>          goto out;
> diff --git a/tools/virsh.pod b/tools/virsh.pod
> index ee79046..9dcb527 100644
> --- a/tools/virsh.pod
> +++ b/tools/virsh.pod
> @@ -1928,7 +1928,7 @@ have also reverted all storage volumes back to the same contents as when
>  the state file was created.
>  
>  =item B<save> I<domain> I<state-file> [I<--bypass-cache>] [I<--xml> B<file>]
> -[{I<--running> | I<--paused>}] [I<--verbose>]
> +[{I<--running> | I<--paused>}] [I<--direct>] [I<--verbose>]
>  
>  Saves a running domain (RAM, but not disk state) to a state file so that
>  it can be restored
> @@ -1943,6 +1943,9 @@ with B<domjobabort> command (sent by another virsh instance). Another option
>  is to send SIGINT (usually with C<Ctrl-C>) to the virsh process running
>  B<save> command. I<--verbose> displays the progress of save.
>  
> +Usually B<save> command will save the domain's state as a regular file.
> +If you want to save it into a PIPE/FIFO, then flag I<--direct> must be set.
> +

As noted in review of .1 - how does --bypass-cache affect things usage
wise?  Does it matter, is it helpful.

I wish I could think of a better way to say this right now, but it's
late so I'm just winging it.  If there's a way to say generically what
direct does where "pipe" is a possible mechanism to use (as is I assume
a socket).

John

>  This is roughly equivalent to doing a hibernate on a running computer,
>  with all the same limitations.  Open network connections may be
>  severed upon restore, as TCP timeouts may have expired.
> 


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