To remove dependecy of `qemuDomainJobInfo` on job specific
paramters, a `privateData` pointer is introduced.
To handle it, structure of callback functions is
also introduced.
Signed-off-by: Prathamesh Chavan <pc44800(a)gmail.com>
---
src/qemu/qemu_backup.c | 15 +++--
src/qemu/qemu_domain.h | 18 ++++++
src/qemu/qemu_domainjob.c | 98 +++++++++++++++++++++++++-------
src/qemu/qemu_domainjob.h | 31 +++++-----
src/qemu/qemu_driver.c | 18 +++---
src/qemu/qemu_migration.c | 14 +++--
src/qemu/qemu_migration_cookie.c | 7 ++-
src/qemu/qemu_process.c | 11 +++-
8 files changed, 154 insertions(+), 58 deletions(-)
diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c
index b711f8f623..a0832b4587 100644
--- a/src/qemu/qemu_backup.c
+++ b/src/qemu/qemu_backup.c
@@ -529,6 +529,7 @@ qemuBackupJobTerminate(virDomainObjPtr vm,
{
qemuDomainObjPrivatePtr priv = vm->privateData;
+ qemuDomainJobInfoPrivatePtr jobInfoPriv;
size_t i;
qemuDomainJobInfoUpdateTime(priv->job.current);
@@ -536,10 +537,13 @@ qemuBackupJobTerminate(virDomainObjPtr vm,
g_clear_pointer(&priv->job.completed, qemuDomainJobInfoFree);
priv->job.completed = qemuDomainJobInfoCopy(priv->job.current);
- priv->job.completed->stats.backup.total = priv->backup->push_total;
- priv->job.completed->stats.backup.transferred =
priv->backup->push_transferred;
- priv->job.completed->stats.backup.tmp_used =
priv->backup->pull_tmp_used;
- priv->job.completed->stats.backup.tmp_total =
priv->backup->pull_tmp_total;
+
+ jobInfoPriv = priv->job.completed->privateData;
+
+ jobInfoPriv->stats.backup.total = priv->backup->push_total;
+ jobInfoPriv->stats.backup.transferred = priv->backup->push_transferred;
+ jobInfoPriv->stats.backup.tmp_used = priv->backup->pull_tmp_used;
+ jobInfoPriv->stats.backup.tmp_total = priv->backup->pull_tmp_total;
priv->job.completed->status = jobstatus;
priv->job.completed->errmsg = g_strdup(priv->backup->errmsg);
@@ -1069,7 +1073,8 @@ qemuBackupGetJobInfoStats(virQEMUDriverPtr driver,
virDomainObjPtr vm,
qemuDomainJobInfoPtr jobInfo)
{
- qemuDomainBackupStats *stats = &jobInfo->stats.backup;
+ qemuDomainJobInfoPrivatePtr jobInfoPriv = jobInfo->privateData;
+ qemuDomainBackupStats *stats = &jobInfoPriv->stats.backup;
qemuDomainObjPrivatePtr priv = vm->privateData;
qemuMonitorJobInfoPtr *blockjobs = NULL;
size_t nblockjobs = 0;
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index bb9b414a46..7fcbefd0c0 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -502,6 +502,24 @@ struct _qemuDomainJobPrivate {
qemuMigrationParamsPtr migParams;
};
+typedef struct _qemuDomainBackupStats qemuDomainBackupStats;
+struct _qemuDomainBackupStats {
+ unsigned long long transferred;
+ unsigned long long total;
+ unsigned long long tmp_used;
+ unsigned long long tmp_total;
+};
+
+typedef struct _qemuDomainJobInfoPrivate qemuDomainJobInfoPrivate;
+typedef qemuDomainJobInfoPrivate *qemuDomainJobInfoPrivatePtr;
+struct _qemuDomainJobInfoPrivate {
+ union {
+ qemuMonitorMigrationStats mig;
+ qemuMonitorDumpStats dump;
+ qemuDomainBackupStats backup;
+ } stats;
+};
+
int qemuDomainObjStartWorker(virDomainObjPtr dom);
void qemuDomainObjStopWorker(virDomainObjPtr dom);
diff --git a/src/qemu/qemu_domainjob.c b/src/qemu/qemu_domainjob.c
index fe160afe79..bb086db2b7 100644
--- a/src/qemu/qemu_domainjob.c
+++ b/src/qemu/qemu_domainjob.c
@@ -63,6 +63,7 @@ VIR_ENUM_IMPL(qemuDomainAsyncJob,
"backup",
);
+
const char *
qemuDomainAsyncJobPhaseToString(qemuDomainAsyncJob job,
int phase G_GNUC_UNUSED)
@@ -115,27 +116,78 @@ qemuDomainAsyncJobPhaseFromString(qemuDomainAsyncJob job,
return -1;
}
+static void
+qemuJobInfoFreePrivateData(qemuDomainJobInfoPrivatePtr priv)
+{
+ g_free(&priv->stats);
+}
+
+static void
+qemuJobInfoFreePrivate(void *opaque)
+{
+ qemuDomainJobInfoPtr jobInfo = (qemuDomainJobInfoPtr) opaque;
+ qemuJobInfoFreePrivateData(jobInfo->privateData);
+}
void
qemuDomainJobInfoFree(qemuDomainJobInfoPtr info)
{
+ info->cb->freeJobInfoPrivate(info);
g_free(info->errmsg);
g_free(info);
}
+static void *
+qemuDomainJobInfoPrivateAlloc(void)
+{
+ qemuDomainJobInfoPrivatePtr retPriv = g_new0(qemuDomainJobInfoPrivate, 1);
+ return (void *)retPriv;
+}
+
+static void
+qemuDomainJobInfoPrivateCopy(qemuDomainJobInfoPtr src,
+ qemuDomainJobInfoPtr dest)
+{
+ memcpy(dest->privateData, src->privateData,
+ sizeof(qemuDomainJobInfoPrivate));
+}
+
+static qemuDomainJobInfoPtr
+qemuDomainJobInfoAlloc(qemuDomainObjPrivateJobInfoCallbacksPtr cb)
+{
+ qemuDomainJobInfoPtr ret = g_new0(qemuDomainJobInfo, 1);
+ ret->cb = cb;
+ ret->privateData = ret->cb->allocJobInfoPrivate();
+ return ret;
+}
+
+static void
+qemuDomainCurrentJobInfoInit(qemuDomainJobObjPtr job,
+ qemuDomainObjPrivateJobInfoCallbacksPtr cb)
+{
+ job->current = qemuDomainJobInfoAlloc(cb);
+ job->current->status = QEMU_DOMAIN_JOB_STATUS_ACTIVE;
+}
qemuDomainJobInfoPtr
qemuDomainJobInfoCopy(qemuDomainJobInfoPtr info)
{
- qemuDomainJobInfoPtr ret = g_new0(qemuDomainJobInfo, 1);
+ qemuDomainJobInfoPtr ret = qemuDomainJobInfoAlloc(info->cb);
memcpy(ret, info, sizeof(*info));
+ ret->cb->copyJobInfoPrivate(info, ret);
ret->errmsg = g_strdup(info->errmsg);
return ret;
}
+static qemuDomainObjPrivateJobInfoCallbacks qemuJobInfoPrivateCallbacks = {
+ .allocJobInfoPrivate = &qemuDomainJobInfoPrivateAlloc,
+ .freeJobInfoPrivate = &qemuJobInfoFreePrivate,
+ .copyJobInfoPrivate = &qemuDomainJobInfoPrivateCopy,
+};
+
void
qemuDomainEventEmitJobCompleted(virQEMUDriverPtr driver,
virDomainObjPtr vm)
@@ -285,6 +337,7 @@ int
qemuDomainJobInfoUpdateDowntime(qemuDomainJobInfoPtr jobInfo)
{
unsigned long long now;
+ qemuDomainJobInfoPrivatePtr jobInfoPriv = jobInfo->privateData;
if (!jobInfo->stopped)
return 0;
@@ -298,8 +351,8 @@ qemuDomainJobInfoUpdateDowntime(qemuDomainJobInfoPtr jobInfo)
return 0;
}
- jobInfo->stats.mig.downtime = now - jobInfo->stopped;
- jobInfo->stats.mig.downtime_set = true;
+ jobInfoPriv->stats.mig.downtime = now - jobInfo->stopped;
+ jobInfoPriv->stats.mig.downtime_set = true;
return 0;
}
@@ -334,38 +387,39 @@ int
qemuDomainJobInfoToInfo(qemuDomainJobInfoPtr jobInfo,
virDomainJobInfoPtr info)
{
+ qemuDomainJobInfoPrivatePtr jobInfoPriv = jobInfo->privateData;
info->type = qemuDomainJobStatusToType(jobInfo->status);
info->timeElapsed = jobInfo->timeElapsed;
switch (jobInfo->statsType) {
case QEMU_DOMAIN_JOB_STATS_TYPE_MIGRATION:
- info->memTotal = jobInfo->stats.mig.ram_total;
- info->memRemaining = jobInfo->stats.mig.ram_remaining;
- info->memProcessed = jobInfo->stats.mig.ram_transferred;
- info->fileTotal = jobInfo->stats.mig.disk_total +
+ info->memTotal = jobInfoPriv->stats.mig.ram_total;
+ info->memRemaining = jobInfoPriv->stats.mig.ram_remaining;
+ info->memProcessed = jobInfoPriv->stats.mig.ram_transferred;
+ info->fileTotal = jobInfoPriv->stats.mig.disk_total +
jobInfo->mirrorStats.total;
- info->fileRemaining = jobInfo->stats.mig.disk_remaining +
+ info->fileRemaining = jobInfoPriv->stats.mig.disk_remaining +
(jobInfo->mirrorStats.total -
jobInfo->mirrorStats.transferred);
- info->fileProcessed = jobInfo->stats.mig.disk_transferred +
+ info->fileProcessed = jobInfoPriv->stats.mig.disk_transferred +
jobInfo->mirrorStats.transferred;
break;
case QEMU_DOMAIN_JOB_STATS_TYPE_SAVEDUMP:
- info->memTotal = jobInfo->stats.mig.ram_total;
- info->memRemaining = jobInfo->stats.mig.ram_remaining;
- info->memProcessed = jobInfo->stats.mig.ram_transferred;
+ info->memTotal = jobInfoPriv->stats.mig.ram_total;
+ info->memRemaining = jobInfoPriv->stats.mig.ram_remaining;
+ info->memProcessed = jobInfoPriv->stats.mig.ram_transferred;
break;
case QEMU_DOMAIN_JOB_STATS_TYPE_MEMDUMP:
- info->memTotal = jobInfo->stats.dump.total;
- info->memProcessed = jobInfo->stats.dump.completed;
+ info->memTotal = jobInfoPriv->stats.dump.total;
+ info->memProcessed = jobInfoPriv->stats.dump.completed;
info->memRemaining = info->memTotal - info->memProcessed;
break;
case QEMU_DOMAIN_JOB_STATS_TYPE_BACKUP:
- info->fileTotal = jobInfo->stats.backup.total;
- info->fileProcessed = jobInfo->stats.backup.transferred;
+ info->fileTotal = jobInfoPriv->stats.backup.total;
+ info->fileProcessed = jobInfoPriv->stats.backup.transferred;
info->fileRemaining = info->fileTotal - info->fileProcessed;
break;
@@ -387,7 +441,8 @@ qemuDomainMigrationJobInfoToParams(qemuDomainJobInfoPtr jobInfo,
virTypedParameterPtr *params,
int *nparams)
{
- qemuMonitorMigrationStats *stats = &jobInfo->stats.mig;
+ qemuDomainJobInfoPrivatePtr jobInfoPriv = jobInfo->privateData;
+ qemuMonitorMigrationStats *stats = &jobInfoPriv->stats.mig;
qemuDomainMirrorStatsPtr mirrorStats = &jobInfo->mirrorStats;
virTypedParameterPtr par = NULL;
int maxpar = 0;
@@ -564,7 +619,8 @@ qemuDomainDumpJobInfoToParams(qemuDomainJobInfoPtr jobInfo,
virTypedParameterPtr *params,
int *nparams)
{
- qemuMonitorDumpStats *stats = &jobInfo->stats.dump;
+ qemuDomainJobInfoPrivatePtr jobInfoPriv = jobInfo->privateData;
+ qemuMonitorDumpStats *stats = &jobInfoPriv->stats.dump;
virTypedParameterPtr par = NULL;
int maxpar = 0;
int npar = 0;
@@ -607,7 +663,8 @@ qemuDomainBackupJobInfoToParams(qemuDomainJobInfoPtr jobInfo,
virTypedParameterPtr *params,
int *nparams)
{
- qemuDomainBackupStats *stats = &jobInfo->stats.backup;
+ qemuDomainJobInfoPrivatePtr jobInfoPriv = jobInfo->privateData;
+ qemuDomainBackupStats *stats = &jobInfoPriv->stats.backup;
g_autoptr(virTypedParamList) par = g_new0(virTypedParamList, 1);
if (virTypedParamListAddInt(par, jobInfo->operation,
@@ -890,8 +947,7 @@ qemuDomainObjBeginJobInternal(virQEMUDriverPtr driver,
qemuDomainAsyncJobTypeToString(asyncJob),
obj, obj->def->name);
qemuDomainObjResetAsyncJob(&priv->job);
- priv->job.current = g_new0(qemuDomainJobInfo, 1);
- priv->job.current->status = QEMU_DOMAIN_JOB_STATUS_ACTIVE;
+ qemuDomainCurrentJobInfoInit(&priv->job,
&qemuJobInfoPrivateCallbacks);
priv->job.asyncJob = asyncJob;
priv->job.asyncOwner = virThreadSelfID();
priv->job.asyncOwnerAPI = virThreadJobGet();
diff --git a/src/qemu/qemu_domainjob.h b/src/qemu/qemu_domainjob.h
index b0e840adc8..3c55cf29ed 100644
--- a/src/qemu/qemu_domainjob.h
+++ b/src/qemu/qemu_domainjob.h
@@ -107,16 +107,22 @@ struct _qemuDomainMirrorStats {
unsigned long long total;
};
-typedef struct _qemuDomainBackupStats qemuDomainBackupStats;
-struct _qemuDomainBackupStats {
- unsigned long long transferred;
- unsigned long long total;
- unsigned long long tmp_used;
- unsigned long long tmp_total;
-};
-
typedef struct _qemuDomainJobInfo qemuDomainJobInfo;
typedef qemuDomainJobInfo *qemuDomainJobInfoPtr;
+
+typedef void *(*qemuDomainObjJobInfoPrivateAlloc)(void);
+typedef void (*qemuDomainObjJobInfoPrivateFree)(void *);
+typedef void (*qemuDomainObjJobInfoPrivateCopy)(qemuDomainJobInfoPtr,
+ qemuDomainJobInfoPtr);
+
+typedef struct _qemuDomainObjPrivateJobInfoCallbacks
qemuDomainObjPrivateJobInfoCallbacks;
+typedef qemuDomainObjPrivateJobInfoCallbacks *qemuDomainObjPrivateJobInfoCallbacksPtr;
+struct _qemuDomainObjPrivateJobInfoCallbacks {
+ qemuDomainObjJobInfoPrivateAlloc allocJobInfoPrivate;
+ qemuDomainObjJobInfoPrivateFree freeJobInfoPrivate;
+ qemuDomainObjJobInfoPrivateCopy copyJobInfoPrivate;
+};
+
struct _qemuDomainJobInfo {
qemuDomainJobStatus status;
virDomainJobOperation operation;
@@ -136,14 +142,11 @@ struct _qemuDomainJobInfo {
bool timeDeltaSet;
/* Raw values from QEMU */
qemuDomainJobStatsType statsType;
- union {
- qemuMonitorMigrationStats mig;
- qemuMonitorDumpStats dump;
- qemuDomainBackupStats backup;
- } stats;
qemuDomainMirrorStats mirrorStats;
-
char *errmsg; /* optional error message for failed completed jobs */
+
+ void *privateData; /* job specific collection of info */
+ qemuDomainObjPrivateJobInfoCallbacksPtr cb;
};
void
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index d9c5f21f21..058e15e864 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3702,6 +3702,7 @@ qemuDumpWaitForCompletion(virDomainObjPtr vm)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
qemuDomainJobPrivatePtr jobPriv = priv->job.privateData;
+ qemuDomainJobInfoPrivatePtr jobInfoPriv = priv->job.current->privateData;
VIR_DEBUG("Waiting for dump completion");
while (!jobPriv->dumpCompleted && !priv->job.abortJob) {
@@ -3709,7 +3710,7 @@ qemuDumpWaitForCompletion(virDomainObjPtr vm)
return -1;
}
- if (priv->job.current->stats.dump.status == QEMU_MONITOR_DUMP_STATUS_FAILED) {
+ if (jobInfoPriv->stats.dump.status == QEMU_MONITOR_DUMP_STATUS_FAILED) {
if (priv->job.error)
virReportError(VIR_ERR_OPERATION_FAILED,
_("memory-only dump failed: %s"),
@@ -13527,6 +13528,7 @@ qemuDomainGetJobInfoDumpStats(virQEMUDriverPtr driver,
{
qemuDomainObjPrivatePtr priv = vm->privateData;
qemuMonitorDumpStats stats = { 0 };
+ qemuDomainJobInfoPrivatePtr jobInfoPriv = jobInfo->privateData;
int rc;
if (qemuDomainObjEnterMonitorAsync(driver, vm, QEMU_ASYNC_JOB_NONE) < 0)
@@ -13537,33 +13539,33 @@ qemuDomainGetJobInfoDumpStats(virQEMUDriverPtr driver,
if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0)
return -1;
- jobInfo->stats.dump = stats;
+ jobInfoPriv->stats.dump = stats;
if (qemuDomainJobInfoUpdateTime(jobInfo) < 0)
return -1;
- switch (jobInfo->stats.dump.status) {
+ switch (jobInfoPriv->stats.dump.status) {
case QEMU_MONITOR_DUMP_STATUS_NONE:
case QEMU_MONITOR_DUMP_STATUS_FAILED:
case QEMU_MONITOR_DUMP_STATUS_LAST:
virReportError(VIR_ERR_OPERATION_FAILED,
_("dump query failed, status=%d"),
- jobInfo->stats.dump.status);
+ jobInfoPriv->stats.dump.status);
return -1;
break;
case QEMU_MONITOR_DUMP_STATUS_ACTIVE:
jobInfo->status = QEMU_DOMAIN_JOB_STATUS_ACTIVE;
VIR_DEBUG("dump active, bytes written='%llu'
remaining='%llu'",
- jobInfo->stats.dump.completed,
- jobInfo->stats.dump.total -
- jobInfo->stats.dump.completed);
+ jobInfoPriv->stats.dump.completed,
+ jobInfoPriv->stats.dump.total -
+ jobInfoPriv->stats.dump.completed);
break;
case QEMU_MONITOR_DUMP_STATUS_COMPLETED:
jobInfo->status = QEMU_DOMAIN_JOB_STATUS_COMPLETED;
VIR_DEBUG("dump completed, bytes written='%llu'",
- jobInfo->stats.dump.completed);
+ jobInfoPriv->stats.dump.completed);
break;
}
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 2c7bf349c3..0c4136ef8a 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1439,7 +1439,8 @@ qemuMigrationSrcWaitForSpice(virDomainObjPtr vm)
static void
qemuMigrationUpdateJobType(qemuDomainJobInfoPtr jobInfo)
{
- switch ((qemuMonitorMigrationStatus) jobInfo->stats.mig.status) {
+ qemuDomainJobInfoPrivatePtr jobInfoPriv = jobInfo->privateData;
+ switch ((qemuMonitorMigrationStatus) jobInfoPriv->stats.mig.status) {
case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY:
jobInfo->status = QEMU_DOMAIN_JOB_STATUS_POSTCOPY;
break;
@@ -1486,6 +1487,7 @@ qemuMigrationAnyFetchStats(virQEMUDriverPtr driver,
char **error)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
+ qemuDomainJobInfoPrivatePtr jobInfoPriv = jobInfo->privateData;
qemuMonitorMigrationStats stats;
int rv;
@@ -1497,7 +1499,7 @@ qemuMigrationAnyFetchStats(virQEMUDriverPtr driver,
if (qemuDomainObjExitMonitor(driver, vm) < 0 || rv < 0)
return -1;
- jobInfo->stats.mig = stats;
+ jobInfoPriv->stats.mig = stats;
return 0;
}
@@ -1539,12 +1541,13 @@ qemuMigrationJobCheckStatus(virQEMUDriverPtr driver,
{
qemuDomainObjPrivatePtr priv = vm->privateData;
qemuDomainJobInfoPtr jobInfo = priv->job.current;
+ qemuDomainJobInfoPrivatePtr jobInfoPriv = jobInfo->privateData;
char *error = NULL;
bool events = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVENT);
int ret = -1;
if (!events ||
- jobInfo->stats.mig.status == QEMU_MONITOR_MIGRATION_STATUS_ERROR) {
+ jobInfoPriv->stats.mig.status == QEMU_MONITOR_MIGRATION_STATUS_ERROR) {
if (qemuMigrationAnyFetchStats(driver, vm, asyncJob, jobInfo, &error) <
0)
return -1;
}
@@ -3013,6 +3016,7 @@ qemuMigrationSrcConfirmPhase(virQEMUDriverPtr driver,
/* Update times with the values sent by the destination daemon */
if (mig->jobInfo && jobInfo) {
int reason;
+ qemuDomainJobInfoPrivatePtr jobInfoPriv = mig->jobInfo->privateData;
/* We need to refresh migration statistics after a completed post-copy
* migration since priv->job.completed contains obsolete data from the
@@ -3027,8 +3031,8 @@ qemuMigrationSrcConfirmPhase(virQEMUDriverPtr driver,
qemuDomainJobInfoUpdateTime(jobInfo);
jobInfo->timeDeltaSet = mig->jobInfo->timeDeltaSet;
jobInfo->timeDelta = mig->jobInfo->timeDelta;
- jobInfo->stats.mig.downtime_set = mig->jobInfo->stats.mig.downtime_set;
- jobInfo->stats.mig.downtime = mig->jobInfo->stats.mig.downtime;
+ jobInfoPriv->stats.mig.downtime_set = jobInfoPriv->stats.mig.downtime_set;
+ jobInfoPriv->stats.mig.downtime = jobInfoPriv->stats.mig.downtime;
}
if (flags & VIR_MIGRATE_OFFLINE)
diff --git a/src/qemu/qemu_migration_cookie.c b/src/qemu/qemu_migration_cookie.c
index 81b557e0a8..a3e3ff95e8 100644
--- a/src/qemu/qemu_migration_cookie.c
+++ b/src/qemu/qemu_migration_cookie.c
@@ -641,7 +641,8 @@ static void
qemuMigrationCookieStatisticsXMLFormat(virBufferPtr buf,
qemuDomainJobInfoPtr jobInfo)
{
- qemuMonitorMigrationStats *stats = &jobInfo->stats.mig;
+ qemuDomainJobInfoPrivatePtr jobInfoPriv = jobInfo->privateData;
+ qemuMonitorMigrationStats *stats = &jobInfoPriv->stats.mig;
virBufferAddLit(buf, "<statistics>\n");
virBufferAdjustIndent(buf, 2);
@@ -1043,14 +1044,16 @@ qemuMigrationCookieStatisticsXMLParse(xmlXPathContextPtr ctxt)
{
qemuDomainJobInfoPtr jobInfo = NULL;
qemuMonitorMigrationStats *stats;
+ qemuDomainJobInfoPrivatePtr jobInfoPriv;
VIR_XPATH_NODE_AUTORESTORE(ctxt);
if (!(ctxt->node = virXPathNode("./statistics", ctxt)))
return NULL;
jobInfo = g_new0(qemuDomainJobInfo, 1);
+ jobInfoPriv = jobInfo->privateData;
- stats = &jobInfo->stats.mig;
+ stats = &jobInfoPriv->stats.mig;
jobInfo->status = QEMU_DOMAIN_JOB_STATUS_COMPLETED;
virXPathULongLong("string(./started[1])", ctxt, &jobInfo->started);
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index af060b3180..eb9b980a6a 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1641,6 +1641,7 @@ qemuProcessHandleMigrationStatus(qemuMonitorPtr mon G_GNUC_UNUSED,
virQEMUDriverPtr driver = opaque;
virObjectEventPtr event = NULL;
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
+ qemuDomainJobInfoPrivatePtr jobInfoPriv;
int reason;
virObjectLock(vm);
@@ -1650,12 +1651,14 @@ qemuProcessHandleMigrationStatus(qemuMonitorPtr mon
G_GNUC_UNUSED,
qemuMonitorMigrationStatusTypeToString(status));
priv = vm->privateData;
+ jobInfoPriv = priv->job.current->privateData;
+
if (priv->job.asyncJob == QEMU_ASYNC_JOB_NONE) {
VIR_DEBUG("got MIGRATION event without a migration job");
goto cleanup;
}
- priv->job.current->stats.mig.status = status;
+ jobInfoPriv->stats.mig.status = status;
virDomainObjBroadcast(vm);
if (status == QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY &&
@@ -1723,6 +1726,7 @@ qemuProcessHandleDumpCompleted(qemuMonitorPtr mon G_GNUC_UNUSED,
{
qemuDomainObjPrivatePtr priv;
qemuDomainJobPrivatePtr jobPriv;
+ qemuDomainJobInfoPrivatePtr jobInfoPriv;
virObjectLock(vm);
@@ -1731,18 +1735,19 @@ qemuProcessHandleDumpCompleted(qemuMonitorPtr mon G_GNUC_UNUSED,
priv = vm->privateData;
jobPriv = priv->job.privateData;
+ jobInfoPriv = priv->job.current->privateData;
if (priv->job.asyncJob == QEMU_ASYNC_JOB_NONE) {
VIR_DEBUG("got DUMP_COMPLETED event without a dump_completed job");
goto cleanup;
}
jobPriv->dumpCompleted = true;
- priv->job.current->stats.dump = *stats;
+ jobInfoPriv->stats.dump = *stats;
priv->job.error = g_strdup(error);
/* Force error if extracting the DUMP_COMPLETED status failed */
if (!error && status < 0) {
priv->job.error = g_strdup(virGetLastErrorMessage());
- priv->job.current->stats.dump.status = QEMU_MONITOR_DUMP_STATUS_FAILED;
+ jobInfoPriv->stats.dump.status = QEMU_MONITOR_DUMP_STATUS_FAILED;
}
virDomainObjBroadcast(vm);
--
2.25.1