[PATCH 5/5] migration: Rename MIG_EVENT_PRECOPY_* to MIG_EVENT_*

Peter Xu posted 5 patches 2 days, 11 hours ago
Maintainers: Peter Maydell <peter.maydell@linaro.org>, "Michael S. Tsirkin" <mst@redhat.com>, Jason Wang <jasowang@redhat.com>, Peter Xu <peterx@redhat.com>, Fabiano Rosas <farosas@suse.de>, Mark Kanda <mark.kanda@oracle.com>, Ben Chaney <bchaney@akamai.com>, Alex Williamson <alex@shazbot.org>, "Cédric Le Goater" <clg@redhat.com>, Stefano Garzarella <sgarzare@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>
[PATCH 5/5] migration: Rename MIG_EVENT_PRECOPY_* to MIG_EVENT_*
Posted by Peter Xu 2 days, 11 hours ago
All three events are shared between precopy and postcopy, rather than
precopy specific.

For example, both precopy and postcopy will go through a SETUP process.

Meanwhile, both FAILED and DONE notifiers will be notified for either
precopy or postcopy on completions / failures.

Rename them to make them match what they do, and shorter.

Signed-off-by: Peter Xu <peterx@redhat.com>
---
 include/migration/misc.h | 14 +++++++-------
 hw/intc/arm_gicv3_kvm.c  |  2 +-
 hw/net/virtio-net.c      |  4 ++--
 hw/vfio/cpr-legacy.c     |  2 +-
 hw/vfio/cpr.c            |  8 ++++----
 hw/vfio/migration.c      |  4 ++--
 migration/cpr-exec.c     |  6 +++---
 migration/migration.c    |  8 ++++----
 net/vhost-vdpa.c         |  4 ++--
 ui/spice-core.c          |  6 +++---
 10 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/include/migration/misc.h b/include/migration/misc.h
index b002466e10..766de998cb 100644
--- a/include/migration/misc.h
+++ b/include/migration/misc.h
@@ -60,10 +60,10 @@ bool migration_is_running(void);
 bool migration_thread_is_self(void);
 
 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;
 
