diff mbox

[1/7] add migration_active function

Message ID 20110606165823.510648909@amt.cnet
State New
Headers show

Commit Message

Marcelo Tosatti June 6, 2011, 4:55 p.m. UTC
To query whether migration is active.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
diff mbox

Patch

Index: qemu-block-copy/migration.c
===================================================================
--- qemu-block-copy.orig/migration.c
+++ qemu-block-copy/migration.c
@@ -85,8 +85,8 @@  int do_migrate(Monitor *mon, const QDict
     int inc = qdict_get_try_bool(qdict, "inc", 0);
     const char *uri = qdict_get_str(qdict, "uri");
 
-    if (current_migration &&
-        current_migration->get_status(current_migration) == MIG_STATE_ACTIVE) {
+
+    if (migration_active()) {
         monitor_printf(mon, "migration already in progress\n");
         return -1;
     }
@@ -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