]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
virsh: blockcopy: Report error if the copy job fails
authorPeter Krempa <pkrempa@redhat.com>
Fri, 19 Jun 2015 13:43:02 +0000 (15:43 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 22 Jun 2015 09:09:54 +0000 (11:09 +0200)
When the block job would fail while watching it using the "--wait"
option for blockcopy, virsh would rather unhelpfully report:

$ virsh blockcopy vm hdc /tmp/raw.img --granularity 4096 --verbose --wait

Now in mirroring phase

Add a special case when the block job vanishes while waiting for it to
finish to improve the message:

$ virsh blockcopy vm hdc /tmp/raw.img --granularity 8192 --verbose --wait
error: Block Copy unexpectedly failed

tools/virsh-domain.c

index 1a124f34d50deb2c619b3a36a11fc6d52c863cf0..4e890f406306cc47361d00a8fff947856780d235 100644 (file)
@@ -2312,8 +2312,11 @@ cmdBlockCopy(vshControl *ctl, const vshCmd *cmd)
             vshError(ctl, _("failed to query job for disk %s"), path);
             goto cleanup;
         }
-        if (result == 0)
-            break;
+
+        if (result == 0) {
+            vshError(ctl, _("Block Copy unexpectedly failed"));
+            goto cleanup;
+        }
 
         if (verbose)
             vshPrintJobProgress(_("Block Copy"), info.end - info.cur, info.end);