]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virsh: Implement VIR_DOMAIN_JOB_STATS_KEEP_COMPLETED for 'domjobinfo'
authorPeter Krempa <pkrempa@redhat.com>
Fri, 22 Nov 2019 13:26:56 +0000 (14:26 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 3 Dec 2019 14:26:53 +0000 (15:26 +0100)
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
tools/virsh-domain.c
tools/virsh.pod

index 99194c2f81526ebe905d41d6a03fa9651979f0b2..14ea3f9cfb1b5e56302c386b0020d8d137529155 100644 (file)
@@ -6025,6 +6025,10 @@ static const vshCmdOptDef opts_domjobinfo[] = {
      .type = VSH_OT_BOOL,
      .help = N_("return statistics of a recently completed job")
     },
+    {.name = "keep-completed",
+     .type = VSH_OT_BOOL,
+     .help = N_("don't destroy statistics of a recently completed job when reading")
+    },
     {.name = NULL}
 };
 
@@ -6117,12 +6121,17 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd)
     int op;
     int rc;
 
+    VSH_REQUIRE_OPTION("keep-completed", "completed");
+
     if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
         return false;
 
     if (vshCommandOptBool(cmd, "completed"))
         flags |= VIR_DOMAIN_JOB_STATS_COMPLETED;
 
+    if (vshCommandOptBool(cmd, "keep-completed"))
+        flags |= VIR_DOMAIN_JOB_STATS_KEEP_COMPLETED;
+
     memset(&info, 0, sizeof(info));
 
     rc = virDomainGetJobStats(dom, &info.type, &params, &nparams, flags);
index 2dce4493cb93c71b669fdad1bf9cf63c0354390b..59743a5aa40a5bda97175dd8a73d0c964d7328e8 100644 (file)
@@ -1380,12 +1380,13 @@ Returns basic information about the domain.
 
 Abort the currently running domain job.
 
-=item B<domjobinfo> I<domain> [I<--completed>]
+=item B<domjobinfo> I<domain> [I<--completed> [I<--keep-completed>]]
 
 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 or when libvirtd
-is restarted. Note that time information returned for completed
+a completed job are automatically destroyed once read (unless
+I<--keep-completed> is used) or when libvirtd is restarted.
+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
 on both of them).