bool
-virDomainObjIsPostcopy(virDomainObj *dom,
- virDomainJobOperation op)
+virDomainObjIsPostcopy(virDomainObj *dom)
{
- if (op != VIR_DOMAIN_JOB_OPERATION_MIGRATION_IN &&
- op != VIR_DOMAIN_JOB_OPERATION_MIGRATION_OUT)
- return false;
-
- if (op == VIR_DOMAIN_JOB_OPERATION_MIGRATION_IN) {
- return (dom->state.state == VIR_DOMAIN_PAUSED &&
- dom->state.reason == VIR_DOMAIN_PAUSED_POSTCOPY_FAILED) ||
- (dom->state.state == VIR_DOMAIN_RUNNING &&
- (dom->state.reason == VIR_DOMAIN_RUNNING_POSTCOPY ||
- dom->state.reason == VIR_DOMAIN_RUNNING_POSTCOPY_FAILED));
- }
+ if (virDomainObjIsFailedPostcopy(dom))
+ return true;
- return dom->state.state == VIR_DOMAIN_PAUSED &&
- (dom->state.reason == VIR_DOMAIN_PAUSED_POSTCOPY ||
- dom->state.reason == VIR_DOMAIN_PAUSED_POSTCOPY_FAILED);
+ return (dom->state.state == VIR_DOMAIN_PAUSED &&
+ dom->state.reason == VIR_DOMAIN_PAUSED_POSTCOPY) ||
+ (dom->state.state == VIR_DOMAIN_RUNNING &&
+ dom->state.reason == VIR_DOMAIN_RUNNING_POSTCOPY);
}
virDomainObjIsFailedPostcopy(virDomainObj *obj)
ATTRIBUTE_NONNULL(1);
bool
-virDomainObjIsPostcopy(virDomainObj *dom,
- virDomainJobOperation op)
+virDomainObjIsPostcopy(virDomainObj *dom)
ATTRIBUTE_NONNULL(1);
virSecurityLabelDef *
if (flags & VIR_DOMAIN_ABORT_JOB_POSTCOPY &&
(vm->job->asyncJob != VIR_ASYNC_JOB_MIGRATION_OUT ||
- !virDomainObjIsPostcopy(vm, VIR_DOMAIN_JOB_OPERATION_MIGRATION_OUT))) {
+ !virDomainObjIsPostcopy(vm))) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("current job is not outgoing migration in post-copy mode"));
goto endjob;
break;
case VIR_ASYNC_JOB_MIGRATION_OUT:
- if (virDomainObjIsPostcopy(vm, VIR_DOMAIN_JOB_OPERATION_MIGRATION_OUT))
+ if (virDomainObjIsPostcopy(vm))
ret = qemuDomainAbortJobPostcopy(vm, flags);
else
ret = qemuDomainAbortJobMigration(vm);
break;
case QEMU_MIGRATION_PHASE_PERFORM3_DONE:
- if (virDomainObjIsPostcopy(vm, VIR_DOMAIN_JOB_OPERATION_MIGRATION_OUT)) {
+ if (virDomainObjIsPostcopy(vm)) {
VIR_DEBUG("Migration protocol interrupted in post-copy mode");
postcopy = true;
} else {
return false;
}
- if (!virDomainObjIsPostcopy(vm, vm->job->current->operation)) {
+ if (!virDomainObjIsPostcopy(vm)) {
virReportError(VIR_ERR_OPERATION_INVALID,
_("migration of domain %s is not in post-copy phase"),
vm->def->name);
virCheckFlags(QEMU_MIGRATION_FLAGS, -1);
if (retcode != 0 &&
- virDomainObjIsPostcopy(vm, VIR_DOMAIN_JOB_OPERATION_MIGRATION_OUT) &&
+ virDomainObjIsPostcopy(vm) &&
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;
* watching it in any thread. Let's make sure the migration is properly
* finished in case we get a "completed" event.
*/
- if (virDomainObjIsPostcopy(vm, vm->job->current->operation) &&
+ if (virDomainObjIsPostcopy(vm) &&
vm->job->phase == QEMU_MIGRATION_PHASE_POSTCOPY_FAILED &&
vm->job->asyncOwner == 0) {
qemuProcessEventSubmit(vm, QEMU_PROCESS_EVENT_UNATTENDED_MIGRATION,
/* 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, VIR_DOMAIN_JOB_OPERATION_MIGRATION_IN))
+ if (virDomainObjIsPostcopy(vm))
return 1;
if (state != VIR_DOMAIN_RUNNING) {
int reason,
unsigned int *stopFlags)
{
- bool postcopy = virDomainObjIsPostcopy(vm, VIR_DOMAIN_JOB_OPERATION_MIGRATION_OUT);
+ bool postcopy = virDomainObjIsPostcopy(vm);
bool resume = false;
VIR_DEBUG("Active outgoing migration in phase %s",