[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 23/37] migration: Introduce MIG_STATE_SETUP
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PATCH 23/37] migration: Introduce MIG_STATE_SETUP |
Date: |
Thu, 20 Oct 2011 02:11:49 +0200 |
Use MIG_STATE_ACTIVE only when migration has really started. Use this
new state to setup migration parameters. Change defines for an
anonymous struct.
Signed-off-by: Juan Quintela <address@hidden>
---
migration.c | 6 +++++-
migration.h | 11 +++++++----
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/migration.c b/migration.c
index ca038ec..281fbae 100644
--- a/migration.c
+++ b/migration.c
@@ -239,6 +239,9 @@ void do_info_migrate(Monitor *mon, QObject **ret_data)
MigrationState *s = current_migration;
switch (s->get_status(current_migration)) {
+ case MIG_STATE_SETUP:
+ /* no migration has happened ever */
+ break;
case MIG_STATE_ACTIVE:
qdict = qdict_new();
qdict_put(qdict, "status", qstring_from_str("active"));
@@ -478,6 +481,7 @@ void migrate_fd_connect(MigrationState *s)
{
int ret;
+ s->state = MIG_STATE_ACTIVE;
s->file = qemu_fopen_ops_buffered(s,
s->bandwidth_limit,
migrate_fd_put_buffer,
@@ -507,7 +511,7 @@ static MigrationState *migrate_new(Monitor *mon, int64_t
bandwidth_limit,
s->shared = inc;
s->mon = NULL;
s->bandwidth_limit = bandwidth_limit;
- s->state = MIG_STATE_ACTIVE;
+ s->state = MIG_STATE_SETUP;
if (!detach) {
migrate_fd_monitor_suspend(s, mon);
diff --git a/migration.h b/migration.h
index 14c3ebc..fed1cf1 100644
--- a/migration.h
+++ b/migration.h
@@ -18,10 +18,13 @@
#include "qemu-common.h"
#include "notify.h"
-#define MIG_STATE_ERROR -1
-#define MIG_STATE_COMPLETED 0
-#define MIG_STATE_CANCELLED 1
-#define MIG_STATE_ACTIVE 2
+enum {
+ MIG_STATE_ERROR,
+ MIG_STATE_SETUP,
+ MIG_STATE_CANCELLED,
+ MIG_STATE_ACTIVE,
+ MIG_STATE_COMPLETED,
+};
typedef struct MigrationState MigrationState;
--
1.7.6.4
- [Qemu-devel] [PATCH v5 00/37] Migration errors & cleanup (the integrated version), Juan Quintela, 2011/10/19
- [Qemu-devel] [PATCH 05/37] migration: If there is one error, it makes no sense to continue, Juan Quintela, 2011/10/19
- [Qemu-devel] [PATCH 14/37] migration: use qemu_file_get_error() return value when possible, Juan Quintela, 2011/10/19
- [Qemu-devel] [PATCH 10/37] migration: change has_error to contain errno values, Juan Quintela, 2011/10/19
- [Qemu-devel] [PATCH 23/37] migration: Introduce MIG_STATE_SETUP,
Juan Quintela <=
- [Qemu-devel] [PATCH 15/37] migration: make *save_live return errors, Juan Quintela, 2011/10/19