Re: [PATCH 03/14] Introduce virDomainGetJobStats API

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

 



On 02/19/13 13:35, Jiri Denemark wrote:
This is an extensible version of virDomainGetJobInfo.
---
  include/libvirt/libvirt.h.in | 205 +++++++++++++++++++++++++++++++++++++++++++
  python/generator.py          |   1 +
  src/driver.h                 |   7 ++
  src/libvirt.c                |  58 ++++++++++++
  src/libvirt_public.syms      |   1 +
  5 files changed, 272 insertions(+)

diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index eda9e12..9d1c6ea 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -3945,9 +3945,214 @@ struct _virDomainJobInfo {

...

+/**
+ * VIR_DOMAIN_JOB_DISK_PROCESSED:
+ *
+ * virDomainGetJobStats field: as VIR_DOMAIN_JOB_DATA_PROCESSED but only
+ * tracking guest memory progress, as VIR_TYPED_PARAM_ULLONG.

s/memory/disk/

+ *
+ * This field corresponds to fileProcessed field in virDomainJobInfo.
+ */
+#define VIR_DOMAIN_JOB_DISK_PROCESSED           "disk_processed"
+
+/**
+ * VIR_DOMAIN_JOB_DISK_REMAINING:
+ *
+ * virDomainGetJobStats field: as VIR_DOMAIN_JOB_DATA_REMAINING but only
+ * tracking guest memory progress, as VIR_TYPED_PARAM_ULLONG.

s/memory/disk/

+ *
+ * This field corresponds to fileRemaining field in virDomainJobInfo.
+ */
+#define VIR_DOMAIN_JOB_DISK_REMAINING           "disk_remaining"
+
+/**
+ * VIR_DOMAIN_JOB_COMPRESSION_CACHE:
+ *
+ * virDomainGetJobStats field: size of the cache (in bytes) used for
+ * compressing repeatedly transferred memory pages during live migration,
+ * as VIR_TYPED_PARAM_ULLONG.
+ */
+#define VIR_DOMAIN_JOB_COMPRESSION_CACHE        "compression_cache"
+
+/**
+ * VIR_DOMAIN_JOB_COMPRESSION_BYTES:
+ *
+ * virDomainGetJobStats field: number of compressed bytes transferred
+ * since the beginning of migration, as VIR_TYPED_PARAM_ULLONG.
+ */
+#define VIR_DOMAIN_JOB_COMPRESSION_BYTES        "compression_bytes"
+
+/**
+ * VIR_DOMAIN_JOB_COMPRESSION_PAGES:
+ *
+ * virDomainGetJobStats field: number of compressed pages transferred
+ * since the beginning of migration, as VIR_TYPED_PARAM_ULLONG.
+ */
+#define VIR_DOMAIN_JOB_COMPRESSION_PAGES        "compression_pages"
+
+/**
+ * VIR_DOMAIN_JOB_COMPRESSION_CACHE_MISSES:
+ *
+ * virDomainGetJobStats field: number of repeatedly changing pages that
+ * were not found in compression cache and thus could not be compressed,
+ * as VIR_TYPED_PARAM_ULLONG.
+ */

This field and those above are a bit too XBZRLE specific although try to be general. But it doesn't bother me more than writing this.

+#define VIR_DOMAIN_JOB_COMPRESSION_CACHE_MISSES "compression_cache_misses"
+
+/**
+ * VIR_DOMAIN_JOB_COMPRESSION_OVERFLOW:
+ *
+ * virDomainGetJobStats field: number of repeatedly changing pages that
+ * were found in compression cache but were sent uncompressed because
+ * the result of compression was larger than the original page as a whole,
+ * as VIR_TYPED_PARAM_ULLONG.
+ */
+#define VIR_DOMAIN_JOB_COMPRESSION_OVERFLOW     "compression_overflow"
+
+
+/**
   * virDomainSnapshot:
   *
   * a virDomainSnapshot is a private structure representing a snapshot of

...

diff --git a/src/libvirt.c b/src/libvirt.c
index 1e78500..3611839 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -17399,6 +17399,64 @@ error:


  /**
+ * virDomainGetJobStats:
+ * @domain: a domain object
+ * @type: where to store the job type (one of virDomainJobType)
+ * @params: where to store job statistics
+ * @nparams: number of items in @params
+ * @flags: extra flags; not used yet, so callers should always pass 0
+ *
+ * Extract information about progress of a background job on a domain.
+ * Will return an error if the domain is not active. The function returns
+ * a superset of progress information provided by virDomainGetJobInfo.
+ * Possible fields returned in @params are defined by VIR_DOMAIN_JOB_*
+ * macros.

Possibly worth mentioning that newer daemon when used with older client may return some fields unknown by the client.

+ *
+ * Returns 0 in case of success and -1 in case of failure.
+ */
+int
+virDomainGetJobStats(virDomainPtr domain,
+                     int *type,
+                     virTypedParameterPtr *params,
+                     int *nparams,
+                     unsigned int flags)

...

diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms
index 3bdfd57..361408f 100644
--- a/src/libvirt_public.syms
+++ b/src/libvirt_public.syms
@@ -605,6 +605,7 @@ LIBVIRT_1.0.2 {

  LIBVIRT_1.0.3 {

Hopefully you won't need to change this.

      global:
+        virDomainGetJobStats;
          virNodeDeviceLookupSCSIHostByWWN;
  } LIBVIRT_1.0.2;



ACK with the comments fixed.

Peter

--
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]