[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] migration: Fix possible bug for migrate cancel
From: |
arei.gonglei |
Subject: |
[Qemu-devel] [PATCH] migration: Fix possible bug for migrate cancel |
Date: |
Mon, 24 Mar 2014 21:04:24 +0800 |
From: zengjunliang <address@hidden>
Return error for migrate cancel, when migration status is not
MIG_STATE_SETUP or MIG_STATE_ACTIVE. Thus, libvirt can can
perceive the operation fails.
Signed-off-by: zengjunliang <address@hidden>
Signed-off-by: Gonglei <address@hidden>
---
include/qapi/qmp/qerror.h | 3 +++
migration.c | 5 +++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/include/qapi/qmp/qerror.h b/include/qapi/qmp/qerror.h
index da75abf..b13e3e0 100644
--- a/include/qapi/qmp/qerror.h
+++ b/include/qapi/qmp/qerror.h
@@ -164,6 +164,9 @@ void qerror_report_err(Error *err);
#define QERR_MIGRATION_ACTIVE \
ERROR_CLASS_GENERIC_ERROR, "There's a migration process in progress"
+#define QERR_MIGRATION_COMPLETED \
+ ERROR_CLASS_GENERIC_ERROR, "There's no migration process in progress"
+
#define QERR_MIGRATION_NOT_SUPPORTED \
ERROR_CLASS_GENERIC_ERROR, "State blocked by non-migratable device '%s'"
diff --git a/migration.c b/migration.c
index e0e24d4..2f34c67 100644
--- a/migration.c
+++ b/migration.c
@@ -336,7 +336,7 @@ void migrate_fd_error(MigrationState *s)
notifier_list_notify(&migration_state_notifiers, s);
}
-static void migrate_fd_cancel(MigrationState *s)
+static void migrate_fd_cancel(MigrationState *s, Error **errp)
{
int old_state ;
DPRINTF("cancelling migration\n");
@@ -344,6 +344,7 @@ static void migrate_fd_cancel(MigrationState *s)
do {
old_state = s->state;
if (old_state != MIG_STATE_SETUP && old_state != MIG_STATE_ACTIVE) {
+ error_set(errp, QERR_MIGRATION_COMPLETED);
break;
}
migrate_set_state(s, old_state, MIG_STATE_CANCELLING);
@@ -470,7 +471,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
void qmp_migrate_cancel(Error **errp)
{
- migrate_fd_cancel(migrate_get_current());
+ migrate_fd_cancel(migrate_get_current(), errp);
}
void qmp_migrate_set_cache_size(int64_t value, Error **errp)
--
1.7.12.4
- [Qemu-devel] [PATCH] migration: Fix possible bug for migrate cancel,
arei.gonglei <=
- Re: [Qemu-devel] [PATCH] migration: Fix possible bug for migrate cancel, Eric Blake, 2014/03/24
- Re: [Qemu-devel] [PATCH] migration: Fix possible bug for migrate cancel, Paolo Bonzini, 2014/03/24
- Re: [Qemu-devel] [PATCH] migration: Fix possible bug for migrate cancel, Eric Blake, 2014/03/24
- Re: [Qemu-devel] [PATCH] migration: Fix possible bug for migrate cancel, Gonglei (Arei), 2014/03/25
- Re: [Qemu-devel] [PATCH] migration: Fix possible bug for migrate cancel, Gonglei (Arei), 2014/03/28
- Re: [Qemu-devel] [PATCH] migration: Fix possible bug for migrate cancel, Paolo Bonzini, 2014/03/28
- Re: [Qemu-devel] [PATCH] migration: Fix possible bug for migrate cancel, Dr. David Alan Gilbert, 2014/03/28
- Re: [Qemu-devel] [PATCH] migration: Fix possible bug for migrate cancel, Paolo Bonzini, 2014/03/28