All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] Avoid migration if guest is in postmigrated status
@ 2020-12-09  7:20 Li Zhang
  2020-12-09  9:23 ` David Edmondson
  0 siblings, 1 reply; 3+ messages in thread
From: Li Zhang @ 2020-12-09  7:20 UTC (permalink / raw)
  To: qemu-devel, quintela, dgilbert; +Cc: Li Zhang

This patch is to avoid executing migrations twice, which causes
coredump. After the migration has been completed, guest is in postmigrated
status on source host and the block device is inactive. If executing 
migration again, it will cause coredump and a block error. For exmaple, 
executing #migrate "exec:cat>file" twice on source host, block error:
bdrv_inactivate_recurse: Assertion `!(bs->open_flags & BDRV_O_INACTIVE)' failed

Signed-off-by: Li Zhang <li.zhang@cloud.ionos.com>
---
 migration/migration.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/migration/migration.c b/migration/migration.c
index 87a9b59f83..113f7e1e41 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -2115,6 +2115,11 @@ static bool migrate_prepare(MigrationState *s, bool blk, bool blk_inc,
         return false;
     }
 
+    if (runstate_check(RUN_STATE_POSTMIGRATE)) {
+        error_setg(errp, "Unable to migrate, guest has been migrated");
+        return false;
+    }
+
     if (migration_is_blocked(errp)) {
         return false;
     }
-- 
2.18.4



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] Avoid migration if guest is in postmigrated status
  2020-12-09  7:20 [PATCH 1/1] Avoid migration if guest is in postmigrated status Li Zhang
@ 2020-12-09  9:23 ` David Edmondson
  2020-12-09  9:55   ` Li Zhang
  0 siblings, 1 reply; 3+ messages in thread
From: David Edmondson @ 2020-12-09  9:23 UTC (permalink / raw)
  To: Li Zhang, qemu-devel, quintela, dgilbert; +Cc: Li Zhang

On Wednesday, 2020-12-09 at 07:20:29 GMT, Li Zhang wrote:

> This patch is to avoid executing migrations twice, which causes
> coredump. After the migration has been completed, guest is in postmigrated
> status on source host and the block device is inactive. If executing 
> migration again, it will cause coredump and a block error. For exmaple, 
> executing #migrate "exec:cat>file" twice on source host, block error:
> bdrv_inactivate_recurse: Assertion `!(bs->open_flags & BDRV_O_INACTIVE)' failed
>
> Signed-off-by: Li Zhang <li.zhang@cloud.ionos.com>

There is an existing proposal for this (the same approach) in
https://lore.kernel.org/r/6b704294ad2e405781c38fb38d68c744@h3c.com.

> ---
>  migration/migration.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/migration/migration.c b/migration/migration.c
> index 87a9b59f83..113f7e1e41 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -2115,6 +2115,11 @@ static bool migrate_prepare(MigrationState *s, bool blk, bool blk_inc,
>          return false;
>      }
>  
> +    if (runstate_check(RUN_STATE_POSTMIGRATE)) {
> +        error_setg(errp, "Unable to migrate, guest has been migrated");
> +        return false;
> +    }
> +
>      if (migration_is_blocked(errp)) {
>          return false;
>      }
> -- 
> 2.18.4

dme.
-- 
Ah, oh your hair is beautiful.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] Avoid migration if guest is in postmigrated status
  2020-12-09  9:23 ` David Edmondson
@ 2020-12-09  9:55   ` Li Zhang
  0 siblings, 0 replies; 3+ messages in thread
From: Li Zhang @ 2020-12-09  9:55 UTC (permalink / raw)
  To: David Edmondson; +Cc: Li Zhang, qemu-devel, dgilbert, quintela

[-- Attachment #1: Type: text/plain, Size: 1658 bytes --]

Thanks for telling me that. I didn't notice this patch.
I just caught this error when I used it and read the source code, it should
be fixed.

Thanks
Li

On Wed, Dec 9, 2020 at 5:23 PM David Edmondson <dme@dme.org> wrote:

> On Wednesday, 2020-12-09 at 07:20:29 GMT, Li Zhang wrote:
>
> > This patch is to avoid executing migrations twice, which causes
> > coredump. After the migration has been completed, guest is in
> postmigrated
> > status on source host and the block device is inactive. If executing
> > migration again, it will cause coredump and a block error. For exmaple,
> > executing #migrate "exec:cat>file" twice on source host, block error:
> > bdrv_inactivate_recurse: Assertion `!(bs->open_flags & BDRV_O_INACTIVE)'
> failed
> >
> > Signed-off-by: Li Zhang <li.zhang@cloud.ionos.com>
>
> There is an existing proposal for this (the same approach) in
> https://lore.kernel.org/r/6b704294ad2e405781c38fb38d68c744@h3c.com.
>
> > ---
> >  migration/migration.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/migration/migration.c b/migration/migration.c
> > index 87a9b59f83..113f7e1e41 100644
> > --- a/migration/migration.c
> > +++ b/migration/migration.c
> > @@ -2115,6 +2115,11 @@ static bool migrate_prepare(MigrationState *s,
> bool blk, bool blk_inc,
> >          return false;
> >      }
> >
> > +    if (runstate_check(RUN_STATE_POSTMIGRATE)) {
> > +        error_setg(errp, "Unable to migrate, guest has been migrated");
> > +        return false;
> > +    }
> > +
> >      if (migration_is_blocked(errp)) {
> >          return false;
> >      }
> > --
> > 2.18.4
>
> dme.
> --
> Ah, oh your hair is beautiful.
>

[-- Attachment #2: Type: text/html, Size: 2469 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-12-09  9:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-09  7:20 [PATCH 1/1] Avoid migration if guest is in postmigrated status Li Zhang
2020-12-09  9:23 ` David Edmondson
2020-12-09  9:55   ` Li Zhang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.