qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC PATCH v2 10/23] COLO ctl: introduce is_slave() and is_


From: Yang Hongyang
Subject: [Qemu-devel] [RFC PATCH v2 10/23] COLO ctl: introduce is_slave() and is_master()
Date: Tue, 23 Sep 2014 17:23:42 +0800

is_slaver is to determine whether the QEMU instance is a
slaver(migration target) at runtime.
is_master is to determine whether the QEMU instance is a
master(migration starter) at runtime.
This 2 APIs will be used later.

Signed-off-by: Yang Hongyang <address@hidden>
---
 migration-colo.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/migration-colo.c b/migration-colo.c
index 8610e15..37003f5 100644
--- a/migration-colo.c
+++ b/migration-colo.c
@@ -83,6 +83,12 @@ static __attribute__((unused)) int colo_compare_resume(void)
 
 /* save */
 
+static __attribute__((unused)) bool colo_is_master(void)
+{
+    MigrationState *s = migrate_get_current();
+    return (s->state == MIG_STATE_COLO);
+}
+
 static void *colo_thread(void *opaque)
 {
     MigrationState *s = opaque;
@@ -166,6 +172,11 @@ void colo_init_checkpointer(MigrationState *s)
 
 static Coroutine *colo;
 
+static __attribute__((unused)) bool colo_is_slave(void)
+{
+    return colo != NULL;
+}
+
 /*
  * return:
  * 0: start a checkpoint
-- 
1.9.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]