mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
qemu: propagate virDomainJobObj into qemuDomainObjPreserveJob()
It does not make sense to propagate virDomainObj and get qemuDomainObjPrivate from it, when it is already accessible in the only function qemuDomainObjPreserveJob() is called from. That being said, we can also propagate virDomainJobObj directly and avoid using qemu private structure. Signed-off-by: Kristina Hanicova <khanicov@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
36435967f6
commit
4df82dbbd1
@ -160,28 +160,25 @@ qemuDomainEventEmitJobCompleted(virQEMUDriver *driver,
|
||||
* Returns 0 on success, -1 on failure.
|
||||
*/
|
||||
int
|
||||
qemuDomainObjPreserveJob(virDomainObj *obj,
|
||||
qemuDomainObjPreserveJob(virDomainJobObj *currJob,
|
||||
virDomainJobObj *job)
|
||||
{
|
||||
qemuDomainObjPrivate *priv = obj->privateData;
|
||||
|
||||
memset(job, 0, sizeof(*job));
|
||||
job->active = priv->job.active;
|
||||
job->owner = priv->job.owner;
|
||||
job->asyncJob = priv->job.asyncJob;
|
||||
job->asyncOwner = priv->job.asyncOwner;
|
||||
job->asyncStarted = priv->job.asyncStarted;
|
||||
job->phase = priv->job.phase;
|
||||
job->privateData = g_steal_pointer(&priv->job.privateData);
|
||||
job->apiFlags = priv->job.apiFlags;
|
||||
job->active = currJob->active;
|
||||
job->owner = currJob->owner;
|
||||
job->asyncJob = currJob->asyncJob;
|
||||
job->asyncOwner = currJob->asyncOwner;
|
||||
job->phase = currJob->phase;
|
||||
job->privateData = g_steal_pointer(&currJob->privateData);
|
||||
job->apiFlags = currJob->apiFlags;
|
||||
|
||||
if (priv->job.cb &&
|
||||
!(priv->job.privateData = priv->job.cb->allocJobPrivate()))
|
||||
if (currJob->cb &&
|
||||
!(currJob->privateData = currJob->cb->allocJobPrivate()))
|
||||
return -1;
|
||||
job->cb = priv->job.cb;
|
||||
job->cb = currJob->cb;
|
||||
|
||||
virDomainObjResetJob(&priv->job);
|
||||
virDomainObjResetAsyncJob(&priv->job);
|
||||
virDomainObjResetJob(currJob);
|
||||
virDomainObjResetAsyncJob(currJob);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ qemuDomainObjStartJobPhase(virDomainObj *obj,
|
||||
int phase);
|
||||
void qemuDomainObjSetAsyncJobMask(virDomainObj *obj,
|
||||
unsigned long long allowedJobs);
|
||||
int qemuDomainObjPreserveJob(virDomainObj *obj,
|
||||
int qemuDomainObjPreserveJob(virDomainJobObj *currJob,
|
||||
virDomainJobObj *job);
|
||||
void
|
||||
qemuDomainObjRestoreAsyncJob(virDomainObj *vm,
|
||||
|
@ -8879,7 +8879,7 @@ qemuProcessReconnect(void *opaque)
|
||||
cfg = virQEMUDriverGetConfig(driver);
|
||||
priv = obj->privateData;
|
||||
|
||||
qemuDomainObjPreserveJob(obj, &oldjob);
|
||||
qemuDomainObjPreserveJob(&priv->job, &oldjob);
|
||||
if (oldjob.asyncJob == VIR_ASYNC_JOB_MIGRATION_IN)
|
||||
stopFlags |= VIR_QEMU_PROCESS_STOP_MIGRATED;
|
||||
if (oldjob.asyncJob == VIR_ASYNC_JOB_BACKUP && priv->backup)
|
||||
|
Loading…
Reference in New Issue
Block a user