mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-19 11:05:16 +00:00
qemu_migration: Refactor qemuMigrationSrcRestoreDomainState
None of the callers really care about the return value so we can drop it and simplify the code a bit. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
899bf2746a
commit
e46e64be50
@ -219,28 +219,27 @@ qemuMigrationSrcStoreDomainState(virDomainObj *vm)
|
|||||||
priv->preMigrationState, vm);
|
priv->preMigrationState, vm);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns true if the domain was resumed, false otherwise */
|
|
||||||
static bool
|
static void
|
||||||
qemuMigrationSrcRestoreDomainState(virQEMUDriver *driver, virDomainObj *vm)
|
qemuMigrationSrcRestoreDomainState(virQEMUDriver *driver, virDomainObj *vm)
|
||||||
{
|
{
|
||||||
qemuDomainObjPrivate *priv = vm->privateData;
|
qemuDomainObjPrivate *priv = vm->privateData;
|
||||||
|
virDomainState preMigrationState = priv->preMigrationState;
|
||||||
int reason;
|
int reason;
|
||||||
virDomainState state = virDomainObjGetState(vm, &reason);
|
virDomainState state = virDomainObjGetState(vm, &reason);
|
||||||
bool ret = false;
|
|
||||||
|
priv->preMigrationState = VIR_DOMAIN_NOSTATE;
|
||||||
|
|
||||||
VIR_DEBUG("driver=%p, vm=%p, pre-mig-state=%s, state=%s, reason=%s",
|
VIR_DEBUG("driver=%p, vm=%p, pre-mig-state=%s, state=%s, reason=%s",
|
||||||
driver, vm,
|
driver, vm,
|
||||||
virDomainStateTypeToString(priv->preMigrationState),
|
virDomainStateTypeToString(preMigrationState),
|
||||||
virDomainStateTypeToString(state),
|
virDomainStateTypeToString(state),
|
||||||
virDomainStateReasonToString(state, reason));
|
virDomainStateReasonToString(state, reason));
|
||||||
|
|
||||||
if (state != VIR_DOMAIN_PAUSED ||
|
if (preMigrationState != VIR_DOMAIN_RUNNING ||
|
||||||
|
state != VIR_DOMAIN_PAUSED ||
|
||||||
reason == VIR_DOMAIN_PAUSED_POSTCOPY_FAILED)
|
reason == VIR_DOMAIN_PAUSED_POSTCOPY_FAILED)
|
||||||
goto cleanup;
|
return;
|
||||||
|
|
||||||
if (priv->preMigrationState == VIR_DOMAIN_RUNNING) {
|
|
||||||
/* This is basically the only restore possibility that's safe
|
|
||||||
* and we should attempt to do */
|
|
||||||
|
|
||||||
VIR_DEBUG("Restoring pre-migration state due to migration error");
|
VIR_DEBUG("Restoring pre-migration state due to migration error");
|
||||||
|
|
||||||
@ -262,14 +261,7 @@ qemuMigrationSrcRestoreDomainState(virQEMUDriver *driver, virDomainObj *vm)
|
|||||||
VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR);
|
VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR);
|
||||||
virObjectEventStateQueue(driver->domainEventState, event);
|
virObjectEventStateQueue(driver->domainEventState, event);
|
||||||
}
|
}
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
ret = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
cleanup:
|
|
||||||
priv->preMigrationState = VIR_DOMAIN_NOSTATE;
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user