Patchwork [08/22] migration: Check that migration is active before cancel it

login
register
mail settings
Submitter Juan Quintela
Date Feb. 23, 2011, 12:44 a.m.
Message ID <ee720c4f6ed4af5b06a40402be78a6f6a6259217.1298421307.git.quintela@redhat.com>
Download mbox | patch
Permalink /patch/84038/
State New
Headers show

Comments

Juan Quintela - Feb. 23, 2011, 12:44 a.m.
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 migration.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Yoshiaki Tamura - Feb. 23, 2011, 8:31 a.m.
2011/2/23 Juan Quintela <quintela@redhat.com>:
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  migration.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/migration.c b/migration.c
> index 397a0b9..55f58c8 100644
> --- a/migration.c
> +++ b/migration.c
> @@ -138,7 +138,7 @@ int do_migrate_cancel(Monitor *mon, const QDict *qdict, QObject **ret_data)
>  {
>     MigrationState *s = current_migration;
>
> -    if (s)
> +    if (s && s->get_status(s) == MIG_STATE_ACTIVE)
>         s->cancel(s);
>
>     return 0;

Why don't you remove *s again?

Yoshi

> --
> 1.7.4
>
>
>
Juan Quintela - Feb. 23, 2011, 9:14 a.m.
Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp> wrote:
> 2011/2/23 Juan Quintela <quintela@redhat.com>:
>> Signed-off-by: Juan Quintela <quintela@redhat.com>
>> ---
>>  migration.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/migration.c b/migration.c
>> index 397a0b9..55f58c8 100644
>> --- a/migration.c
>> +++ b/migration.c
>> @@ -138,7 +138,7 @@ int do_migrate_cancel(Monitor *mon, const QDict *qdict, QObject **ret_data)
>>  {
>>     MigrationState *s = current_migration;
>>
>> -    if (s)
>> +    if (s && s->get_status(s) == MIG_STATE_ACTIVE)
>>         s->cancel(s);
>>
>>     return 0;
>
> Why don't you remove *s again?

Removed in a next patch.

Later, Juan.

Patch

diff --git a/migration.c b/migration.c
index 397a0b9..55f58c8 100644
--- a/migration.c
+++ b/migration.c
@@ -138,7 +138,7 @@  int do_migrate_cancel(Monitor *mon, const QDict *qdict, QObject **ret_data)
 {
     MigrationState *s = current_migration;

-    if (s)
+    if (s && s->get_status(s) == MIG_STATE_ACTIVE)
         s->cancel(s);

     return 0;