]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virsh: domjobinfo: Allow printing stats also for failed and other jobs
authorPeter Krempa <pkrempa@redhat.com>
Thu, 21 Nov 2019 16:44:00 +0000 (17:44 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 3 Dec 2019 14:26:53 +0000 (15:26 +0100)
Introduce the --anystats flag which does not skip the printing of the
stats if the job was unsuccessful.

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

index d8c09927d2e31e8e47fd07164f1982326cddd187..b599ce4807ee146f8359d8c740c5c110a3e2ef8d 100644 (file)
@@ -6029,6 +6029,10 @@ static const vshCmdOptDef opts_domjobinfo[] = {
      .type = VSH_OT_BOOL,
      .help = N_("don't destroy statistics of a recently completed job when reading")
     },
+    {.name = "anystats",
+     .type = VSH_OT_BOOL,
+     .help = N_("print statistics for any kind of job (even failed ones)")
+    },
     {.name = NULL}
 };
 
@@ -6167,7 +6171,8 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd)
     vshPrint(ctl, "%-17s %-12s\n", _("Operation:"),
              virshDomainJobOperationToString(op));
 
-    if (info.type != VIR_DOMAIN_JOB_BOUNDED &&
+    if (!vshCommandOptBool(cmd, "anystats") &&
+        info.type != VIR_DOMAIN_JOB_BOUNDED &&
         info.type != VIR_DOMAIN_JOB_UNBOUNDED &&
         (!(flags & VIR_DOMAIN_JOB_STATS_COMPLETED) ||
          info.type != VIR_DOMAIN_JOB_COMPLETED)) {
index 59743a5aa40a5bda97175dd8a73d0c964d7328e8..4196bea7bdceb9e68b4f9de7158b8e866656be38 100644 (file)
@@ -1381,11 +1381,16 @@ Returns basic information about the domain.
 Abort the currently running domain job.
 
 =item B<domjobinfo> I<domain> [I<--completed> [I<--keep-completed>]]
+[I<--anystats>]
 
 Returns information about jobs running on a domain. I<--completed> tells
 virsh to return information about a recently finished job. Statistics of
 a completed job are automatically destroyed once read (unless
 I<--keep-completed> is used) or when libvirtd is restarted.
+
+Normally only statistics for running and successful completed jobs are printed.
+I<--anystats> can be used to also display statistics for failed jobs.
+
 Note that time information returned for completed
 migrations may be completely irrelevant unless both source and
 destination hosts have synchronized time (i.e., NTP daemon is running