The structure actually contains migration statistics rather than just
the status as the name suggests. Renaming it as
qemuMonitorMigrationStats removes the confusion.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/qemu/qemu_domain.c | 84 ++++++++++++++++++------------------
src/qemu/qemu_domain.h | 2 +-
src/qemu/qemu_driver.c | 2 +-
src/qemu/qemu_migration.c | 100 +++++++++++++++++++++----------------------
src/qemu/qemu_monitor.c | 8 ++--
src/qemu/qemu_monitor.h | 10 ++---
src/qemu/qemu_monitor_json.c | 74 ++++++++++++++++----------------
src/qemu/qemu_monitor_json.h | 4 +-
src/qemu/qemu_monitor_text.c | 40 ++++++++---------
src/qemu/qemu_monitor_text.h | 4 +-
src/qemu/qemu_process.c | 2 +-
tests/qemumonitorjsontest.c | 22 +++++-----
12 files changed, 176 insertions(+), 176 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 73fc79d..fb50c91 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -262,8 +262,8 @@ qemuDomainJobInfoUpdateDowntime(qemuDomainJobInfoPtr jobInfo)
return 0;
}
- jobInfo->status.downtime = now - jobInfo->stopped;
- jobInfo->status.downtime_set = true;
+ jobInfo->stats.downtime = now - jobInfo->stopped;
+ jobInfo->stats.downtime_set = true;
return 0;
}
@@ -275,13 +275,13 @@ qemuDomainJobInfoToInfo(qemuDomainJobInfoPtr jobInfo,
info->timeElapsed = jobInfo->timeElapsed;
info->timeRemaining = jobInfo->timeRemaining;
- info->memTotal = jobInfo->status.ram_total;
- info->memRemaining = jobInfo->status.ram_remaining;
- info->memProcessed = jobInfo->status.ram_transferred;
+ info->memTotal = jobInfo->stats.ram_total;
+ info->memRemaining = jobInfo->stats.ram_remaining;
+ info->memProcessed = jobInfo->stats.ram_transferred;
- info->fileTotal = jobInfo->status.disk_total;
- info->fileRemaining = jobInfo->status.disk_remaining;
- info->fileProcessed = jobInfo->status.disk_transferred;
+ info->fileTotal = jobInfo->stats.disk_total;
+ info->fileRemaining = jobInfo->stats.disk_remaining;
+ info->fileProcessed = jobInfo->stats.disk_transferred;
info->dataTotal = info->memTotal + info->fileTotal;
info->dataRemaining = info->memRemaining + info->fileRemaining;
@@ -296,7 +296,7 @@ qemuDomainJobInfoToParams(qemuDomainJobInfoPtr jobInfo,
virTypedParameterPtr *params,
int *nparams)
{
- qemuMonitorMigrationStatus *status = &jobInfo->status;
+ qemuMonitorMigrationStats *stats = &jobInfo->stats;
virTypedParameterPtr par = NULL;
int maxpar = 0;
int npar = 0;
@@ -319,103 +319,103 @@ qemuDomainJobInfoToParams(qemuDomainJobInfoPtr jobInfo,
jobInfo->timeRemaining) < 0)
goto error;
- if (status->downtime_set &&
+ if (stats->downtime_set &&
virTypedParamsAddULLong(&par, &npar, &maxpar,
VIR_DOMAIN_JOB_DOWNTIME,
- status->downtime) < 0)
+ stats->downtime) < 0)
goto error;
- if (status->downtime_set &&
+ if (stats->downtime_set &&
jobInfo->timeDeltaSet &&
- status->downtime > jobInfo->timeDelta &&
+ stats->downtime > jobInfo->timeDelta &&
virTypedParamsAddULLong(&par, &npar, &maxpar,
VIR_DOMAIN_JOB_DOWNTIME_NET,
- status->downtime - jobInfo->timeDelta) < 0)
+ stats->downtime - jobInfo->timeDelta) < 0)
goto error;
- if (status->setup_time_set &&
+ if (stats->setup_time_set &&
virTypedParamsAddULLong(&par, &npar, &maxpar,
VIR_DOMAIN_JOB_SETUP_TIME,
- status->setup_time) < 0)
+ stats->setup_time) < 0)
goto error;
if (virTypedParamsAddULLong(&par, &npar, &maxpar,
VIR_DOMAIN_JOB_DATA_TOTAL,
- status->ram_total +
- status->disk_total) < 0 ||
+ stats->ram_total +
+ stats->disk_total) < 0 ||
virTypedParamsAddULLong(&par, &npar, &maxpar,
VIR_DOMAIN_JOB_DATA_PROCESSED,
- status->ram_transferred +
- status->disk_transferred) < 0 ||
+ stats->ram_transferred +
+ stats->disk_transferred) < 0 ||
virTypedParamsAddULLong(&par, &npar, &maxpar,
VIR_DOMAIN_JOB_DATA_REMAINING,
- status->ram_remaining +
- status->disk_remaining) < 0)
+ stats->ram_remaining +
+ stats->disk_remaining) < 0)
goto error;
if (virTypedParamsAddULLong(&par, &npar, &maxpar,
VIR_DOMAIN_JOB_MEMORY_TOTAL,
- status->ram_total) < 0 ||
+ stats->ram_total) < 0 ||
virTypedParamsAddULLong(&par, &npar, &maxpar,
VIR_DOMAIN_JOB_MEMORY_PROCESSED,
- status->ram_transferred) < 0 ||
+ stats->ram_transferred) < 0 ||
virTypedParamsAddULLong(&par, &npar, &maxpar,
VIR_DOMAIN_JOB_MEMORY_REMAINING,
- status->ram_remaining) < 0)
+ stats->ram_remaining) < 0)
goto error;
- if (status->ram_bps &&
+ if (stats->ram_bps &&
virTypedParamsAddULLong(&par, &npar, &maxpar,
VIR_DOMAIN_JOB_MEMORY_BPS,
- status->ram_bps) < 0)
+ stats->ram_bps) < 0)
goto error;
- if (status->ram_duplicate_set) {
+ if (stats->ram_duplicate_set) {
if (virTypedParamsAddULLong(&par, &npar, &maxpar,
VIR_DOMAIN_JOB_MEMORY_CONSTANT,
- status->ram_duplicate) < 0 ||
+ stats->ram_duplicate) < 0 ||
virTypedParamsAddULLong(&par, &npar, &maxpar,
VIR_DOMAIN_JOB_MEMORY_NORMAL,
- status->ram_normal) < 0 ||
+ stats->ram_normal) < 0 ||
virTypedParamsAddULLong(&par, &npar, &maxpar,
VIR_DOMAIN_JOB_MEMORY_NORMAL_BYTES,
- status->ram_normal_bytes) < 0)
+ stats->ram_normal_bytes) < 0)
goto error;
}
if (virTypedParamsAddULLong(&par, &npar, &maxpar,
VIR_DOMAIN_JOB_DISK_TOTAL,
- status->disk_total) < 0 ||
+ stats->disk_total) < 0 ||
virTypedParamsAddULLong(&par, &npar, &maxpar,
VIR_DOMAIN_JOB_DISK_PROCESSED,
- status->disk_transferred) < 0 ||
+ stats->disk_transferred) < 0 ||
virTypedParamsAddULLong(&par, &npar, &maxpar,
VIR_DOMAIN_JOB_DISK_REMAINING,
- status->disk_remaining) < 0)
+ stats->disk_remaining) < 0)
goto error;
- if (status->disk_bps &&
+ if (stats->disk_bps &&
virTypedParamsAddULLong(&par, &npar, &maxpar,
VIR_DOMAIN_JOB_DISK_BPS,
- status->disk_bps) < 0)
+ stats->disk_bps) < 0)
goto error;
- if (status->xbzrle_set) {
+ if (stats->xbzrle_set) {
if (virTypedParamsAddULLong(&par, &npar, &maxpar,
VIR_DOMAIN_JOB_COMPRESSION_CACHE,
- status->xbzrle_cache_size) < 0 ||
+ stats->xbzrle_cache_size) < 0 ||
virTypedParamsAddULLong(&par, &npar, &maxpar,
VIR_DOMAIN_JOB_COMPRESSION_BYTES,
- status->xbzrle_bytes) < 0 ||
+ stats->xbzrle_bytes) < 0 ||
virTypedParamsAddULLong(&par, &npar, &maxpar,
VIR_DOMAIN_JOB_COMPRESSION_PAGES,
- status->xbzrle_pages) < 0 ||
+ stats->xbzrle_pages) < 0 ||
virTypedParamsAddULLong(&par, &npar, &maxpar,
VIR_DOMAIN_JOB_COMPRESSION_CACHE_MISSES,
- status->xbzrle_cache_miss) < 0 ||
+ stats->xbzrle_cache_miss) < 0 ||
virTypedParamsAddULLong(&par, &npar, &maxpar,
VIR_DOMAIN_JOB_COMPRESSION_OVERFLOW,
- status->xbzrle_overflow) < 0)
+ stats->xbzrle_overflow) < 0)
goto error;
}
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index cff48d7..82495dc 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -116,7 +116,7 @@ struct _qemuDomainJobInfo {
destination. */
bool timeDeltaSet;
/* Raw values from QEMU */
- qemuMonitorMigrationStatus status;
+ qemuMonitorMigrationStats stats;
};
struct qemuDomainJobObj {
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 39c2c05..89eae2a 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -13042,7 +13042,7 @@ qemuDomainGetJobStatsInternal(virQEMUDriverPtr driver,
fetch = false;
/* Do not ask QEMU if migration is not even running yet */
- if (!priv->job.current || !priv->job.current->status.status)
+ if (!priv->job.current || !priv->job.current->stats.status)
fetch = false;
if (fetch &&
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 6be11b4..855e0e0 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -699,7 +699,7 @@ static void
qemuMigrationCookieStatisticsXMLFormat(virBufferPtr buf,
qemuDomainJobInfoPtr jobInfo)
{
- qemuMonitorMigrationStatus *status = &jobInfo->status;
+ qemuMonitorMigrationStats *stats = &jobInfo->stats;
virBufferAddLit(buf, "<statistics>\n");
virBufferAdjustIndent(buf, 2);
@@ -716,69 +716,69 @@ qemuMigrationCookieStatisticsXMLFormat(virBufferPtr buf,
virBufferAsprintf(buf, "<%1$s>%2$llu</%1$s>\n",
VIR_DOMAIN_JOB_TIME_REMAINING,
jobInfo->timeRemaining);
- if (status->downtime_set)
+ if (stats->downtime_set)
virBufferAsprintf(buf, "<%1$s>%2$llu</%1$s>\n",
VIR_DOMAIN_JOB_DOWNTIME,
- status->downtime);
- if (status->setup_time_set)
+ stats->downtime);
+ if (stats->setup_time_set)
virBufferAsprintf(buf, "<%1$s>%2$llu</%1$s>\n",
VIR_DOMAIN_JOB_SETUP_TIME,
- status->setup_time);
+ stats->setup_time);
virBufferAsprintf(buf, "<%1$s>%2$llu</%1$s>\n",
VIR_DOMAIN_JOB_MEMORY_TOTAL,
- status->ram_total);
+ stats->ram_total);
virBufferAsprintf(buf, "<%1$s>%2$llu</%1$s>\n",
VIR_DOMAIN_JOB_MEMORY_PROCESSED,
- status->ram_transferred);
+ stats->ram_transferred);
virBufferAsprintf(buf, "<%1$s>%2$llu</%1$s>\n",
VIR_DOMAIN_JOB_MEMORY_REMAINING,
- status->ram_remaining);
+ stats->ram_remaining);
virBufferAsprintf(buf, "<%1$s>%2$llu</%1$s>\n",
VIR_DOMAIN_JOB_MEMORY_BPS,
- status->ram_bps);
+ stats->ram_bps);
- if (status->ram_duplicate_set) {
+ if (stats->ram_duplicate_set) {
virBufferAsprintf(buf, "<%1$s>%2$llu</%1$s>\n",
VIR_DOMAIN_JOB_MEMORY_CONSTANT,
- status->ram_duplicate);
+ stats->ram_duplicate);
virBufferAsprintf(buf, "<%1$s>%2$llu</%1$s>\n",
VIR_DOMAIN_JOB_MEMORY_NORMAL,
- status->ram_normal);
+ stats->ram_normal);
virBufferAsprintf(buf, "<%1$s>%2$llu</%1$s>\n",
VIR_DOMAIN_JOB_MEMORY_NORMAL_BYTES,
- status->ram_normal_bytes);
+ stats->ram_normal_bytes);
}
virBufferAsprintf(buf, "<%1$s>%2$llu</%1$s>\n",
VIR_DOMAIN_JOB_DISK_TOTAL,
- status->disk_total);
+ stats->disk_total);
virBufferAsprintf(buf, "<%1$s>%2$llu</%1$s>\n",
VIR_DOMAIN_JOB_DISK_PROCESSED,
- status->disk_transferred);
+ stats->disk_transferred);
virBufferAsprintf(buf, "<%1$s>%2$llu</%1$s>\n",
VIR_DOMAIN_JOB_DISK_REMAINING,
- status->disk_remaining);
+ stats->disk_remaining);
virBufferAsprintf(buf, "<%1$s>%2$llu</%1$s>\n",
VIR_DOMAIN_JOB_DISK_BPS,
- status->disk_bps);
+ stats->disk_bps);
- if (status->xbzrle_set) {
+ if (stats->xbzrle_set) {
virBufferAsprintf(buf, "<%1$s>%2$llu</%1$s>\n",
VIR_DOMAIN_JOB_COMPRESSION_CACHE,
- status->xbzrle_cache_size);
+ stats->xbzrle_cache_size);
virBufferAsprintf(buf, "<%1$s>%2$llu</%1$s>\n",
VIR_DOMAIN_JOB_COMPRESSION_BYTES,
- status->xbzrle_bytes);
+ stats->xbzrle_bytes);
virBufferAsprintf(buf, "<%1$s>%2$llu</%1$s>\n",
VIR_DOMAIN_JOB_COMPRESSION_PAGES,
- status->xbzrle_pages);
+ stats->xbzrle_pages);
virBufferAsprintf(buf, "<%1$s>%2$llu</%1$s>\n",
VIR_DOMAIN_JOB_COMPRESSION_CACHE_MISSES,
- status->xbzrle_cache_miss);
+ stats->xbzrle_cache_miss);
virBufferAsprintf(buf, "<%1$s>%2$llu</%1$s>\n",
VIR_DOMAIN_JOB_COMPRESSION_OVERFLOW,
- status->xbzrle_overflow);
+ stats->xbzrle_overflow);
}
virBufferAdjustIndent(buf, -2);
@@ -1053,7 +1053,7 @@ static qemuDomainJobInfoPtr
qemuMigrationCookieStatisticsXMLParse(xmlXPathContextPtr ctxt)
{
qemuDomainJobInfoPtr jobInfo = NULL;
- qemuMonitorMigrationStatus *status;
+ qemuMonitorMigrationStats *stats;
xmlNodePtr save_ctxt = ctxt->node;
if (!(ctxt->node = virXPathNode("./statistics", ctxt)))
@@ -1062,7 +1062,7 @@ qemuMigrationCookieStatisticsXMLParse(xmlXPathContextPtr ctxt)
if (VIR_ALLOC(jobInfo) < 0)
goto cleanup;
- status = &jobInfo->status;
+ stats = &jobInfo->stats;
jobInfo->type = VIR_DOMAIN_JOB_COMPLETED;
virXPathULongLong("string(./started[1])", ctxt, &jobInfo->started);
@@ -1077,49 +1077,49 @@ qemuMigrationCookieStatisticsXMLParse(xmlXPathContextPtr ctxt)
ctxt, &jobInfo->timeRemaining);
if (virXPathULongLong("string(./" VIR_DOMAIN_JOB_DOWNTIME
"[1])",
- ctxt, &status->downtime) == 0)
- status->downtime_set = true;
+ ctxt, &stats->downtime) == 0)
+ stats->downtime_set = true;
if (virXPathULongLong("string(./" VIR_DOMAIN_JOB_SETUP_TIME
"[1])",
- ctxt, &status->setup_time) == 0)
- status->setup_time_set = true;
+ ctxt, &stats->setup_time) == 0)
+ stats->setup_time_set = true;
virXPathULongLong("string(./" VIR_DOMAIN_JOB_MEMORY_TOTAL
"[1])",
- ctxt, &status->ram_total);
+ ctxt, &stats->ram_total);
virXPathULongLong("string(./" VIR_DOMAIN_JOB_MEMORY_PROCESSED
"[1])",
- ctxt, &status->ram_transferred);
+ ctxt, &stats->ram_transferred);
virXPathULongLong("string(./" VIR_DOMAIN_JOB_MEMORY_REMAINING
"[1])",
- ctxt, &status->ram_remaining);
+ ctxt, &stats->ram_remaining);
virXPathULongLong("string(./" VIR_DOMAIN_JOB_MEMORY_BPS "[1])",
- ctxt, &status->ram_bps);
+ ctxt, &stats->ram_bps);
if (virXPathULongLong("string(./" VIR_DOMAIN_JOB_MEMORY_CONSTANT
"[1])",
- ctxt, &status->ram_duplicate) == 0)
- status->ram_duplicate_set = true;
+ ctxt, &stats->ram_duplicate) == 0)
+ stats->ram_duplicate_set = true;
virXPathULongLong("string(./" VIR_DOMAIN_JOB_MEMORY_NORMAL
"[1])",
- ctxt, &status->ram_normal);
+ ctxt, &stats->ram_normal);
virXPathULongLong("string(./" VIR_DOMAIN_JOB_MEMORY_NORMAL_BYTES
"[1])",
- ctxt, &status->ram_normal_bytes);
+ ctxt, &stats->ram_normal_bytes);
virXPathULongLong("string(./" VIR_DOMAIN_JOB_DISK_TOTAL "[1])",
- ctxt, &status->disk_total);
+ ctxt, &stats->disk_total);
virXPathULongLong("string(./" VIR_DOMAIN_JOB_DISK_PROCESSED
"[1])",
- ctxt, &status->disk_transferred);
+ ctxt, &stats->disk_transferred);
virXPathULongLong("string(./" VIR_DOMAIN_JOB_DISK_REMAINING
"[1])",
- ctxt, &status->disk_remaining);
+ ctxt, &stats->disk_remaining);
virXPathULongLong("string(./" VIR_DOMAIN_JOB_DISK_BPS "[1])",
- ctxt, &status->disk_bps);
+ ctxt, &stats->disk_bps);
if (virXPathULongLong("string(./" VIR_DOMAIN_JOB_COMPRESSION_CACHE
"[1])",
- ctxt, &status->xbzrle_cache_size) == 0)
- status->xbzrle_set = true;
+ ctxt, &stats->xbzrle_cache_size) == 0)
+ stats->xbzrle_set = true;
virXPathULongLong("string(./" VIR_DOMAIN_JOB_COMPRESSION_BYTES
"[1])",
- ctxt, &status->xbzrle_bytes);
+ ctxt, &stats->xbzrle_bytes);
virXPathULongLong("string(./" VIR_DOMAIN_JOB_COMPRESSION_PAGES
"[1])",
- ctxt, &status->xbzrle_pages);
+ ctxt, &stats->xbzrle_pages);
virXPathULongLong("string(./" VIR_DOMAIN_JOB_COMPRESSION_CACHE_MISSES
"[1])",
- ctxt, &status->xbzrle_cache_miss);
+ ctxt, &stats->xbzrle_cache_miss);
virXPathULongLong("string(./" VIR_DOMAIN_JOB_COMPRESSION_OVERFLOW
"[1])",
- ctxt, &status->xbzrle_overflow);
+ ctxt, &stats->xbzrle_overflow);
cleanup:
ctxt->node = save_ctxt;
@@ -2518,7 +2518,7 @@ qemuMigrationWaitForSpice(virDomainObjPtr vm)
static void
qemuMigrationUpdateJobType(qemuDomainJobInfoPtr jobInfo)
{
- switch (jobInfo->status.status) {
+ switch (jobInfo->stats.status) {
case QEMU_MONITOR_MIGRATION_STATUS_COMPLETED:
jobInfo->type = VIR_DOMAIN_JOB_COMPLETED;
break;
@@ -2555,8 +2555,8 @@ qemuMigrationFetchJobStatus(virQEMUDriverPtr driver,
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
return -1;
- memset(&jobInfo->status, 0, sizeof(jobInfo->status));
- rv = qemuMonitorGetMigrationStatus(priv->mon, &jobInfo->status);
+ memset(&jobInfo->stats, 0, sizeof(jobInfo->stats));
+ rv = qemuMonitorGetMigrationStats(priv->mon, &jobInfo->stats);
if (qemuDomainObjExitMonitor(driver, vm) < 0 || rv < 0)
return -1;
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 249a25e..6fd08b6 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -2103,15 +2103,15 @@ qemuMonitorSetMigrationCacheSize(qemuMonitorPtr mon,
int
-qemuMonitorGetMigrationStatus(qemuMonitorPtr mon,
- qemuMonitorMigrationStatusPtr status)
+qemuMonitorGetMigrationStats(qemuMonitorPtr mon,
+ qemuMonitorMigrationStatsPtr stats)
{
QEMU_CHECK_MONITOR(mon);
if (mon->json)
- return qemuMonitorJSONGetMigrationStatus(mon, status);
+ return qemuMonitorJSONGetMigrationStats(mon, stats);
else
- return qemuMonitorTextGetMigrationStatus(mon, status);
+ return qemuMonitorTextGetMigrationStats(mon, stats);
}
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 84e51cd..27ff169 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -469,9 +469,9 @@ enum {
VIR_ENUM_DECL(qemuMonitorMigrationStatus)
-typedef struct _qemuMonitorMigrationStatus qemuMonitorMigrationStatus;
-typedef qemuMonitorMigrationStatus *qemuMonitorMigrationStatusPtr;
-struct _qemuMonitorMigrationStatus {
+typedef struct _qemuMonitorMigrationStats qemuMonitorMigrationStats;
+typedef qemuMonitorMigrationStats *qemuMonitorMigrationStatsPtr;
+struct _qemuMonitorMigrationStats {
int status;
unsigned long long total_time;
/* total or expected depending on status */
@@ -507,8 +507,8 @@ struct _qemuMonitorMigrationStatus {
unsigned long long xbzrle_overflow;
};
-int qemuMonitorGetMigrationStatus(qemuMonitorPtr mon,
- qemuMonitorMigrationStatusPtr status);
+int qemuMonitorGetMigrationStats(qemuMonitorPtr mon,
+ qemuMonitorMigrationStatsPtr stats);
typedef enum {
QEMU_MONITOR_MIGRATION_CAPS_XBZRLE,
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index d4b6514..2d3b358 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -2421,8 +2421,8 @@ qemuMonitorJSONSetMigrationCacheSize(qemuMonitorPtr mon,
static int
-qemuMonitorJSONGetMigrationStatusReply(virJSONValuePtr reply,
- qemuMonitorMigrationStatusPtr status)
+qemuMonitorJSONGetMigrationStatsReply(virJSONValuePtr reply,
+ qemuMonitorMigrationStatsPtr stats)
{
virJSONValuePtr ret;
const char *statusstr;
@@ -2441,32 +2441,32 @@ qemuMonitorJSONGetMigrationStatusReply(virJSONValuePtr reply,
return -1;
}
- status->status = qemuMonitorMigrationStatusTypeFromString(statusstr);
- if (status->status < 0) {
+ stats->status = qemuMonitorMigrationStatusTypeFromString(statusstr);
+ if (stats->status < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected migration status in %s"), statusstr);
return -1;
}
ignore_value(virJSONValueObjectGetNumberUlong(ret, "total-time",
- &status->total_time));
- if (status->status == QEMU_MONITOR_MIGRATION_STATUS_COMPLETED) {
+ &stats->total_time));
+ if (stats->status == QEMU_MONITOR_MIGRATION_STATUS_COMPLETED) {
rc = virJSONValueObjectGetNumberUlong(ret, "downtime",
- &status->downtime);
+ &stats->downtime);
} else {
rc = virJSONValueObjectGetNumberUlong(ret, "expected-downtime",
- &status->downtime);
+ &stats->downtime);
}
if (rc == 0)
- status->downtime_set = true;
+ stats->downtime_set = true;
if (virJSONValueObjectGetNumberUlong(ret, "setup-time",
- &status->setup_time) == 0)
- status->setup_time_set = true;
+ &stats->setup_time) == 0)
+ stats->setup_time_set = true;
- if (status->status == QEMU_MONITOR_MIGRATION_STATUS_ACTIVE ||
- status->status == QEMU_MONITOR_MIGRATION_STATUS_CANCELLING ||
- status->status == QEMU_MONITOR_MIGRATION_STATUS_COMPLETED) {
+ if (stats->status == QEMU_MONITOR_MIGRATION_STATUS_ACTIVE ||
+ stats->status == QEMU_MONITOR_MIGRATION_STATUS_CANCELLING ||
+ stats->status == QEMU_MONITOR_MIGRATION_STATUS_COMPLETED) {
virJSONValuePtr ram = virJSONValueObjectGetObject(ret, "ram");
if (!ram) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -2475,21 +2475,21 @@ qemuMonitorJSONGetMigrationStatusReply(virJSONValuePtr reply,
}
if (virJSONValueObjectGetNumberUlong(ram, "transferred",
- &status->ram_transferred) < 0) {
+ &stats->ram_transferred) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("migration was active, but RAM 'transferred'
"
"data was missing"));
return -1;
}
if (virJSONValueObjectGetNumberUlong(ram, "remaining",
- &status->ram_remaining) < 0) {
+ &stats->ram_remaining) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("migration was active, but RAM 'remaining'
"
"data was missing"));
return -1;
}
if (virJSONValueObjectGetNumberUlong(ram, "total",
- &status->ram_total) < 0) {
+ &stats->ram_total) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("migration was active, but RAM 'total' "
"data was missing"));
@@ -2499,21 +2499,21 @@ qemuMonitorJSONGetMigrationStatusReply(virJSONValuePtr reply,
if (virJSONValueObjectGetNumberDouble(ram, "mbps", &mbps) == 0
&&
mbps > 0) {
/* mpbs from QEMU reports Mbits/s (M as in 10^6 not Mi as 2^20) */
- status->ram_bps = mbps * (1000 * 1000 / 8);
+ stats->ram_bps = mbps * (1000 * 1000 / 8);
}
if (virJSONValueObjectGetNumberUlong(ram, "duplicate",
- &status->ram_duplicate) == 0)
- status->ram_duplicate_set = true;
+ &stats->ram_duplicate) == 0)
+ stats->ram_duplicate_set = true;
ignore_value(virJSONValueObjectGetNumberUlong(ram, "normal",
- &status->ram_normal));
+ &stats->ram_normal));
ignore_value(virJSONValueObjectGetNumberUlong(ram, "normal-bytes",
-
&status->ram_normal_bytes));
+ &stats->ram_normal_bytes));
virJSONValuePtr disk = virJSONValueObjectGetObject(ret, "disk");
if (disk) {
rc = virJSONValueObjectGetNumberUlong(disk, "transferred",
- &status->disk_transferred);
+ &stats->disk_transferred);
if (rc < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("disk migration was active, but "
@@ -2522,7 +2522,7 @@ qemuMonitorJSONGetMigrationStatusReply(virJSONValuePtr reply,
}
rc = virJSONValueObjectGetNumberUlong(disk, "remaining",
- &status->disk_remaining);
+ &stats->disk_remaining);
if (rc < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("disk migration was active, but 'remaining'
"
@@ -2531,7 +2531,7 @@ qemuMonitorJSONGetMigrationStatusReply(virJSONValuePtr reply,
}
rc = virJSONValueObjectGetNumberUlong(disk, "total",
- &status->disk_total);
+ &stats->disk_total);
if (rc < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("disk migration was active, but 'total'
"
@@ -2542,15 +2542,15 @@ qemuMonitorJSONGetMigrationStatusReply(virJSONValuePtr reply,
if (virJSONValueObjectGetNumberDouble(disk, "mbps", &mbps) == 0
&&
mbps > 0) {
/* mpbs from QEMU reports Mbits/s (M as in 10^6 not Mi as 2^20) */
- status->disk_bps = mbps * (1000 * 1000 / 8);
+ stats->disk_bps = mbps * (1000 * 1000 / 8);
}
}
virJSONValuePtr comp = virJSONValueObjectGetObject(ret,
"xbzrle-cache");
if (comp) {
- status->xbzrle_set = true;
+ stats->xbzrle_set = true;
rc = virJSONValueObjectGetNumberUlong(comp, "cache-size",
- &status->xbzrle_cache_size);
+ &stats->xbzrle_cache_size);
if (rc < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("XBZRLE is active, but 'cache-size' data
"
@@ -2559,7 +2559,7 @@ qemuMonitorJSONGetMigrationStatusReply(virJSONValuePtr reply,
}
rc = virJSONValueObjectGetNumberUlong(comp, "bytes",
- &status->xbzrle_bytes);
+ &stats->xbzrle_bytes);
if (rc < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("XBZRLE is active, but 'bytes' data "
@@ -2568,7 +2568,7 @@ qemuMonitorJSONGetMigrationStatusReply(virJSONValuePtr reply,
}
rc = virJSONValueObjectGetNumberUlong(comp, "pages",
- &status->xbzrle_pages);
+ &stats->xbzrle_pages);
if (rc < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("XBZRLE is active, but 'pages' data "
@@ -2577,7 +2577,7 @@ qemuMonitorJSONGetMigrationStatusReply(virJSONValuePtr reply,
}
rc = virJSONValueObjectGetNumberUlong(comp, "cache-miss",
- &status->xbzrle_cache_miss);
+ &stats->xbzrle_cache_miss);
if (rc < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("XBZRLE is active, but 'cache-miss' data
"
@@ -2586,7 +2586,7 @@ qemuMonitorJSONGetMigrationStatusReply(virJSONValuePtr reply,
}
rc = virJSONValueObjectGetNumberUlong(comp, "overflow",
- &status->xbzrle_overflow);
+ &stats->xbzrle_overflow);
if (rc < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("XBZRLE is active, but 'overflow' data
"
@@ -2600,15 +2600,15 @@ qemuMonitorJSONGetMigrationStatusReply(virJSONValuePtr reply,
}
-int qemuMonitorJSONGetMigrationStatus(qemuMonitorPtr mon,
- qemuMonitorMigrationStatusPtr status)
+int qemuMonitorJSONGetMigrationStats(qemuMonitorPtr mon,
+ qemuMonitorMigrationStatsPtr stats)
{
int ret;
virJSONValuePtr cmd = qemuMonitorJSONMakeCommand("query-migrate",
NULL);
virJSONValuePtr reply = NULL;
- memset(status, 0, sizeof(*status));
+ memset(stats, 0, sizeof(*stats));
if (!cmd)
return -1;
@@ -2619,11 +2619,11 @@ int qemuMonitorJSONGetMigrationStatus(qemuMonitorPtr mon,
ret = qemuMonitorJSONCheckError(cmd, reply);
if (ret == 0 &&
- qemuMonitorJSONGetMigrationStatusReply(reply, status) < 0)
+ qemuMonitorJSONGetMigrationStatsReply(reply, stats) < 0)
ret = -1;
if (ret < 0)
- memset(status, 0, sizeof(*status));
+ memset(stats, 0, sizeof(*stats));
virJSONValueFree(cmd);
virJSONValueFree(reply);
return ret;
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
index 374c8ea..2c27c6f 100644
--- a/src/qemu/qemu_monitor_json.h
+++ b/src/qemu/qemu_monitor_json.h
@@ -123,8 +123,8 @@ int qemuMonitorJSONGetMigrationCacheSize(qemuMonitorPtr mon,
int qemuMonitorJSONSetMigrationCacheSize(qemuMonitorPtr mon,
unsigned long long cacheSize);
-int qemuMonitorJSONGetMigrationStatus(qemuMonitorPtr mon,
- qemuMonitorMigrationStatusPtr status);
+int qemuMonitorJSONGetMigrationStats(qemuMonitorPtr mon,
+ qemuMonitorMigrationStatsPtr stats);
int qemuMonitorJSONGetMigrationCapabilities(qemuMonitorPtr mon,
char ***capabilities);
diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
index 665723d..316a942 100644
--- a/src/qemu/qemu_monitor_text.c
+++ b/src/qemu/qemu_monitor_text.c
@@ -1353,15 +1353,15 @@ int qemuMonitorTextSetMigrationDowntime(qemuMonitorPtr mon,
#define MIGRATION_DISK_REMAINING_PREFIX "remaining disk: "
#define MIGRATION_DISK_TOTAL_PREFIX "total disk: "
-int qemuMonitorTextGetMigrationStatus(qemuMonitorPtr mon,
- qemuMonitorMigrationStatusPtr status)
+int qemuMonitorTextGetMigrationStats(qemuMonitorPtr mon,
+ qemuMonitorMigrationStatsPtr stats)
{
char *reply;
char *tmp;
char *end;
int ret = -1;
- memset(status, 0, sizeof(*status));
+ memset(stats, 0, sizeof(*stats));
if (qemuMonitorHMPCommand(mon, "info migrate", &reply) < 0)
return -1;
@@ -1376,14 +1376,14 @@ int qemuMonitorTextGetMigrationStatus(qemuMonitorPtr mon,
}
*end = '\0';
- status->status = qemuMonitorMigrationStatusTypeFromString(tmp);
- if (status->status < 0) {
+ stats->status = qemuMonitorMigrationStatusTypeFromString(tmp);
+ if (stats->status < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected migration status in %s"), reply);
goto cleanup;
}
- if (status->status == QEMU_MONITOR_MIGRATION_STATUS_ACTIVE) {
+ if (stats->status == QEMU_MONITOR_MIGRATION_STATUS_ACTIVE) {
tmp = end + 1;
if (!(tmp = strstr(tmp, MIGRATION_TRANSFER_PREFIX)))
@@ -1391,82 +1391,82 @@ int qemuMonitorTextGetMigrationStatus(qemuMonitorPtr mon,
tmp += strlen(MIGRATION_TRANSFER_PREFIX);
if (virStrToLong_ull(tmp, &end, 10,
- &status->ram_transferred) < 0) {
+ &stats->ram_transferred) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse migration data transferred "
"statistic %s"), tmp);
goto cleanup;
}
- status->ram_transferred *= 1024;
+ stats->ram_transferred *= 1024;
tmp = end;
if (!(tmp = strstr(tmp, MIGRATION_REMAINING_PREFIX)))
goto done;
tmp += strlen(MIGRATION_REMAINING_PREFIX);
- if (virStrToLong_ull(tmp, &end, 10, &status->ram_remaining) <
0) {
+ if (virStrToLong_ull(tmp, &end, 10, &stats->ram_remaining) < 0)
{
virReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse migration data remaining "
"statistic %s"), tmp);
goto cleanup;
}
- status->ram_remaining *= 1024;
+ stats->ram_remaining *= 1024;
tmp = end;
if (!(tmp = strstr(tmp, MIGRATION_TOTAL_PREFIX)))
goto done;
tmp += strlen(MIGRATION_TOTAL_PREFIX);
- if (virStrToLong_ull(tmp, &end, 10, &status->ram_total) < 0) {
+ if (virStrToLong_ull(tmp, &end, 10, &stats->ram_total) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse migration data total "
"statistic %s"), tmp);
goto cleanup;
}
- status->ram_total *= 1024;
+ stats->ram_total *= 1024;
tmp = end;
/*
- * Check for Optional Disk Migration status
+ * Check for Optional Disk Migration stats
*/
if (!(tmp = strstr(tmp, MIGRATION_DISK_TRANSFER_PREFIX)))
goto done;
tmp += strlen(MIGRATION_DISK_TRANSFER_PREFIX);
if (virStrToLong_ull(tmp, &end, 10,
- &status->disk_transferred) < 0) {
+ &stats->disk_transferred) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse disk migration data "
"transferred statistic %s"), tmp);
goto cleanup;
}
- status->disk_transferred *= 1024;
+ stats->disk_transferred *= 1024;
tmp = end;
if (!(tmp = strstr(tmp, MIGRATION_DISK_REMAINING_PREFIX)))
goto done;
tmp += strlen(MIGRATION_DISK_REMAINING_PREFIX);
- if (virStrToLong_ull(tmp, &end, 10, &status->disk_remaining) <
0) {
+ if (virStrToLong_ull(tmp, &end, 10, &stats->disk_remaining) <
0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse disk migration data remaining "
"statistic %s"), tmp);
goto cleanup;
}
- status->disk_remaining *= 1024;
+ stats->disk_remaining *= 1024;
tmp = end;
if (!(tmp = strstr(tmp, MIGRATION_DISK_TOTAL_PREFIX)))
goto done;
tmp += strlen(MIGRATION_DISK_TOTAL_PREFIX);
- if (virStrToLong_ull(tmp, &end, 10, &status->disk_total) < 0)
{
+ if (virStrToLong_ull(tmp, &end, 10, &stats->disk_total) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse disk migration data total "
"statistic %s"), tmp);
goto cleanup;
}
- status->disk_total *= 1024;
+ stats->disk_total *= 1024;
}
}
@@ -1476,7 +1476,7 @@ int qemuMonitorTextGetMigrationStatus(qemuMonitorPtr mon,
cleanup:
VIR_FREE(reply);
if (ret < 0)
- memset(status, 0, sizeof(*status));
+ memset(stats, 0, sizeof(*stats));
return ret;
}
diff --git a/src/qemu/qemu_monitor_text.h b/src/qemu/qemu_monitor_text.h
index 53c503d..44a5330 100644
--- a/src/qemu/qemu_monitor_text.h
+++ b/src/qemu/qemu_monitor_text.h
@@ -103,8 +103,8 @@ int qemuMonitorTextSetMigrationSpeed(qemuMonitorPtr mon,
int qemuMonitorTextSetMigrationDowntime(qemuMonitorPtr mon,
unsigned long long downtime);
-int qemuMonitorTextGetMigrationStatus(qemuMonitorPtr mon,
- qemuMonitorMigrationStatusPtr status);
+int qemuMonitorTextGetMigrationStats(qemuMonitorPtr mon,
+ qemuMonitorMigrationStatsPtr stats);
int qemuMonitorTextMigrate(qemuMonitorPtr mon,
unsigned int flags,
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index f274068..39f1210 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1507,7 +1507,7 @@ qemuProcessHandleMigrationStatus(qemuMonitorPtr mon
ATTRIBUTE_UNUSED,
goto cleanup;
}
- priv->job.current->status.status = status;
+ priv->job.current->stats.status = status;
virDomainObjBroadcast(vm);
cleanup:
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index 46d4e1e..1be0bee 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -1629,23 +1629,23 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationCacheSize(const void
*data)
}
static int
-testQemuMonitorJSONqemuMonitorJSONGetMigrationStatus(const void *data)
+testQemuMonitorJSONqemuMonitorJSONGetMigrationStats(const void *data)
{
virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
int ret = -1;
- qemuMonitorMigrationStatus status, expectedStatus;
+ qemuMonitorMigrationStats stats, expectedStats;
if (!test)
return -1;
- memset(&expectedStatus, 0, sizeof(expectedStatus));
+ memset(&expectedStats, 0, sizeof(expectedStats));
- expectedStatus.status = QEMU_MONITOR_MIGRATION_STATUS_ACTIVE;
- expectedStatus.total_time = 47;
- expectedStatus.ram_total = 1611038720;
- expectedStatus.ram_remaining = 1605013504;
- expectedStatus.ram_transferred = 3625548;
+ expectedStats.status = QEMU_MONITOR_MIGRATION_STATUS_ACTIVE;
+ expectedStats.total_time = 47;
+ expectedStats.ram_total = 1611038720;
+ expectedStats.ram_remaining = 1605013504;
+ expectedStats.ram_transferred = 3625548;
if (qemuMonitorTestAddItem(test, "query-migrate",
"{"
@@ -1662,10 +1662,10 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationStatus(const void
*data)
"}") < 0)
goto cleanup;
- if (qemuMonitorJSONGetMigrationStatus(qemuMonitorTestGetMonitor(test), &status)
< 0)
+ if (qemuMonitorJSONGetMigrationStats(qemuMonitorTestGetMonitor(test), &stats)
< 0)
goto cleanup;
- if (memcmp(&status, &expectedStatus, sizeof(status)) != 0) {
+ if (memcmp(&stats, &expectedStats, sizeof(stats)) != 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
"Invalid migration status");
goto cleanup;
@@ -2333,7 +2333,7 @@ mymain(void)
DO_TEST(qemuMonitorJSONGetBlockInfo);
DO_TEST(qemuMonitorJSONGetBlockStatsInfo);
DO_TEST(qemuMonitorJSONGetMigrationCacheSize);
- DO_TEST(qemuMonitorJSONGetMigrationStatus);
+ DO_TEST(qemuMonitorJSONGetMigrationStats);
DO_TEST(qemuMonitorJSONGetChardevInfo);
DO_TEST(qemuMonitorJSONSetBlockIoThrottle);
DO_TEST(qemuMonitorJSONGetTargetArch);
--
2.7.0