Report auto convergence throttle rate in migration stats

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
Jiri Denemark 2016-06-21 13:40:33 +02:00
parent 445853e1ba
commit d85c3a5451
6 changed files with 34 additions and 0 deletions

View File

@ -2985,6 +2985,14 @@ int virDomainAbortJob(virDomainPtr dom);
*/ */
# define VIR_DOMAIN_JOB_COMPRESSION_OVERFLOW "compression_overflow" # 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"
/** /**

View File

@ -458,6 +458,12 @@ qemuDomainJobInfoToParams(qemuDomainJobInfoPtr jobInfo,
goto error; 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; *type = jobInfo->type;
*params = par; *params = par;
*nparams = npar; *nparams = npar;

View File

@ -807,6 +807,10 @@ qemuMigrationCookieStatisticsXMLFormat(virBufferPtr buf,
stats->xbzrle_overflow); 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); virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, "</statistics>\n"); virBufferAddLit(buf, "</statistics>\n");
} }
@ -1152,6 +1156,8 @@ qemuMigrationCookieStatisticsXMLParse(xmlXPathContextPtr ctxt)
virXPathULongLong("string(./" VIR_DOMAIN_JOB_COMPRESSION_OVERFLOW "[1])", virXPathULongLong("string(./" VIR_DOMAIN_JOB_COMPRESSION_OVERFLOW "[1])",
ctxt, &stats->xbzrle_overflow); ctxt, &stats->xbzrle_overflow);
virXPathInt("string(./" VIR_DOMAIN_JOB_AUTO_CONVERGE_THROTTLE "[1])",
ctxt, &stats->cpu_throttle_percentage);
cleanup: cleanup:
ctxt->node = save_ctxt; ctxt->node = save_ctxt;
return jobInfo; return jobInfo;

View File

@ -562,6 +562,8 @@ struct _qemuMonitorMigrationStats {
unsigned long long xbzrle_pages; unsigned long long xbzrle_pages;
unsigned long long xbzrle_cache_miss; unsigned long long xbzrle_cache_miss;
unsigned long long xbzrle_overflow; unsigned long long xbzrle_overflow;
int cpu_throttle_percentage;
}; };
int qemuMonitorGetMigrationStats(qemuMonitorPtr mon, int qemuMonitorGetMigrationStats(qemuMonitorPtr mon,

View File

@ -2673,6 +2673,9 @@ qemuMonitorJSONGetMigrationStatsReply(virJSONValuePtr reply,
&stats->setup_time) == 0) &stats->setup_time) == 0)
stats->setup_time_set = true; stats->setup_time_set = true;
ignore_value(virJSONValueObjectGetNumberInt(ret, "cpu-throttle-percentage",
&stats->cpu_throttle_percentage));
switch ((qemuMonitorMigrationStatus) stats->status) { switch ((qemuMonitorMigrationStatus) stats->status) {
case QEMU_MONITOR_MIGRATION_STATUS_INACTIVE: case QEMU_MONITOR_MIGRATION_STATUS_INACTIVE:
case QEMU_MONITOR_MIGRATION_STATUS_SETUP: case QEMU_MONITOR_MIGRATION_STATUS_SETUP:

View File

@ -5759,6 +5759,7 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd)
int nparams = 0; int nparams = 0;
unsigned long long value; unsigned long long value;
unsigned int flags = 0; unsigned int flags = 0;
int ivalue;
int rc; int rc;
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL))) if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
@ -5994,6 +5995,14 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd)
vshPrint(ctl, "%-17s %-13llu\n", _("Compression overflows:"), value); 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; ret = true;
cleanup: cleanup: