]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virsh: domjobinfo: Print also job operation for failed jobs
authorPeter Krempa <pkrempa@redhat.com>
Thu, 21 Nov 2019 16:36:18 +0000 (17:36 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 3 Dec 2019 14:26:53 +0000 (15:26 +0100)
Printing that a job failed is rather unhelpful. Print at least the
operation which failed.

Achieve this by moving the check whether to print stats later but
replace it with a check which will skip printing of the operation if
there's no job.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
tools/virsh-domain.c

index 14ea3f9cfb1b5e56302c386b0020d8d137529155..d8c09927d2e31e8e47fd07164f1982326cddd187 100644 (file)
@@ -6153,10 +6153,8 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd)
 
     vshPrint(ctl, "%-17s %-12s\n", _("Job type:"),
              virshDomainJobToString(info.type));
-    if (info.type != VIR_DOMAIN_JOB_BOUNDED &&
-        info.type != VIR_DOMAIN_JOB_UNBOUNDED &&
-        (!(flags & VIR_DOMAIN_JOB_STATS_COMPLETED) ||
-         info.type != VIR_DOMAIN_JOB_COMPLETED)) {
+
+    if (info.type == VIR_DOMAIN_JOB_NONE) {
         ret = true;
         goto cleanup;
     }
@@ -6169,6 +6167,14 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd)
     vshPrint(ctl, "%-17s %-12s\n", _("Operation:"),
              virshDomainJobOperationToString(op));
 
+    if (info.type != VIR_DOMAIN_JOB_BOUNDED &&
+        info.type != VIR_DOMAIN_JOB_UNBOUNDED &&
+        (!(flags & VIR_DOMAIN_JOB_STATS_COMPLETED) ||
+         info.type != VIR_DOMAIN_JOB_COMPLETED)) {
+        ret = true;
+        goto cleanup;
+    }
+
     vshPrint(ctl, "%-17s %-12llu ms\n", _("Time elapsed:"), info.timeElapsed);
     if ((rc = virTypedParamsGetULLong(params, nparams,
                                       VIR_DOMAIN_JOB_TIME_ELAPSED_NET,