[PATCH 11/11] Report auto convergence throttle rate in migration stats

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

 



Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
---
 include/libvirt/libvirt-domain.h | 8 ++++++++
 src/qemu/qemu_domain.c           | 6 ++++++
 src/qemu/qemu_migration.c        | 6 ++++++
 src/qemu/qemu_monitor.h          | 2 ++
 src/qemu/qemu_monitor_json.c     | 3 +++
 tools/virsh-domain.c             | 9 +++++++++
 6 files changed, 34 insertions(+)

diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index 0ca621b..5f41602 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -2985,6 +2985,14 @@ int virDomainAbortJob(virDomainPtr dom);
  */
 # define VIR_DOMAIN_JOB_COMPRESSION_OVERFLOW     "compression_overflow"
 
+/**
+ * VIR_DOMAIN_JOB_AUTO_CONVERGE_THROTTLE:
+ *
+ * virDomainGetJobStats field: current percentage guest CPUs are throttled
+ * to when auto-convergence decided migration was not converging, as
+ * VIR_TYPED_PARAM_INT.
+ */
+# define VIR_DOMAIN_JOB_AUTO_CONVERGE_THROTTLE  "auto_converge_throttle"
 
 
 /**
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 29f6b93..ab20e52 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -458,6 +458,12 @@ qemuDomainJobInfoToParams(qemuDomainJobInfoPtr jobInfo,
             goto error;
     }
 
+    if (stats->cpu_throttle_percentage &&
+        virTypedParamsAddInt(&par, &npar, &maxpar,
+                             VIR_DOMAIN_JOB_AUTO_CONVERGE_THROTTLE,
+                             stats->cpu_throttle_percentage) < 0)
+        goto error;
+
     *type = jobInfo->type;
     *params = par;
     *nparams = npar;
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index b26f363..c411dab 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -807,6 +807,10 @@ qemuMigrationCookieStatisticsXMLFormat(virBufferPtr buf,
                           stats->xbzrle_overflow);
     }
 
+    virBufferAsprintf(buf, "<%1$s>%2$d</%1$s>\n",
+                      VIR_DOMAIN_JOB_AUTO_CONVERGE_THROTTLE,
+                      stats->cpu_throttle_percentage);
+
     virBufferAdjustIndent(buf, -2);
     virBufferAddLit(buf, "</statistics>\n");
 }
@@ -1152,6 +1156,8 @@ qemuMigrationCookieStatisticsXMLParse(xmlXPathContextPtr ctxt)
     virXPathULongLong("string(./" VIR_DOMAIN_JOB_COMPRESSION_OVERFLOW "[1])",
                       ctxt, &stats->xbzrle_overflow);
 
+    virXPathInt("string(./" VIR_DOMAIN_JOB_AUTO_CONVERGE_THROTTLE "[1])",
+                ctxt, &stats->cpu_throttle_percentage);
  cleanup:
     ctxt->node = save_ctxt;
     return jobInfo;
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 6fecca7..cb4cca8 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -562,6 +562,8 @@ struct _qemuMonitorMigrationStats {
     unsigned long long xbzrle_pages;
     unsigned long long xbzrle_cache_miss;
     unsigned long long xbzrle_overflow;
+
+    int cpu_throttle_percentage;
 };
 
 int qemuMonitorGetMigrationStats(qemuMonitorPtr mon,
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 66b9c4c..bb426dc 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -2673,6 +2673,9 @@ qemuMonitorJSONGetMigrationStatsReply(virJSONValuePtr reply,
                                          &stats->setup_time) == 0)
         stats->setup_time_set = true;
 
+    ignore_value(virJSONValueObjectGetNumberInt(ret, "cpu-throttle-percentage",
+                                                &stats->cpu_throttle_percentage));
+
     switch ((qemuMonitorMigrationStatus) stats->status) {
     case QEMU_MONITOR_MIGRATION_STATUS_INACTIVE:
     case QEMU_MONITOR_MIGRATION_STATUS_SETUP:
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index f4d1156..81b1956 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -5759,6 +5759,7 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd)
     int nparams = 0;
     unsigned long long value;
     unsigned int flags = 0;
+    int ivalue;
     int rc;
 
     if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
@@ -5994,6 +5995,14 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd)
         vshPrint(ctl, "%-17s %-13llu\n", _("Compression overflows:"), value);
     }
 
+    if ((rc = virTypedParamsGetInt(params, nparams,
+                                   VIR_DOMAIN_JOB_AUTO_CONVERGE_THROTTLE,
+                                   &ivalue)) < 0) {
+        goto save_error;
+    } else if (rc) {
+        vshPrint(ctl, "%-17s %-13d\n", _("Auto converge throttle:"), ivalue);
+    }
+
     ret = true;
 
  cleanup:
-- 
2.9.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]