static int kvm_arm_gicv3_notifier(NotifierWithReturn *notifier,
MigrationEvent *e, Error **errp)
{
- if (e->type == MIG_EVENT_PRECOPY_DONE) {
+ if (e->type == MIG_EVENT_DONE) {
GICv3State *s = container_of(notifier, GICv3State, cpr_notifier);
return kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_CTRL,
KVM_DEV_ARM_VGIC_SAVE_PENDING_TABLES,
should_be_hidden = qatomic_read(&n->failover_primary_hidden);
- if (e->type == MIG_EVENT_PRECOPY_SETUP && !should_be_hidden) {
+ if (e->type == MIG_EVENT_SETUP && !should_be_hidden) {
if (failover_unplug_primary(n, dev)) {
vmstate_unregister(VMSTATE_IF(dev), qdev_get_vmsd(dev), dev);
qapi_event_send_unplug_primary(dev->id);
} else {
warn_report("couldn't unplug primary device");
}
- } else if (e->type == MIG_EVENT_PRECOPY_FAILED) {
+ } else if (e->type == MIG_EVENT_FAILED) {
/* We already unplugged the device let's plug it back */
if (!failover_replug_primary(n, dev, &err)) {
if (err) {
static int scsi_block_migration_notifier(NotifierWithReturn *notifier,
MigrationEvent *e, Error **errp)
{
- if (e->type == MIG_EVENT_PRECOPY_FAILED) {
+ if (e->type == MIG_EVENT_FAILED) {
SCSIDiskState *s =
container_of(notifier, SCSIDiskState, migration_notifier);
SCSIDevice *d = &s->qdev;
Error *local_err = NULL;
if (!scsi_generic_pr_state_preempt(d, &local_err)) {
- /* MIG_EVENT_PRECOPY_FAILED cannot fail, so just warn */
+ /* MIG_EVENT_FAILED cannot fail, so just warn */
error_prepend(&local_err, "scsi-block migration rollback: ");
warn_report_err(local_err);
}
container_of(notifier, VFIOLegacyContainer, cpr.transfer_notifier);
VFIOContainer *bcontainer = VFIO_IOMMU(container);
- if (e->type != MIG_EVENT_PRECOPY_FAILED) {
+ if (e->type != MIG_EVENT_FAILED) {
return 0;
}
int vfio_cpr_reboot_notifier(NotifierWithReturn *notifier,
MigrationEvent *e, Error **errp)
{
- if (e->type == MIG_EVENT_PRECOPY_SETUP &&
+ if (e->type == MIG_EVENT_SETUP &&
!runstate_check(RUN_STATE_SUSPENDED) && !vm_get_suspended()) {
error_setg(errp,
MigrationEvent *e,
Error **errp)
{
- if (e->type == MIG_EVENT_PRECOPY_DONE) {
+ if (e->type == MIG_EVENT_DONE) {
vfio_kvm_device_close();
}
return 0;
VFIOPCIDevice *vdev =
container_of(notifier, VFIOPCIDevice, cpr.transfer_notifier);
- if (e->type == MIG_EVENT_PRECOPY_SETUP) {
+ if (e->type == MIG_EVENT_SETUP) {
return vfio_cpr_set_msi_virq(vdev, errp, false);
- } else if (e->type == MIG_EVENT_PRECOPY_FAILED) {
+ } else if (e->type == MIG_EVENT_FAILED) {
return vfio_cpr_set_msi_virq(vdev, errp, true);
}
return 0;
trace_vfio_migration_state_notifier(vbasedev->name, e->type);
- if (e->type == MIG_EVENT_PRECOPY_FAILED) {
+ if (e->type == MIG_EVENT_FAILED) {
/*
* MigrationNotifyFunc may not return an error code and an Error
- * object for MIG_EVENT_PRECOPY_FAILED. Hence, report the error
+ * object for MIG_EVENT_FAILED. Hence, report the error
* locally and ignore the errp argument.
*/
ret = vfio_migration_set_state_or_reset(vbasedev,
/*
* Notifiers may receive events in any of the following orders:
*
- * - MIG_EVENT_PRECOPY_SETUP [-> MIG_EVENT_POSTCOPY_START]
- * -> MIG_EVENT_PRECOPY_DONE
- *
- * - MIG_EVENT_PRECOPY_SETUP [-> MIG_EVENT_POSTCOPY_START]
- * -> MIG_EVENT_PRECOPY_FAILED
- *
- * - MIG_EVENT_PRECOPY_FAILED
+ * - MIG_EVENT_SETUP [-> MIG_EVENT_POSTCOPY_START] -> MIG_EVENT_DONE
+ * - MIG_EVENT_SETUP [-> MIG_EVENT_POSTCOPY_START] -> MIG_EVENT_FAILED
+ * - MIG_EVENT_FAILED
*/
typedef enum MigrationEventType {
- MIG_EVENT_PRECOPY_SETUP,
- MIG_EVENT_PRECOPY_DONE,
- MIG_EVENT_PRECOPY_FAILED,
+ MIG_EVENT_SETUP,
MIG_EVENT_POSTCOPY_START,
+ MIG_EVENT_DONE,
+ MIG_EVENT_FAILED,
MIG_EVENT_MAX
} MigrationEventType;
/*
* A MigrationNotifyFunc may return an error code and an Error object,
- * but only when @e->type is MIG_EVENT_PRECOPY_SETUP. The code is an int
+ * but only when @e->type is MIG_EVENT_SETUP. The code is an int
* to allow for different failure modes and recovery actions.
*/
typedef int (*MigrationNotifyFunc)(NotifierWithReturn *notify,
err = NULL;
/* Note, we can go from state COMPLETED to FAILED */
- migration_call_notifiers(MIG_EVENT_PRECOPY_FAILED, NULL);
+ migration_call_notifiers(MIG_EVENT_FAILED, NULL);
if (!migration_block_activate(&err)) {
/* error was already reported */
{
MigrationState *s = migrate_get_current();
- if (e->type == MIG_EVENT_PRECOPY_DONE) {
+ if (e->type == MIG_EVENT_DONE) {
QEMUBH *cpr_exec_bh = qemu_bh_new(cpr_exec_cb, NULL);
assert(s->state == MIGRATION_STATUS_COMPLETED);
qemu_bh_schedule(cpr_exec_bh);
qemu_notify_event();
- } else if (e->type == MIG_EVENT_PRECOPY_FAILED) {
+ } else if (e->type == MIG_EVENT_FAILED) {
cpr_exec_unpersist_state();
}
return 0;
* migration completed successfully.
*/
if (!migration_has_failed(s)) {
- migration_call_notifiers(MIG_EVENT_PRECOPY_DONE, NULL);
+ migration_call_notifiers(MIG_EVENT_DONE, NULL);
}
yank_unregister_instance(MIGRATION_YANK_INSTANCE);
notifier = (NotifierWithReturn *)elem->data;
ret = notifier->notify(notifier, &e, errp);
if (ret) {
- assert(type == MIG_EVENT_PRECOPY_SETUP);
+ assert(type == MIG_EVENT_SETUP);
return ret;
}
}
* Notify FAILED before starting VM, so that devices can invoke
* necessary fallbacks before vCPUs run again.
*/
- migration_call_notifiers(MIG_EVENT_PRECOPY_FAILED, NULL);
+ migration_call_notifiers(MIG_EVENT_FAILED, NULL);
if (runstate_is_live(s->vm_old_state)) {
if (!runstate_check(RUN_STATE_SHUTDOWN)) {
rate_limit = migrate_max_bandwidth();
/* Notify before starting migration thread */
- if (migration_call_notifiers(MIG_EVENT_PRECOPY_SETUP, &local_err)) {
+ if (migration_call_notifiers(MIG_EVENT_SETUP, &local_err)) {
goto fail;
}
}
{
VhostVDPAState *s = container_of(notifier, VhostVDPAState, migration_state);
- if (e->type == MIG_EVENT_PRECOPY_SETUP) {
+ if (e->type == MIG_EVENT_SETUP) {
vhost_vdpa_net_log_global_enable(s, true);
- } else if (e->type == MIG_EVENT_PRECOPY_FAILED) {
+ } else if (e->type == MIG_EVENT_FAILED) {
vhost_vdpa_net_log_global_enable(s, false);
}
return 0;
return 0;
}
- if (e->type == MIG_EVENT_PRECOPY_SETUP) {
+ if (e->type == MIG_EVENT_SETUP) {
spice_server_migrate_start(spice_server);
- } else if (e->type == MIG_EVENT_PRECOPY_DONE ||
+ } else if (e->type == MIG_EVENT_DONE ||
e->type == MIG_EVENT_POSTCOPY_START) {
spice_server_migrate_end(spice_server, true);
spice_have_target_host = false;
- } else if (e->type == MIG_EVENT_PRECOPY_FAILED) {
+ } else if (e->type == MIG_EVENT_FAILED) {
spice_server_migrate_end(spice_server, false);
spice_have_target_host = false;
}