[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 22/36] migration: Introduce MIG_STATE_SETUP
From: |
Juan Quintela |
Subject: |
Re: [Qemu-devel] [PATCH 22/36] migration: Introduce MIG_STATE_SETUP |
Date: |
Tue, 18 Oct 2011 03:29:46 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) |
Anthony Liguori <address@hidden> wrote:
> On 10/11/2011 05:00 AM, Juan Quintela wrote:
> CODING_STYLE.
>
> Regards,
>
> Anthony Liguori
Attached v2 of this patch. Only change is s/enum migration_state/enum/
>From 990ccd38f0ff916ada859d28831b2be63983c309 Mon Sep 17 00:00:00 2001
Message-Id: <address@hidden>
In-Reply-To: <address@hidden>
References: <address@hidden>
From: Juan Quintela <address@hidden>
Date: Tue, 11 May 2010 23:01:53 +0200
Subject: [PATCH 22/36] migration: Introduce MIG_STATE_SETUP
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 e93f3f7..a01bf4f 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
- Re: [Qemu-devel] [PATCH 14/36] migration: use qemu_file_get_error() return value when possible, (continued)
- [Qemu-devel] [PATCH 15/36] migration: Make *start_outgoing_migration return FdMigrationState, Juan Quintela, 2011/10/11
- [Qemu-devel] [PATCH 20/36] migration: Make all posible migration functions static, Juan Quintela, 2011/10/11
- [Qemu-devel] [PATCH 21/36] migration: move migrate_new to do_migrate, Juan Quintela, 2011/10/11
- [Qemu-devel] [PATCH 19/36] migration: Refactor MigrationState creation, Juan Quintela, 2011/10/11
- [Qemu-devel] [PATCH 22/36] migration: Introduce MIG_STATE_SETUP, Juan Quintela, 2011/10/11
- [Qemu-devel] [PATCH 23/36] migration: Refactor and simplify error checking in migrate_fd_put_ready, Juan Quintela, 2011/10/11
- [Qemu-devel] [PATCH 24/36] migration: Introduce migrate_fd_completed() for consistency, Juan Quintela, 2011/10/11
- [Qemu-devel] [PATCH 28/36] migration: Move exported functions to the end of the file, Juan Quintela, 2011/10/11
- [Qemu-devel] [PATCH 30/36] migration: Use bandwidth_limit directly, Juan Quintela, 2011/10/11
- [Qemu-devel] [PATCH 29/36] migration: create accessor for current_migration, Juan Quintela, 2011/10/11
- [Qemu-devel] [PATCH 31/36] migration: Pass MigrationState in migration notifiers, Juan Quintela, 2011/10/11
- [Qemu-devel] [PATCH 34/36] migration: Don't use callback on file defining it, Juan Quintela, 2011/10/11
- [Qemu-devel] [PATCH 35/36] migration: propagate error correctly, Juan Quintela, 2011/10/11
- [Qemu-devel] [PATCH 36/36] migration: make migration-{tcp, unix} consistent, Juan Quintela, 2011/10/11