Unused for now, but this will change soon.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/conf/domain_conf.c | 8 +++++---
src/conf/domain_conf.h | 6 ++++--
src/qemu/qemu_driver.c | 4 ++--
src/qemu/qemu_migration.c | 22 +++++++++++-----------
src/qemu/qemu_process.c | 8 ++++----
5 files changed, 26 insertions(+), 22 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index d1def730a4..9e2eea79e7 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -27873,7 +27873,8 @@ virDomainObjGetState(virDomainObj *dom, int *reason)
bool
-virDomainObjIsFailedPostcopy(virDomainObj *dom)
+virDomainObjIsFailedPostcopy(virDomainObj *dom,
+ virDomainJobObj *job G_GNUC_UNUSED)
{
return ((dom->state.state == VIR_DOMAIN_PAUSED &&
dom->state.reason == VIR_DOMAIN_PAUSED_POSTCOPY_FAILED) ||
@@ -27883,9 +27884,10 @@ virDomainObjIsFailedPostcopy(virDomainObj *dom)
bool
-virDomainObjIsPostcopy(virDomainObj *dom)
+virDomainObjIsPostcopy(virDomainObj *dom,
+ virDomainJobObj *job)
{
- if (virDomainObjIsFailedPostcopy(dom))
+ if (virDomainObjIsFailedPostcopy(dom, job))
return true;
return (dom->state.state == VIR_DOMAIN_PAUSED &&
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 3abf018574..becc147dab 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -3930,10 +3930,12 @@ virDomainObjGetState(virDomainObj *obj, int *reason)
ATTRIBUTE_NONNULL(1);
bool
-virDomainObjIsFailedPostcopy(virDomainObj *obj)
+virDomainObjIsFailedPostcopy(virDomainObj *obj,
+ virDomainJobObj *job)
ATTRIBUTE_NONNULL(1);
bool
-virDomainObjIsPostcopy(virDomainObj *dom)
+virDomainObjIsPostcopy(virDomainObj *dom,
+ virDomainJobObj *job)
ATTRIBUTE_NONNULL(1);
virSecurityLabelDef *
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index dea3d65b57..2257a17cde 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -12614,7 +12614,7 @@ qemuDomainAbortJobFlags(virDomainPtr dom,
if (flags & VIR_DOMAIN_ABORT_JOB_POSTCOPY &&
(vm->job->asyncJob != VIR_ASYNC_JOB_MIGRATION_OUT ||
- !virDomainObjIsPostcopy(vm))) {
+ !virDomainObjIsPostcopy(vm, vm->job))) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("current job is not outgoing migration in post-copy
mode"));
goto endjob;
@@ -12639,7 +12639,7 @@ qemuDomainAbortJobFlags(virDomainPtr dom,
break;
case VIR_ASYNC_JOB_MIGRATION_OUT:
- if (virDomainObjIsPostcopy(vm))
+ if (virDomainObjIsPostcopy(vm, vm->job))
ret = qemuDomainAbortJobPostcopy(vm, flags);
else
ret = qemuDomainAbortJobMigration(vm);
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index fd8583ca34..27a74795d6 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2294,7 +2294,7 @@ qemuMigrationAnyConnectionClosed(virDomainObj *vm,
break;
case QEMU_MIGRATION_PHASE_PERFORM3_DONE:
- if (virDomainObjIsPostcopy(vm)) {
+ if (virDomainObjIsPostcopy(vm, vm->job)) {
VIR_DEBUG("Migration protocol interrupted in post-copy mode");
postcopy = true;
} else {
@@ -2683,7 +2683,7 @@ qemuMigrationAnyCanResume(virDomainObj *vm,
return false;
}
- if (!virDomainObjIsPostcopy(vm)) {
+ if (!virDomainObjIsPostcopy(vm, vm->job)) {
virReportError(VIR_ERR_OPERATION_INVALID,
_("migration of domain %s is not in post-copy phase"),
vm->def->name);
@@ -2691,7 +2691,7 @@ qemuMigrationAnyCanResume(virDomainObj *vm,
}
if (vm->job->phase < QEMU_MIGRATION_PHASE_POSTCOPY_FAILED &&
- !virDomainObjIsFailedPostcopy(vm)) {
+ !virDomainObjIsFailedPostcopy(vm, vm->job)) {
virReportError(VIR_ERR_OPERATION_INVALID,
_("post-copy migration of domain %s has not failed"),
vm->def->name);
@@ -3911,7 +3911,7 @@ qemuMigrationSrcConfirmPhase(virQEMUDriver *driver,
virCheckFlags(QEMU_MIGRATION_FLAGS, -1);
if (retcode != 0 &&
- virDomainObjIsPostcopy(vm) &&
+ virDomainObjIsPostcopy(vm, vm->job) &&
currentData->stats.mig.status == QEMU_MONITOR_MIGRATION_STATUS_COMPLETED) {
VIR_DEBUG("Finish phase failed, but QEMU reports post-copy migration is
completed; forcing success");
retcode = 0;
@@ -3919,7 +3919,7 @@ qemuMigrationSrcConfirmPhase(virQEMUDriver *driver,
if (flags & VIR_MIGRATE_POSTCOPY_RESUME) {
phase = QEMU_MIGRATION_PHASE_CONFIRM_RESUME;
- } else if (virDomainObjIsFailedPostcopy(vm)) {
+ } else if (virDomainObjIsFailedPostcopy(vm, vm->job)) {
/* Keep the original migration phase in case post-copy failed as the
* job will stay active even though migration API finishes with an
* error.
@@ -3979,7 +3979,7 @@ qemuMigrationSrcConfirmPhase(virQEMUDriver *driver,
if (virDomainObjGetState(vm, &reason) == VIR_DOMAIN_PAUSED &&
reason == VIR_DOMAIN_PAUSED_POSTCOPY) {
qemuMigrationSrcPostcopyFailed(vm);
- } else if (!virDomainObjIsFailedPostcopy(vm)) {
+ } else if (!virDomainObjIsFailedPostcopy(vm, vm->job)) {
qemuMigrationSrcRestoreDomainState(driver, vm);
qemuMigrationParamsReset(vm, VIR_ASYNC_JOB_MIGRATION_OUT,
@@ -4020,7 +4020,7 @@ qemuMigrationSrcConfirm(virQEMUDriver *driver,
* job will stay active even though migration API finishes with an
* error.
*/
- if (virDomainObjIsFailedPostcopy(vm))
+ if (virDomainObjIsFailedPostcopy(vm, vm->job))
phase = vm->job->phase;
else if (cancelled)
phase = QEMU_MIGRATION_PHASE_CONFIRM3_CANCELLED;
@@ -4039,7 +4039,7 @@ qemuMigrationSrcConfirm(virQEMUDriver *driver,
cookiein, cookieinlen,
flags, cancelled);
- if (virDomainObjIsFailedPostcopy(vm)) {
+ if (virDomainObjIsFailedPostcopy(vm, vm->job)) {
ignore_value(qemuMigrationJobSetPhase(vm,
QEMU_MIGRATION_PHASE_POSTCOPY_FAILED));
qemuMigrationJobContinue(vm, qemuProcessCleanupMigrationJob);
} else {
@@ -6093,7 +6093,7 @@ qemuMigrationSrcPerformJob(virQEMUDriver *driver,
if (ret < 0)
virErrorPreserveLast(&orig_err);
- if (virDomainObjIsFailedPostcopy(vm)) {
+ if (virDomainObjIsFailedPostcopy(vm, vm->job)) {
ignore_value(qemuMigrationJobSetPhase(vm,
QEMU_MIGRATION_PHASE_POSTCOPY_FAILED));
qemuMigrationJobContinue(vm, qemuProcessCleanupMigrationJob);
} else {
@@ -6184,7 +6184,7 @@ qemuMigrationSrcPerformPhase(virQEMUDriver *driver,
ret = 0;
cleanup:
- if (ret < 0 && !virDomainObjIsFailedPostcopy(vm)) {
+ if (ret < 0 && !virDomainObjIsFailedPostcopy(vm, vm->job)) {
qemuMigrationSrcRestoreDomainState(driver, vm);
qemuMigrationParamsReset(vm, VIR_ASYNC_JOB_MIGRATION_OUT,
jobPriv->migParams, vm->job->apiFlags);
@@ -6725,7 +6725,7 @@ qemuMigrationDstFinishActive(virQEMUDriver *driver,
}
}
- if (virDomainObjIsFailedPostcopy(vm)) {
+ if (virDomainObjIsFailedPostcopy(vm, vm->job)) {
ignore_value(qemuMigrationJobSetPhase(vm,
QEMU_MIGRATION_PHASE_POSTCOPY_FAILED));
qemuProcessAutoDestroyRemove(driver, vm);
*finishJob = false;
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 2e989256ff..6091c9f1a9 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1473,7 +1473,7 @@ qemuProcessHandleMigrationStatus(qemuMonitor *mon G_GNUC_UNUSED,
break;
case QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY_RECOVER:
- if (virDomainObjIsFailedPostcopy(vm)) {
+ if (virDomainObjIsFailedPostcopy(vm, vm->job)) {
int eventType = -1;
int eventDetail = -1;
@@ -1503,7 +1503,7 @@ qemuProcessHandleMigrationStatus(qemuMonitor *mon G_GNUC_UNUSED,
* watching it in any thread. Let's make sure the migration is properly
* finished in case we get a "completed" event.
*/
- if (virDomainObjIsPostcopy(vm) &&
+ if (virDomainObjIsPostcopy(vm, vm->job) &&
vm->job->phase == QEMU_MIGRATION_PHASE_POSTCOPY_FAILED &&
vm->job->asyncOwner == 0) {
qemuProcessEventSubmit(vm, QEMU_PROCESS_EVENT_UNATTENDED_MIGRATION,
@@ -3476,7 +3476,7 @@ qemuProcessRecoverMigrationIn(virQEMUDriver *driver,
/* migration finished, we started resuming the domain but didn't
* confirm success or failure yet; killing it seems safest unless
* we already started guest CPUs or we were in post-copy mode */
- if (virDomainObjIsPostcopy(vm))
+ if (virDomainObjIsPostcopy(vm, job))
return 1;
if (state != VIR_DOMAIN_RUNNING) {
@@ -3511,7 +3511,7 @@ qemuProcessRecoverMigrationOut(virQEMUDriver *driver,
int reason,
unsigned int *stopFlags)
{
- bool postcopy = virDomainObjIsPostcopy(vm);
+ bool postcopy = virDomainObjIsPostcopy(vm, job);
bool resume = false;
VIR_DEBUG("Active outgoing migration in phase %s",
--
2.39.0