[libvirt] [PATCH 6/9] virsh: domjobinfo: Allow printing stats also for failed and other jobs

Peter Krempa pkrempa at redhat.com
Mon Nov 25 15:01:33 UTC 2019


Introduce the --anystats flag which does not skip the printing of the
stats if the job was unsuccessful.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 tools/virsh-domain.c | 7 ++++++-
 tools/virsh.pod      | 5 +++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 577dec30c5..81229fa5ca 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -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)) {
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 6c14520780..e5428976a0 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -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 display statistics also 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
-- 
2.23.0




More information about the libvir-list mailing list