Blob Blame History Raw
From f19543baee399bf6b3d91da38fa0b7025f233dee Mon Sep 17 00:00:00 2001
From: Simone Gotti <simone.gotti@gmail.com>
Date: Thu, 19 Sep 2013 15:08:29 +0200
Subject: [PATCH] virsh: add missing "async" option in opts_block_commit

After commit 8aecd351266a66efa59b7f7be77bf66693d99ce0 it'll detect
that a required option is not defined and it will assert and exit with:

virsh.c:1364: vshCommandOpt: Assertion `valid->name' failed.

Problem has been latent since commit ed23b106.

Signed-off-by: Eric Blake <eblake@redhat.com>
(cherry picked from commit fe64499dd14315b2d9d62cdf421bd3c97a46b7ac)
---
 tools/virsh-domain.c | 4 ++++
 tools/virsh.pod      | 7 +++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 568d61d..da6ab87 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -1544,6 +1544,10 @@ static const vshCmdOptDef opts_block_commit[] = {
      .type = VSH_OT_INT,
      .help = N_("with --wait, abort if copy exceeds timeout (in seconds)")
     },
+    {.name = "async",
+     .type = VSH_OT_BOOL,
+     .help = N_("with --wait, don't wait for cancel to finish")
+    },
     {.name = NULL}
 };
 
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 0ae5178..2864f3d 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -737,7 +737,7 @@ I<domif-setlink>) will accept the MAC address printed by this command.
 
 =item B<blockcommit> I<domain> I<path> [I<bandwidth>]
 {[I<base>] | [I<--shallow>]} [I<top>] [I<--delete>]
-[I<--wait> [I<--verbose>] [I<--timeout> B<seconds>]]
+[I<--wait> [I<--verbose>] [I<--timeout> B<seconds>] [I<--async>]]
 
 Reduce the length of a backing image chain, by committing changes at the
 top of the chain (snapshot or delta files) into backing images.  By
@@ -756,7 +756,10 @@ operation can be checked with B<blockjob>.  However, if I<--wait> is
 specified, then this command will block until the operation completes,
 or cancel the operation if the optional I<timeout> in seconds elapses
 or SIGINT is sent (usually with C<Ctrl-C>).  Using I<--verbose> along
-with I<--wait> will produce periodic status updates.
+with I<--wait> will produce periodic status updates.  If job cancellation
+is triggered, I<--async> will return control to the user as fast as
+possible, otherwise the command may continue to block a little while
+longer until the job is done cleaning up.
 
 I<path> specifies fully-qualified path of the disk; it corresponds
 to a unique target name (<target dev='name'/>) or source file (<source