[PATCH 2/9] api: Allow keeping completed domain job stats when reading them

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



virDomainGetJobStats destroys the completed statistics on the first
read. Give the user possibility to keep them around if they wish so.

Add a flag VIR_DOMAIN_JOB_STATS_COMPLETED_KEEP which will read the stats
without destroying them.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 include/libvirt/libvirt-domain.h | 2 ++
 src/libvirt-domain.c             | 6 +++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index a2f007568c..84b3cfdff7 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -3246,6 +3246,8 @@ struct _virDomainJobInfo {
 typedef enum {
     VIR_DOMAIN_JOB_STATS_COMPLETED = 1 << 0, /* return stats of a recently
                                               * completed job */
+    VIR_DOMAIN_JOB_STATS_COMPLETED_KEEP = 1 << 1, /* don't remove completed
+                                                     stats when reading them */
 } virDomainGetJobStatsFlags;

 int virDomainGetJobInfo(virDomainPtr dom,
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index 51fb79cddd..77169ec4ca 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -8796,7 +8796,8 @@ virDomainGetJobInfo(virDomainPtr domain, virDomainJobInfoPtr info)
  * flag may be used to query statistics of a completed incoming pre-copy
  * migration (statistics for post-copy migration are only available on the
  * source host). Statistics of a completed job are automatically destroyed
- * once read or when libvirtd is restarted. Note that time information
+ * once read (unless the VIR_DOMAIN_JOB_STATS_COMPLETED_KEEP is used as well)
+ * 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). The statistics of a completed job can also be
@@ -8823,6 +8824,9 @@ virDomainGetJobStats(virDomainPtr domain,
     virCheckNonNullArgGoto(type, error);
     virCheckNonNullArgGoto(params, error);
     virCheckNonNullArgGoto(nparams, error);
+    VIR_REQUIRE_FLAG_GOTO(VIR_DOMAIN_JOB_STATS_COMPLETED_KEEP,
+                          VIR_DOMAIN_JOB_STATS_COMPLETED,
+                          error);

     conn = domain->conn;

-- 
2.23.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux