Patchwork [1/7] add migration_active function

login
register
mail settings
Submitter Marcelo Tosatti
Date May 23, 2011, 9:31 p.m.
Message ID <20110523213410.673809978@amt.cnet>
Download mbox | patch
Permalink /patch/97069/
State New
Headers show

Comments

Marcelo Tosatti - May 23, 2011, 9:31 p.m.
To query whether migration is active.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Kevin Wolf - May 27, 2011, 5:43 p.m.
Am 23.05.2011 23:31, schrieb Marcelo Tosatti:
> To query whether migration is active.
> 
> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
> 
> Index: qemu-block-copy/migration.c
> ===================================================================
> --- qemu-block-copy.orig/migration.c
> +++ qemu-block-copy/migration.c
> @@ -480,3 +480,13 @@ int get_migration_state(void)
>          return MIG_STATE_ERROR;
>      }
>  }
> +
> +bool migration_active(void)
> +{
> +    if (current_migration &&
> +        current_migration->get_status(current_migration) == MIG_STATE_ACTIVE) {
> +        return true;
> +    }
> +
> +    return false;
> +}

The very same check already exists open-coded in do_migrate(). Maybe we
should convert it now that a function is available for it?

Kevin
Jes Sorensen - May 30, 2011, 12:53 a.m.
On 05/24/11 06:31, Marcelo Tosatti wrote:
> To query whether migration is active.
> 
> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

ACK

Jes

Patch

Index: qemu-block-copy/migration.c
===================================================================
--- qemu-block-copy.orig/migration.c
+++ qemu-block-copy/migration.c
@@ -480,3 +480,13 @@  int get_migration_state(void)
         return MIG_STATE_ERROR;
     }
 }
+
+bool migration_active(void)
+{
+    if (current_migration &&
+        current_migration->get_status(current_migration) == MIG_STATE_ACTIVE) {
+        return true;
+    }
+
+    return false;
+}
Index: qemu-block-copy/migration.h
===================================================================
--- qemu-block-copy.orig/migration.h
+++ qemu-block-copy/migration.h
@@ -148,4 +148,6 @@  int ram_load(QEMUFile *f, void *opaque, 
 
 extern int incoming_expected;
 
+bool migration_active(void);
+
 #endif