[PATCH 03/10] migration: Remove one migration_in_colo_state() occurance

Peter Xu posted 10 patches 3 days, 11 hours ago
Maintainers: Hailiang Zhang <zhanghailiang@xfusion.com>, Peter Xu <peterx@redhat.com>, Fabiano Rosas <farosas@suse.de>, Markus Armbruster <armbru@redhat.com>
[PATCH 03/10] migration: Remove one migration_in_colo_state() occurance
Posted by Peter Xu 3 days, 11 hours ago
Move the send header operation directly into Xen's QMP command, as COLO
doesn't need it.

Signed-off-by: Peter Xu <peterx@redhat.com>
---
 migration/savevm.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/migration/savevm.c b/migration/savevm.c
index 64bf445c98..61e873d90c 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -1871,9 +1871,6 @@ int qemu_save_device_state(QEMUFile *f)
     Error *local_err = NULL;
     SaveStateEntry *se;
 
-    if (!migration_in_colo_state()) {
-        qemu_savevm_send_header(f);
-    }
     cpu_synchronize_all_states();
 
     QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {
@@ -3335,6 +3332,7 @@ void qmp_xen_save_devices_state(const char *filename, bool has_live, bool live,
     qio_channel_set_name(QIO_CHANNEL(ioc), "migration-xen-save-state");
     f = qemu_file_new_output(QIO_CHANNEL(ioc));
     object_unref(OBJECT(ioc));
+    qemu_savevm_send_header(f);
     ret = qemu_save_device_state(f);
     if (ret < 0 || qemu_fclose(f) < 0) {
         error_setg(errp, "saving Xen device state failed");
-- 
2.50.1
Re: [PATCH 03/10] migration: Remove one migration_in_colo_state() occurance
Posted by Fabiano Rosas 1 day, 20 hours ago
Peter Xu <peterx@redhat.com> writes:

> Move the send header operation directly into Xen's QMP command, as COLO
> doesn't need it.
>
> Signed-off-by: Peter Xu <peterx@redhat.com>

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

We should make an effort to unify qemu_save_device_state and
qemu_savevm_state_complete_precopy_non_iterable, they're almost the
same.

> ---
>  migration/savevm.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/migration/savevm.c b/migration/savevm.c
> index 64bf445c98..61e873d90c 100644
> --- a/migration/savevm.c
> +++ b/migration/savevm.c
> @@ -1871,9 +1871,6 @@ int qemu_save_device_state(QEMUFile *f)
>      Error *local_err = NULL;
>      SaveStateEntry *se;
>  
> -    if (!migration_in_colo_state()) {
> -        qemu_savevm_send_header(f);
> -    }
>      cpu_synchronize_all_states();
>  
>      QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {
> @@ -3335,6 +3332,7 @@ void qmp_xen_save_devices_state(const char *filename, bool has_live, bool live,
>      qio_channel_set_name(QIO_CHANNEL(ioc), "migration-xen-save-state");
>      f = qemu_file_new_output(QIO_CHANNEL(ioc));
>      object_unref(OBJECT(ioc));
> +    qemu_savevm_send_header(f);
>      ret = qemu_save_device_state(f);
>      if (ret < 0 || qemu_fclose(f) < 0) {
>          error_setg(errp, "saving Xen device state failed");