qemu: Add support for postcopy-requests migration statistics

QEMU can report how many times during post-copy migration the domain
running on the destination host tried to access a page which has not
been migrated yet.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Jiri Denemark 2018-11-15 15:25:46 +01:00
parent 07c9d6601d
commit 3f4914e03c
6 changed files with 30 additions and 1 deletions

View File

@ -3422,6 +3422,16 @@ typedef enum {
*/
# define VIR_DOMAIN_JOB_MEMORY_ITERATION "memory_iteration"
/**
* VIR_DOMAIN_JOB_MEMORY_POSTCOPY_REQS:
*
* virDomainGetJobStats field: number page requests received from the
* destination host during post-copy migration, as VIR_TYPED_PARAM_ULLONG.
* This counter is incremented whenever the migrated domain tries to access
* a memory page which has not been transferred from the source host yet.
*/
# define VIR_DOMAIN_JOB_MEMORY_POSTCOPY_REQS "memory_postcopy_requests"
/**
* VIR_DOMAIN_JOB_DISK_TOTAL:
*

View File

@ -607,7 +607,10 @@ qemuDomainMigrationJobInfoToParams(qemuDomainJobInfoPtr jobInfo,
stats->ram_dirty_rate) < 0 ||
virTypedParamsAddULLong(&par, &npar, &maxpar,
VIR_DOMAIN_JOB_MEMORY_ITERATION,
stats->ram_iteration) < 0)
stats->ram_iteration) < 0 ||
virTypedParamsAddULLong(&par, &npar, &maxpar,
VIR_DOMAIN_JOB_MEMORY_POSTCOPY_REQS,
stats->ram_postcopy_reqs) < 0)
goto error;
if (stats->ram_page_size > 0 &&

View File

@ -703,6 +703,9 @@ qemuMigrationCookieStatisticsXMLFormat(virBufferPtr buf,
virBufferAsprintf(buf, "<%1$s>%2$llu</%1$s>\n",
VIR_DOMAIN_JOB_MEMORY_ITERATION,
stats->ram_iteration);
virBufferAsprintf(buf, "<%1$s>%2$llu</%1$s>\n",
VIR_DOMAIN_JOB_MEMORY_POSTCOPY_REQS,
stats->ram_postcopy_reqs);
virBufferAsprintf(buf, "<%1$s>%2$llu</%1$s>\n",
VIR_DOMAIN_JOB_MEMORY_PAGE_SIZE,
@ -1102,6 +1105,8 @@ qemuMigrationCookieStatisticsXMLParse(xmlXPathContextPtr ctxt)
ctxt, &stats->ram_dirty_rate);
virXPathULongLong("string(./" VIR_DOMAIN_JOB_MEMORY_ITERATION "[1])",
ctxt, &stats->ram_iteration);
virXPathULongLong("string(./" VIR_DOMAIN_JOB_MEMORY_POSTCOPY_REQS "[1])",
ctxt, &stats->ram_postcopy_reqs);
virXPathULongLong("string(./" VIR_DOMAIN_JOB_MEMORY_PAGE_SIZE "[1])",
ctxt, &stats->ram_page_size);

View File

@ -703,6 +703,7 @@ struct _qemuMonitorMigrationStats {
unsigned long long ram_dirty_rate;
unsigned long long ram_page_size;
unsigned long long ram_iteration;
unsigned long long ram_postcopy_reqs;
unsigned long long disk_transferred;
unsigned long long disk_remaining;

View File

@ -3294,6 +3294,8 @@ qemuMonitorJSONGetMigrationStatsReply(virJSONValuePtr reply,
&stats->ram_page_size));
ignore_value(virJSONValueObjectGetNumberUlong(ram, "dirty-sync-count",
&stats->ram_iteration));
ignore_value(virJSONValueObjectGetNumberUlong(ram, "postcopy-requests",
&stats->ram_postcopy_reqs));
disk = virJSONValueObjectGetObject(ret, "disk");
if (disk) {

View File

@ -6233,6 +6233,14 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd)
} else if (rc) {
vshPrint(ctl, "%-17s %-12llu\n", _("Iteration:"), value);
}
if ((rc = virTypedParamsGetULLong(params, nparams,
VIR_DOMAIN_JOB_MEMORY_POSTCOPY_REQS,
&value)) < 0) {
goto save_error;
} else if (rc) {
vshPrint(ctl, "%-17s %-12llu\n", _("Postcopy requests:"), value);
}
}
if (info.fileTotal || info.fileRemaining || info.fileProcessed) {