Patchwork [03/36] migration: Check that migration is active before cancel it

login
register
mail settings
Submitter Juan Quintela
Date Oct. 11, 2011, 10 a.m.
Message ID <bdca743b51412345d8f5ac257de1c6fcd21c63b8.1318326683.git.quintela@redhat.com>
Download mbox | patch
Permalink /patch/118895/
State New
Headers show

Comments

Juan Quintela - Oct. 11, 2011, 10 a.m.
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 migration.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Anthony Liguori - Oct. 17, 2011, 1:53 p.m.
On 10/11/2011 05:00 AM, Juan Quintela wrote:
> Signed-off-by: Juan Quintela<quintela@redhat.com>

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>

Regards,

Anthony Liguori

> ---
>   migration.c |    4 ++--
>   1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/migration.c b/migration.c
> index 7fd6c23..71b8aad 100644
> --- a/migration.c
> +++ b/migration.c
> @@ -133,9 +133,9 @@ 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;
>   }
>

Patch

diff --git a/migration.c b/migration.c
index 7fd6c23..71b8aad 100644
--- a/migration.c
+++ b/migration.c
@@ -133,9 +133,9 @@  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;
 }