Patchwork [02/41] migration: always use vm_stop_force_state

login
register
mail settings
Submitter Paolo Bonzini
Date Feb. 15, 2013, 5:46 p.m.
Message ID <1360950433-17106-3-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/220834/
State New
Headers show

Comments

Paolo Bonzini - Feb. 15, 2013, 5:46 p.m.
vm_stop_force_state does:

    if (runstate_is_running()) {
        vm_stop(state);
    } else {
        runstate_set(state);
    }

migration.c does:

    if (runstate_is_running()) {
        vm_stop(state);
    } else {
        vm_stop_force_state(state);
    }

The code run is the same even if we always use vm_stop_force_state in
migration.c.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 migration.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)
Orit Wasserman - Feb. 18, 2013, 9:07 a.m.
On 02/15/2013 07:46 PM, Paolo Bonzini wrote:
> vm_stop_force_state does:
> 
>     if (runstate_is_running()) {
>         vm_stop(state);
>     } else {
>         runstate_set(state);
>     }
> 
> migration.c does:
> 
>     if (runstate_is_running()) {
>         vm_stop(state);
>     } else {
>         vm_stop_force_state(state);
>     }
> 
> The code run is the same even if we always use vm_stop_force_state in
> migration.c.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  migration.c |    6 +-----
>  1 files changed, 1 insertions(+), 5 deletions(-)
> 
> diff --git a/migration.c b/migration.c
> index 5414060..2b44268 100644
> --- a/migration.c
> +++ b/migration.c
> @@ -698,11 +698,7 @@ static void *buffered_file_thread(void *opaque)
>                  DPRINTF("done iterating\n");
>                  start_time = qemu_get_clock_ms(rt_clock);
>                  qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER);
> -                if (old_vm_running) {
> -                    vm_stop(RUN_STATE_FINISH_MIGRATE);
> -                } else {
> -                    vm_stop_force_state(RUN_STATE_FINISH_MIGRATE);
> -                }
> +                vm_stop_force_state(RUN_STATE_FINISH_MIGRATE);
>                  ret = qemu_savevm_state_complete(s->file);
>                  if (ret < 0) {
>                      qemu_mutex_unlock_iothread();
> 
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Juan Quintela - Feb. 21, 2013, 5:06 p.m.
Paolo Bonzini <pbonzini@redhat.com> wrote:
> vm_stop_force_state does:
>
>     if (runstate_is_running()) {
>         vm_stop(state);
>     } else {
>         runstate_set(state);
>     }
>
> migration.c does:
>
>     if (runstate_is_running()) {
>         vm_stop(state);
>     } else {
>         vm_stop_force_state(state);
>     }
>
> The code run is the same even if we always use vm_stop_force_state in
> migration.c.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Juan Quintela <quintela@redhat.com>

Patch

diff --git a/migration.c b/migration.c
index 5414060..2b44268 100644
--- a/migration.c
+++ b/migration.c
@@ -698,11 +698,7 @@  static void *buffered_file_thread(void *opaque)
                 DPRINTF("done iterating\n");
                 start_time = qemu_get_clock_ms(rt_clock);
                 qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER);
-                if (old_vm_running) {
-                    vm_stop(RUN_STATE_FINISH_MIGRATE);
-                } else {
-                    vm_stop_force_state(RUN_STATE_FINISH_MIGRATE);
-                }
+                vm_stop_force_state(RUN_STATE_FINISH_MIGRATE);
                 ret = qemu_savevm_state_complete(s->file);
                 if (ret < 0) {
                     qemu_mutex_unlock_iothread();