From 880b1a2e25fc7b76581b1115a5ab538d74193159 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Tue, 6 Jun 2017 15:32:49 +0200 Subject: [PATCH] virsh: Add support for VIR_DOMAIN_BLOCK_COPY_TRANSIENT_JOB Allow using the new flag with virsh. --- tools/virsh-domain.c | 10 +++++++++- tools/virsh.pod | 6 ++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index ccb514ef9a..f39589c204 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -2184,6 +2184,10 @@ static const vshCmdOptDef opts_block_copy[] = { .type = VSH_OT_BOOL, .help = N_("the bandwidth limit is in bytes/s rather than MiB/s") }, + {.name = "transient-job", + .type = VSH_OT_BOOL, + .help = N_("the copy job is not persisted if VM is turned off") + }, {.name = NULL} }; @@ -2205,6 +2209,7 @@ cmdBlockCopy(vshControl *ctl, const vshCmd *cmd) bool blocking = vshCommandOptBool(cmd, "wait") || finish || pivot; bool async = vshCommandOptBool(cmd, "async"); bool bytes = vshCommandOptBool(cmd, "bytes"); + bool transientjob = vshCommandOptBool(cmd, "transient-job"); int timeout = 0; const char *path = NULL; int abort_flags = 0; @@ -2234,6 +2239,8 @@ cmdBlockCopy(vshControl *ctl, const vshCmd *cmd) flags |= VIR_DOMAIN_BLOCK_REBASE_SHALLOW; if (vshCommandOptBool(cmd, "reuse-external")) flags |= VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT; + if (transientjob) + flags |= VIR_DOMAIN_BLOCK_COPY_TRANSIENT_JOB; if (vshCommandOptTimeoutToMs(ctl, cmd, &timeout) < 0) return false; @@ -2282,7 +2289,8 @@ cmdBlockCopy(vshControl *ctl, const vshCmd *cmd) } } - if (granularity || buf_size || (format && STRNEQ(format, "raw")) || xml) { + if (granularity || buf_size || (format && STRNEQ(format, "raw")) || xml || + transientjob) { /* New API */ if (bandwidth || granularity || buf_size) { params = vshCalloc(ctl, 3, sizeof(*params)); diff --git a/tools/virsh.pod b/tools/virsh.pod index aee9646895..73483ea7b0 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -1078,6 +1078,7 @@ command. | I<--xml> B } [I<--shallow>] [I<--reuse-external>] [I] [I<--wait> [I<--async>] [I<--verbose>]] [{I<--pivot> | I<--finish>}] [I<--timeout> B] [I] [I] [I<--bytes>] +[I<--transient-job>] Copy a disk backing image chain to a destination. Either I as the destination file name, or I<--xml> with the name of an XML file containing @@ -1132,6 +1133,11 @@ within a certain range. Specifying I will control how much data can be simultaneously in-flight during the copy; larger values use more memory but may allow faster completion (the default value is usually correct). +I<--transient-job> allows to specify that the user does not require the job to +be recovered if the VM crashes or is turned off before the job completes. This +flag removes the restriction of copy jobs to transient domains if that +restriction is applied by the hypervisor. + =item B I I [I] [I<--bytes>] [I] [I<--wait> [I<--verbose>] [I<--timeout> B] [I<--async>]] [I<--keep-relative>]