Patchwork [1/3] add migration_active function

login
register
mail settings
Submitter Marcelo Tosatti
Date Dec. 16, 2010, 5:44 p.m.
Message ID <20101216174810.650542462@redhat.com>
Download mbox | patch
Permalink /patch/75785/
State New
Headers show

Comments

Marcelo Tosatti - Dec. 16, 2010, 5:44 p.m.
To query whether migration is active.

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

Patch

Index: qemu-kvm-block-copy/migration.c
===================================================================
--- qemu-kvm-block-copy.orig/migration.c
+++ qemu-kvm-block-copy/migration.c
@@ -448,3 +448,13 @@  int migrate_fd_close(void *opaque)
     qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL);
     return s->close(s);
 }
+
+bool migration_active(void)
+{
+    if (current_migration &&
+        current_migration->get_status(current_migration) == MIG_STATE_ACTIVE) {
+        return true;
+    }
+
+    return false;
+}
Index: qemu-kvm-block-copy/migration.h
===================================================================
--- qemu-kvm-block-copy.orig/migration.h
+++ qemu-kvm-block-copy/migration.h
@@ -134,4 +134,6 @@  static inline FdMigrationState *migrate_
     return container_of(mig_state, FdMigrationState, mig_state);
 }
 
+bool migration_active(void);
+
 #endif