virsh: domjobinfo: Allow printing stats also for failed and other jobs

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>
This commit is contained in:
Peter Krempa 2019-11-21 17:44:00 +01:00
parent 2a55bcd8da
commit 7f3534a5bb
2 changed files with 11 additions and 1 deletions

View 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)) {

View 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