@@ -73,7 +73,7 @@ typedef struct MigrationEvent {
 
 /*
  * 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,
@@ -83,9 +83,9 @@ typedef int (*MigrationNotifyFunc)(NotifierWithReturn *notify,
  * Register the notifier @notify to be called when a migration event occurs
  * for MIG_MODE_NORMAL, as specified by the MigrationEvent passed to @func.
  * Notifiers may receive events in any of the following orders:
- *    - MIG_EVENT_PRECOPY_SETUP -> MIG_EVENT_PRECOPY_DONE
- *    - MIG_EVENT_PRECOPY_SETUP -> MIG_EVENT_PRECOPY_FAILED
- *    - MIG_EVENT_PRECOPY_FAILED
+ *    - MIG_EVENT_SETUP -> MIG_EVENT_DONE
+ *    - MIG_EVENT_SETUP -> MIG_EVENT_FAILED
+ *    - MIG_EVENT_FAILED
  */
 void migration_add_notifier(NotifierWithReturn *notify,
                             MigrationNotifyFunc func);
diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c
index 6f311e37ef..fddeefa26f 100644
--- a/hw/intc/arm_gicv3_kvm.c
+++ b/hw/intc/arm_gicv3_kvm.c
@@ -774,7 +774,7 @@ static void vm_change_state_handler(void *opaque, bool running,
 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,
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 317f1ad23b..3e2dc30da6 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -3786,7 +3786,7 @@ static void virtio_net_handle_migration_primary(VirtIONet *n, MigrationEvent *e)
 
     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);
@@ -3794,7 +3794,7 @@ static void virtio_net_handle_migration_primary(VirtIONet *n, MigrationEvent *e)
         } 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) {
diff --git a/hw/vfio/cpr-legacy.c b/hw/vfio/cpr-legacy.c
index 7c03ddb961..033a546c30 100644
--- a/hw/vfio/cpr-legacy.c
+++ b/hw/vfio/cpr-legacy.c
@@ -137,7 +137,7 @@ static int vfio_cpr_fail_notifier(NotifierWithReturn *notifier,
         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;
     }
 
diff --git a/hw/vfio/cpr.c b/hw/vfio/cpr.c
index 998230d271..ffa4f8e099 100644
--- a/hw/vfio/cpr.c
+++ b/hw/vfio/cpr.c
@@ -18,7 +18,7 @@
 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,
@@ -186,7 +186,7 @@ static int vfio_cpr_kvm_close_notifier(NotifierWithReturn *notifier,
                                        MigrationEvent *e,
                                        Error **errp)
 {
-    if (e->type == MIG_EVENT_PRECOPY_DONE) {
+    if (e->type == MIG_EVENT_DONE) {
         vfio_kvm_device_close();
     }
     return 0;
@@ -272,9 +272,9 @@ static int vfio_cpr_pci_notifier(NotifierWithReturn *notifier,
     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;
diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
index f857dc25ed..76a902b79c 100644
--- a/hw/vfio/migration.c
+++ b/hw/vfio/migration.c
@@ -917,10 +917,10 @@ static int vfio_migration_state_notifier(NotifierWithReturn *notifier,
 
     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,
diff --git a/migration/cpr-exec.c b/migration/cpr-exec.c
index da287d8031..18a71828c3 100644
--- a/migration/cpr-exec.c
+++ b/migration/cpr-exec.c
@@ -164,7 +164,7 @@ static void cpr_exec_cb(void *opaque)
     err = NULL;
 
     /* Note, we can go from state COMPLETED to FAILED */
-    migration_call_notifiers(s, MIG_EVENT_PRECOPY_FAILED, NULL);
+    migration_call_notifiers(s, MIG_EVENT_FAILED, NULL);
 
     if (!migration_block_activate(&err)) {
         /* error was already reported */
@@ -182,12 +182,12 @@ static int cpr_exec_notifier(NotifierWithReturn *notifier, MigrationEvent *e,
 {
     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;
diff --git a/migration/migration.c b/migration/migration.c
index 5bef14ea99..7ba37afb27 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1540,7 +1540,7 @@ static void migration_cleanup(MigrationState *s)
      * migration completed successfully.
      */
     if (!migration_has_failed(s)) {
-        migration_call_notifiers(s, MIG_EVENT_PRECOPY_DONE, NULL);
+        migration_call_notifiers(s, MIG_EVENT_DONE, NULL);
     }
 
     yank_unregister_instance(MIGRATION_YANK_INSTANCE);
@@ -1720,7 +1720,7 @@ int migration_call_notifiers(MigrationState *s, MigrationEventType type,
         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;
         }
     }
@@ -3598,7 +3598,7 @@ static void migration_iteration_finish(MigrationState *s)
          * Notify FAILED before starting VM, so that devices can invoke
          * necessary fallbacks before vCPUs run again.
          */
-        migration_call_notifiers(s, MIG_EVENT_PRECOPY_FAILED, NULL);
+        migration_call_notifiers(s, MIG_EVENT_FAILED, NULL);
 
         if (runstate_is_live(s->vm_old_state)) {
             if (!runstate_check(RUN_STATE_SHUTDOWN)) {
@@ -4064,7 +4064,7 @@ void migration_connect(MigrationState *s, Error *error_in)
         rate_limit = migrate_max_bandwidth();
 
         /* Notify before starting migration thread */
-        if (migration_call_notifiers(s, MIG_EVENT_PRECOPY_SETUP, &local_err)) {
+        if (migration_call_notifiers(s, MIG_EVENT_SETUP, &local_err)) {
             goto fail;
         }
     }
diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index 74d26a9497..f4b1f0e9e0 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -378,9 +378,9 @@ static int vdpa_net_migration_state_notifier(NotifierWithReturn *notifier,
 {
     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;
diff --git a/ui/spice-core.c b/ui/spice-core.c
index ce3c2954e3..ee13ecc4a5 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
@@ -583,13 +583,13 @@ static int migration_state_notifier(NotifierWithReturn *notifier,
         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;
     }
-- 
2.50.1
Re: [PATCH 5/5] migration: Rename MIG_EVENT_PRECOPY_* to MIG_EVENT_*
Posted by Fabiano Rosas 1 day, 21 hours ago
Peter Xu <peterx@redhat.com> writes:

> All three events are shared between precopy and postcopy, rather than
> precopy specific.
>
> For example, both precopy and postcopy will go through a SETUP process.
>
> Meanwhile, both FAILED and DONE notifiers will be notified for either
> precopy or postcopy on completions / failures.
>
> Rename them to make them match what they do, and shorter.
>
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
>  include/migration/misc.h | 14 +++++++-------
>  hw/intc/arm_gicv3_kvm.c  |  2 +-
>  hw/net/virtio-net.c      |  4 ++--
>  hw/vfio/cpr-legacy.c     |  2 +-
>  hw/vfio/cpr.c            |  8 ++++----
>  hw/vfio/migration.c      |  4 ++--
>  migration/cpr-exec.c     |  6 +++---
>  migration/migration.c    |  8 ++++----
>  net/vhost-vdpa.c         |  4 ++--
>  ui/spice-core.c          |  6 +++---
>  10 files changed, 29 insertions(+), 29 deletions(-)
>
> diff --git a/include/migration/misc.h b/include/migration/misc.h
> index b002466e10..766de998cb 100644
> --- a/include/migration/misc.h
> +++ b/include/migration/misc.h
> @@ -60,10 +60,10 @@ bool migration_is_running(void);
>  bool migration_thread_is_self(void);
>  
>  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;
>  
> @@ -73,7 +73,7 @@ typedef struct MigrationEvent {
>  
>  /*
>   * 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,
> @@ -83,9 +83,9 @@ typedef int (*MigrationNotifyFunc)(NotifierWithReturn *notify,
>   * Register the notifier @notify to be called when a migration event occurs
>   * for MIG_MODE_NORMAL, as specified by the MigrationEvent passed to @func.
>   * Notifiers may receive events in any of the following orders:
> - *    - MIG_EVENT_PRECOPY_SETUP -> MIG_EVENT_PRECOPY_DONE
> - *    - MIG_EVENT_PRECOPY_SETUP -> MIG_EVENT_PRECOPY_FAILED
> - *    - MIG_EVENT_PRECOPY_FAILED
> + *    - MIG_EVENT_SETUP -> MIG_EVENT_DONE
> + *    - MIG_EVENT_SETUP -> MIG_EVENT_FAILED
> + *    - MIG_EVENT_FAILED
>   */
>  void migration_add_notifier(NotifierWithReturn *notify,
>                              MigrationNotifyFunc func);
> diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c
> index 6f311e37ef..fddeefa26f 100644
> --- a/hw/intc/arm_gicv3_kvm.c
> +++ b/hw/intc/arm_gicv3_kvm.c
> @@ -774,7 +774,7 @@ static void vm_change_state_handler(void *opaque, bool running,
>  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,
> diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
> index 317f1ad23b..3e2dc30da6 100644
> --- a/hw/net/virtio-net.c
> +++ b/hw/net/virtio-net.c
> @@ -3786,7 +3786,7 @@ static void virtio_net_handle_migration_primary(VirtIONet *n, MigrationEvent *e)
>  
>      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);
> @@ -3794,7 +3794,7 @@ static void virtio_net_handle_migration_primary(VirtIONet *n, MigrationEvent *e)
>          } 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) {
> diff --git a/hw/vfio/cpr-legacy.c b/hw/vfio/cpr-legacy.c
> index 7c03ddb961..033a546c30 100644
> --- a/hw/vfio/cpr-legacy.c
> +++ b/hw/vfio/cpr-legacy.c
> @@ -137,7 +137,7 @@ static int vfio_cpr_fail_notifier(NotifierWithReturn *notifier,
>          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;
>      }
>  
> diff --git a/hw/vfio/cpr.c b/hw/vfio/cpr.c
> index 998230d271..ffa4f8e099 100644
> --- a/hw/vfio/cpr.c
> +++ b/hw/vfio/cpr.c
> @@ -18,7 +18,7 @@
>  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,
> @@ -186,7 +186,7 @@ static int vfio_cpr_kvm_close_notifier(NotifierWithReturn *notifier,
>                                         MigrationEvent *e,
>                                         Error **errp)
>  {
> -    if (e->type == MIG_EVENT_PRECOPY_DONE) {
> +    if (e->type == MIG_EVENT_DONE) {
>          vfio_kvm_device_close();
>      }
>      return 0;
> @@ -272,9 +272,9 @@ static int vfio_cpr_pci_notifier(NotifierWithReturn *notifier,
>      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;
> diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
> index f857dc25ed..76a902b79c 100644
> --- a/hw/vfio/migration.c
> +++ b/hw/vfio/migration.c
> @@ -917,10 +917,10 @@ static int vfio_migration_state_notifier(NotifierWithReturn *notifier,
>  
>      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,
> diff --git a/migration/cpr-exec.c b/migration/cpr-exec.c
> index da287d8031..18a71828c3 100644
> --- a/migration/cpr-exec.c
> +++ b/migration/cpr-exec.c
> @@ -164,7 +164,7 @@ static void cpr_exec_cb(void *opaque)
>      err = NULL;
>  
>      /* Note, we can go from state COMPLETED to FAILED */
> -    migration_call_notifiers(s, MIG_EVENT_PRECOPY_FAILED, NULL);
> +    migration_call_notifiers(s, MIG_EVENT_FAILED, NULL);
>  
>      if (!migration_block_activate(&err)) {
>          /* error was already reported */
> @@ -182,12 +182,12 @@ static int cpr_exec_notifier(NotifierWithReturn *notifier, MigrationEvent *e,
>  {
>      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;
> diff --git a/migration/migration.c b/migration/migration.c
> index 5bef14ea99..7ba37afb27 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -1540,7 +1540,7 @@ static void migration_cleanup(MigrationState *s)
>       * migration completed successfully.
>       */
>      if (!migration_has_failed(s)) {
> -        migration_call_notifiers(s, MIG_EVENT_PRECOPY_DONE, NULL);
> +        migration_call_notifiers(s, MIG_EVENT_DONE, NULL);
>      }
>  
>      yank_unregister_instance(MIGRATION_YANK_INSTANCE);
> @@ -1720,7 +1720,7 @@ int migration_call_notifiers(MigrationState *s, MigrationEventType type,
>          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;
>          }
>      }
> @@ -3598,7 +3598,7 @@ static void migration_iteration_finish(MigrationState *s)
>           * Notify FAILED before starting VM, so that devices can invoke
>           * necessary fallbacks before vCPUs run again.
>           */
> -        migration_call_notifiers(s, MIG_EVENT_PRECOPY_FAILED, NULL);
> +        migration_call_notifiers(s, MIG_EVENT_FAILED, NULL);
>  
>          if (runstate_is_live(s->vm_old_state)) {
>              if (!runstate_check(RUN_STATE_SHUTDOWN)) {
> @@ -4064,7 +4064,7 @@ void migration_connect(MigrationState *s, Error *error_in)
>          rate_limit = migrate_max_bandwidth();
>  
>          /* Notify before starting migration thread */
> -        if (migration_call_notifiers(s, MIG_EVENT_PRECOPY_SETUP, &local_err)) {
> +        if (migration_call_notifiers(s, MIG_EVENT_SETUP, &local_err)) {
>              goto fail;
>          }
>      }
> diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
> index 74d26a9497..f4b1f0e9e0 100644
> --- a/net/vhost-vdpa.c
> +++ b/net/vhost-vdpa.c
> @@ -378,9 +378,9 @@ static int vdpa_net_migration_state_notifier(NotifierWithReturn *notifier,
>  {
>      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;
> diff --git a/ui/spice-core.c b/ui/spice-core.c
> index ce3c2954e3..ee13ecc4a5 100644
> --- a/ui/spice-core.c
> +++ b/ui/spice-core.c
> @@ -583,13 +583,13 @@ static int migration_state_notifier(NotifierWithReturn *notifier,
>          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;
>      }

Reviewed-by: Fabiano Rosas <farosas@suse.de>