* [Qemu-devel] [patch] introduce MIG_STATE_CANCELLING state
@ 2013-11-07 11:01 Zhanghaoyu (A)
2013-11-07 11:21 ` Paolo Bonzini
2013-12-06 2:00 ` [Qemu-devel] " Wenchao Xia
0 siblings, 2 replies; 4+ messages in thread
From: Zhanghaoyu (A) @ 2013-11-07 11:01 UTC (permalink / raw)
To: qemu-devel@nongnu.org, Paolo Bonzini, Michael S. Tsirkin,
Marcelo Tosatti, Eric Blake, Gleb Natapov
Cc: Huangweidong (C), Luonengjun, Zengjunliang, Wangrui (K)
Introduce MIG_STATE_CANCELLING state to avoid starting a new migration task while the previous one still exist.
Signed-off-by: Zeng Junliang <zengjunliang@huawei.com>
Signed-off-by: Zhang Haoyu <haoyu.zhang@huawei.com>
---
migration.c | 26 ++++++++++++++++----------
1 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/migration.c b/migration.c
index fd73b97..af8a09c 100644
--- a/migration.c
+++ b/migration.c
@@ -40,6 +40,7 @@ enum {
MIG_STATE_ERROR = -1,
MIG_STATE_NONE,
MIG_STATE_SETUP,
+ MIG_STATE_CANCELLING,
MIG_STATE_CANCELLED,
MIG_STATE_ACTIVE,
MIG_STATE_COMPLETED,
@@ -196,6 +197,7 @@ MigrationInfo *qmp_query_migrate(Error **errp)
info->has_total_time = false;
break;
case MIG_STATE_ACTIVE:
+ case MIG_STATE_CANCELLING:
info->has_status = true;
info->status = g_strdup("active");
info->has_total_time = true;
@@ -282,6 +284,13 @@ void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params,
/* shared migration helpers */
+static void migrate_set_state(MigrationState *s, int old_state, int new_state)
+{
+ if (atomic_cmpxchg(&s->state, old_state, new_state) == new_state) {
+ trace_migrate_set_state(new_state);
+ }
+}
+
static void migrate_fd_cleanup(void *opaque)
{
MigrationState *s = opaque;
@@ -303,18 +312,14 @@ static void migrate_fd_cleanup(void *opaque)
if (s->state != MIG_STATE_COMPLETED) {
qemu_savevm_state_cancel();
+ if (s->state == MIG_STATE_CANCELLING) {
+ migrate_set_state(s, MIG_STATE_CANCELLING, MIG_STATE_CANCELLED);
+ }
}
notifier_list_notify(&migration_state_notifiers, s);
}
-static void migrate_set_state(MigrationState *s, int old_state, int new_state)
-{
- if (atomic_cmpxchg(&s->state, old_state, new_state) == new_state) {
- trace_migrate_set_state(new_state);
- }
-}
-
void migrate_fd_error(MigrationState *s)
{
DPRINTF("setting error state\n");
@@ -334,8 +339,8 @@ static void migrate_fd_cancel(MigrationState *s)
if (old_state != MIG_STATE_SETUP && old_state != MIG_STATE_ACTIVE) {
break;
}
- migrate_set_state(s, old_state, MIG_STATE_CANCELLED);
- } while (s->state != MIG_STATE_CANCELLED);
+ migrate_set_state(s, old_state, MIG_STATE_CANCELLING);
+ } while (s->state != MIG_STATE_CANCELLING);
}
void add_migration_state_change_notifier(Notifier *notify)
@@ -412,7 +417,8 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
params.blk = has_blk && blk;
params.shared = has_inc && inc;
- if (s->state == MIG_STATE_ACTIVE || s->state == MIG_STATE_SETUP) {
+ if (s->state == MIG_STATE_ACTIVE || s->state == MIG_STATE_SETUP ||
+ s->state == MIG_STATE_CANCELLING) {
error_set(errp, QERR_MIGRATION_ACTIVE);
return;
}
--
1.7.3.1.msysgit.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [patch] introduce MIG_STATE_CANCELLING state
2013-11-07 11:01 [Qemu-devel] [patch] introduce MIG_STATE_CANCELLING state Zhanghaoyu (A)
@ 2013-11-07 11:21 ` Paolo Bonzini
2013-12-05 15:20 ` [Qemu-devel] PING " Paolo Bonzini
2013-12-06 2:00 ` [Qemu-devel] " Wenchao Xia
1 sibling, 1 reply; 4+ messages in thread
From: Paolo Bonzini @ 2013-11-07 11:21 UTC (permalink / raw)
To: Zhanghaoyu (A)
Cc: Huangweidong (C), Gleb Natapov, Michael S. Tsirkin,
Marcelo Tosatti, Luonengjun, qemu-devel@nongnu.org, Zengjunliang,
Wangrui (K)
Il 07/11/2013 12:01, Zhanghaoyu (A) ha scritto:
> Introduce MIG_STATE_CANCELLING state to avoid starting a new migration task while the previous one still exist.
>
> Signed-off-by: Zeng Junliang <zengjunliang@huawei.com>
> Signed-off-by: Zhang Haoyu <haoyu.zhang@huawei.com>
> ---
> migration.c | 26 ++++++++++++++++----------
> 1 files changed, 16 insertions(+), 10 deletions(-)
>
> diff --git a/migration.c b/migration.c
> index fd73b97..af8a09c 100644
> --- a/migration.c
> +++ b/migration.c
> @@ -40,6 +40,7 @@ enum {
> MIG_STATE_ERROR = -1,
> MIG_STATE_NONE,
> MIG_STATE_SETUP,
> + MIG_STATE_CANCELLING,
> MIG_STATE_CANCELLED,
> MIG_STATE_ACTIVE,
> MIG_STATE_COMPLETED,
> @@ -196,6 +197,7 @@ MigrationInfo *qmp_query_migrate(Error **errp)
> info->has_total_time = false;
> break;
> case MIG_STATE_ACTIVE:
> + case MIG_STATE_CANCELLING:
> info->has_status = true;
> info->status = g_strdup("active");
> info->has_total_time = true;
> @@ -282,6 +284,13 @@ void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params,
>
> /* shared migration helpers */
>
> +static void migrate_set_state(MigrationState *s, int old_state, int new_state)
> +{
> + if (atomic_cmpxchg(&s->state, old_state, new_state) == new_state) {
> + trace_migrate_set_state(new_state);
> + }
> +}
> +
> static void migrate_fd_cleanup(void *opaque)
> {
> MigrationState *s = opaque;
> @@ -303,18 +312,14 @@ static void migrate_fd_cleanup(void *opaque)
>
> if (s->state != MIG_STATE_COMPLETED) {
> qemu_savevm_state_cancel();
> + if (s->state == MIG_STATE_CANCELLING) {
> + migrate_set_state(s, MIG_STATE_CANCELLING, MIG_STATE_CANCELLED);
> + }
> }
>
> notifier_list_notify(&migration_state_notifiers, s);
> }
>
> -static void migrate_set_state(MigrationState *s, int old_state, int new_state)
> -{
> - if (atomic_cmpxchg(&s->state, old_state, new_state) == new_state) {
> - trace_migrate_set_state(new_state);
> - }
> -}
> -
> void migrate_fd_error(MigrationState *s)
> {
> DPRINTF("setting error state\n");
> @@ -334,8 +339,8 @@ static void migrate_fd_cancel(MigrationState *s)
> if (old_state != MIG_STATE_SETUP && old_state != MIG_STATE_ACTIVE) {
> break;
> }
> - migrate_set_state(s, old_state, MIG_STATE_CANCELLED);
> - } while (s->state != MIG_STATE_CANCELLED);
> + migrate_set_state(s, old_state, MIG_STATE_CANCELLING);
> + } while (s->state != MIG_STATE_CANCELLING);
> }
>
> void add_migration_state_change_notifier(Notifier *notify)
> @@ -412,7 +417,8 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
> params.blk = has_blk && blk;
> params.shared = has_inc && inc;
>
> - if (s->state == MIG_STATE_ACTIVE || s->state == MIG_STATE_SETUP) {
> + if (s->state == MIG_STATE_ACTIVE || s->state == MIG_STATE_SETUP ||
> + s->state == MIG_STATE_CANCELLING) {
> error_set(errp, QERR_MIGRATION_ACTIVE);
> return;
> }
>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Qemu-devel] PING Re: [patch] introduce MIG_STATE_CANCELLING state
2013-11-07 11:21 ` Paolo Bonzini
@ 2013-12-05 15:20 ` Paolo Bonzini
0 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2013-12-05 15:20 UTC (permalink / raw)
To: Juan Quintela
Cc: Huangweidong (C), Gleb Natapov, Michael S. Tsirkin,
Zhanghaoyu (A), Marcelo Tosatti, Luonengjun,
qemu-devel@nongnu.org, Zengjunliang, Wangrui (K)
Il 07/11/2013 12:21, Paolo Bonzini ha scritto:
> Il 07/11/2013 12:01, Zhanghaoyu (A) ha scritto:
>> Introduce MIG_STATE_CANCELLING state to avoid starting a new migration task while the previous one still exist.
>>
>> Signed-off-by: Zeng Junliang <zengjunliang@huawei.com>
>> Signed-off-by: Zhang Haoyu <haoyu.zhang@huawei.com>
>> ---
>> migration.c | 26 ++++++++++++++++----------
>> 1 files changed, 16 insertions(+), 10 deletions(-)
>>
>> diff --git a/migration.c b/migration.c
>> index fd73b97..af8a09c 100644
>> --- a/migration.c
>> +++ b/migration.c
>> @@ -40,6 +40,7 @@ enum {
>> MIG_STATE_ERROR = -1,
>> MIG_STATE_NONE,
>> MIG_STATE_SETUP,
>> + MIG_STATE_CANCELLING,
>> MIG_STATE_CANCELLED,
>> MIG_STATE_ACTIVE,
>> MIG_STATE_COMPLETED,
>> @@ -196,6 +197,7 @@ MigrationInfo *qmp_query_migrate(Error **errp)
>> info->has_total_time = false;
>> break;
>> case MIG_STATE_ACTIVE:
>> + case MIG_STATE_CANCELLING:
>> info->has_status = true;
>> info->status = g_strdup("active");
>> info->has_total_time = true;
>> @@ -282,6 +284,13 @@ void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params,
>>
>> /* shared migration helpers */
>>
>> +static void migrate_set_state(MigrationState *s, int old_state, int new_state)
>> +{
>> + if (atomic_cmpxchg(&s->state, old_state, new_state) == new_state) {
>> + trace_migrate_set_state(new_state);
>> + }
>> +}
>> +
>> static void migrate_fd_cleanup(void *opaque)
>> {
>> MigrationState *s = opaque;
>> @@ -303,18 +312,14 @@ static void migrate_fd_cleanup(void *opaque)
>>
>> if (s->state != MIG_STATE_COMPLETED) {
>> qemu_savevm_state_cancel();
>> + if (s->state == MIG_STATE_CANCELLING) {
>> + migrate_set_state(s, MIG_STATE_CANCELLING, MIG_STATE_CANCELLED);
>> + }
>> }
>>
>> notifier_list_notify(&migration_state_notifiers, s);
>> }
>>
>> -static void migrate_set_state(MigrationState *s, int old_state, int new_state)
>> -{
>> - if (atomic_cmpxchg(&s->state, old_state, new_state) == new_state) {
>> - trace_migrate_set_state(new_state);
>> - }
>> -}
>> -
>> void migrate_fd_error(MigrationState *s)
>> {
>> DPRINTF("setting error state\n");
>> @@ -334,8 +339,8 @@ static void migrate_fd_cancel(MigrationState *s)
>> if (old_state != MIG_STATE_SETUP && old_state != MIG_STATE_ACTIVE) {
>> break;
>> }
>> - migrate_set_state(s, old_state, MIG_STATE_CANCELLED);
>> - } while (s->state != MIG_STATE_CANCELLED);
>> + migrate_set_state(s, old_state, MIG_STATE_CANCELLING);
>> + } while (s->state != MIG_STATE_CANCELLING);
>> }
>>
>> void add_migration_state_change_notifier(Notifier *notify)
>> @@ -412,7 +417,8 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
>> params.blk = has_blk && blk;
>> params.shared = has_inc && inc;
>>
>> - if (s->state == MIG_STATE_ACTIVE || s->state == MIG_STATE_SETUP) {
>> + if (s->state == MIG_STATE_ACTIVE || s->state == MIG_STATE_SETUP ||
>> + s->state == MIG_STATE_CANCELLING) {
>> error_set(errp, QERR_MIGRATION_ACTIVE);
>> return;
>> }
>>
>
> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Ping.
Juan?
Paolo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [patch] introduce MIG_STATE_CANCELLING state
2013-11-07 11:01 [Qemu-devel] [patch] introduce MIG_STATE_CANCELLING state Zhanghaoyu (A)
2013-11-07 11:21 ` Paolo Bonzini
@ 2013-12-06 2:00 ` Wenchao Xia
1 sibling, 0 replies; 4+ messages in thread
From: Wenchao Xia @ 2013-12-06 2:00 UTC (permalink / raw)
To: Zhanghaoyu (A), qemu-devel@nongnu.org, Paolo Bonzini,
Michael S. Tsirkin, Marcelo Tosatti, Eric Blake, Gleb Natapov
Cc: Luonengjun, Wangrui (K), Huangweidong (C), Zengjunliang
Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-12-06 2:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-07 11:01 [Qemu-devel] [patch] introduce MIG_STATE_CANCELLING state Zhanghaoyu (A)
2013-11-07 11:21 ` Paolo Bonzini
2013-12-05 15:20 ` [Qemu-devel] PING " Paolo Bonzini
2013-12-06 2:00 ` [Qemu-devel] " Wenchao Xia
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).