* [Qemu-devel] [PATCH] migration: introduce migrate_is_blocked()
@ 2016-05-04 19:44 Greg Kurz
2016-05-11 9:15 ` Greg Kurz
2016-05-11 11:59 ` Paolo Bonzini
0 siblings, 2 replies; 6+ messages in thread
From: Greg Kurz @ 2016-05-04 19:44 UTC (permalink / raw)
To: Juan Quintela; +Cc: Peter Maydell, Dr. David Alan Gilbert, qemu-devel
QEMU has currently two ways to prevent migration to occur:
- migration blocker when it depends on runtime state
- VMStateDescription.unmigratable when migration is not supported at all
This patch gathers all the logic into a single function to be called from
both the savevm and the migrate paths.
This fixes a bug with 9p, at least, where savevm would succeed and the
following would happen in the guest after loadvm:
$ ls /host
ls: cannot access /host: Protocol error
With this patch:
(qemu) savevm foo
Migration is disabled when VirtFS export path '/' is mounted in the guest
using mount_tag 'host'
Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
---
Since there has been some activity on 9p again since a few weeks, maybe it
is not too late for 2.6, if everybody agrees the fix is ok ?
include/migration/migration.h | 1 +
migration/migration.c | 21 +++++++++++++++------
migration/savevm.c | 2 +-
3 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/include/migration/migration.h b/include/migration/migration.h
index ac2c12c2a518..9e36a97fc5e5 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -210,6 +210,7 @@ int migrate_fd_close(MigrationState *s);
void add_migration_state_change_notifier(Notifier *notify);
void remove_migration_state_change_notifier(Notifier *notify);
MigrationState *migrate_init(const MigrationParams *params);
+bool migration_is_blocked(Error **errp);
bool migration_in_setup(MigrationState *);
bool migration_has_finished(MigrationState *);
bool migration_has_failed(MigrationState *);
diff --git a/migration/migration.c b/migration/migration.c
index 991313a8629a..afd883b78179 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -992,6 +992,20 @@ void qmp_migrate_incoming(const char *uri, Error **errp)
once = false;
}
+bool migration_is_blocked(Error **errp)
+{
+ if (qemu_savevm_state_blocked(errp)) {
+ return true;
+ }
+
+ if (migration_blockers) {
+ *errp = error_copy(migration_blockers->data);
+ return true;
+ }
+
+ return false;
+}
+
void qmp_migrate(const char *uri, bool has_blk, bool blk,
bool has_inc, bool inc, bool has_detach, bool detach,
Error **errp)
@@ -1014,12 +1028,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
return;
}
- if (qemu_savevm_state_blocked(errp)) {
- return;
- }
-
- if (migration_blockers) {
- *errp = error_copy(migration_blockers->data);
+ if (migration_is_blocked(errp)) {
return;
}
diff --git a/migration/savevm.c b/migration/savevm.c
index 16ba44379870..834664936dfc 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -1169,7 +1169,7 @@ static int qemu_savevm_state(QEMUFile *f, Error **errp)
MigrationState *ms = migrate_init(¶ms);
ms->to_dst_file = f;
- if (qemu_savevm_state_blocked(errp)) {
+ if (migration_is_blocked(errp)) {
return -EINVAL;
}
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] migration: introduce migrate_is_blocked()
2016-05-04 19:44 [Qemu-devel] [PATCH] migration: introduce migrate_is_blocked() Greg Kurz
@ 2016-05-11 9:15 ` Greg Kurz
2016-05-11 11:59 ` Paolo Bonzini
1 sibling, 0 replies; 6+ messages in thread
From: Greg Kurz @ 2016-05-11 9:15 UTC (permalink / raw)
To: Juan Quintela; +Cc: Peter Maydell, Dr. David Alan Gilbert, qemu-devel
On Wed, 04 May 2016 21:44:19 +0200
Greg Kurz <gkurz@linux.vnet.ibm.com> wrote:
> QEMU has currently two ways to prevent migration to occur:
> - migration blocker when it depends on runtime state
> - VMStateDescription.unmigratable when migration is not supported at all
>
> This patch gathers all the logic into a single function to be called from
> both the savevm and the migrate paths.
>
> This fixes a bug with 9p, at least, where savevm would succeed and the
> following would happen in the guest after loadvm:
>
> $ ls /host
> ls: cannot access /host: Protocol error
>
> With this patch:
>
> (qemu) savevm foo
> Migration is disabled when VirtFS export path '/' is mounted in the guest
> using mount_tag 'host'
>
> Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
> ---
>
Ping ?
> Since there has been some activity on 9p again since a few weeks, maybe it
> is not too late for 2.6, if everybody agrees the fix is ok ?
>
> include/migration/migration.h | 1 +
> migration/migration.c | 21 +++++++++++++++------
> migration/savevm.c | 2 +-
> 3 files changed, 17 insertions(+), 7 deletions(-)
>
> diff --git a/include/migration/migration.h b/include/migration/migration.h
> index ac2c12c2a518..9e36a97fc5e5 100644
> --- a/include/migration/migration.h
> +++ b/include/migration/migration.h
> @@ -210,6 +210,7 @@ int migrate_fd_close(MigrationState *s);
> void add_migration_state_change_notifier(Notifier *notify);
> void remove_migration_state_change_notifier(Notifier *notify);
> MigrationState *migrate_init(const MigrationParams *params);
> +bool migration_is_blocked(Error **errp);
> bool migration_in_setup(MigrationState *);
> bool migration_has_finished(MigrationState *);
> bool migration_has_failed(MigrationState *);
> diff --git a/migration/migration.c b/migration/migration.c
> index 991313a8629a..afd883b78179 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -992,6 +992,20 @@ void qmp_migrate_incoming(const char *uri, Error **errp)
> once = false;
> }
>
> +bool migration_is_blocked(Error **errp)
> +{
> + if (qemu_savevm_state_blocked(errp)) {
> + return true;
> + }
> +
> + if (migration_blockers) {
> + *errp = error_copy(migration_blockers->data);
> + return true;
> + }
> +
> + return false;
> +}
> +
> void qmp_migrate(const char *uri, bool has_blk, bool blk,
> bool has_inc, bool inc, bool has_detach, bool detach,
> Error **errp)
> @@ -1014,12 +1028,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
> return;
> }
>
> - if (qemu_savevm_state_blocked(errp)) {
> - return;
> - }
> -
> - if (migration_blockers) {
> - *errp = error_copy(migration_blockers->data);
> + if (migration_is_blocked(errp)) {
> return;
> }
>
> diff --git a/migration/savevm.c b/migration/savevm.c
> index 16ba44379870..834664936dfc 100644
> --- a/migration/savevm.c
> +++ b/migration/savevm.c
> @@ -1169,7 +1169,7 @@ static int qemu_savevm_state(QEMUFile *f, Error **errp)
> MigrationState *ms = migrate_init(¶ms);
> ms->to_dst_file = f;
>
> - if (qemu_savevm_state_blocked(errp)) {
> + if (migration_is_blocked(errp)) {
> return -EINVAL;
> }
>
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] migration: introduce migrate_is_blocked()
2016-05-04 19:44 [Qemu-devel] [PATCH] migration: introduce migrate_is_blocked() Greg Kurz
2016-05-11 9:15 ` Greg Kurz
@ 2016-05-11 11:59 ` Paolo Bonzini
2016-05-11 12:10 ` Greg Kurz
1 sibling, 1 reply; 6+ messages in thread
From: Paolo Bonzini @ 2016-05-11 11:59 UTC (permalink / raw)
To: Greg Kurz, Juan Quintela
Cc: Peter Maydell, Dr. David Alan Gilbert, qemu-devel
On 04/05/2016 21:44, Greg Kurz wrote:
> QEMU has currently two ways to prevent migration to occur:
> - migration blocker when it depends on runtime state
> - VMStateDescription.unmigratable when migration is not supported at all
>
> This patch gathers all the logic into a single function to be called from
> both the savevm and the migrate paths.
>
> This fixes a bug with 9p, at least, where savevm would succeed and the
> following would happen in the guest after loadvm:
>
> $ ls /host
> ls: cannot access /host: Protocol error
>
> With this patch:
>
> (qemu) savevm foo
> Migration is disabled when VirtFS export path '/' is mounted in the guest
> using mount_tag 'host'
>
> Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
> ---
>
> Since there has been some activity on 9p again since a few weeks, maybe it
> is not too late for 2.6, if everybody agrees the fix is ok ?
The patch is good, but I think the subject should be
savevm: fail if migration blockers are present
The subject you used would be good for the include/migration and
migration/migration.c parts alone (where you introduce the function
without any semantic change).
Apart from this,
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Thanks,
Paolo
> include/migration/migration.h | 1 +
> migration/migration.c | 21 +++++++++++++++------
> migration/savevm.c | 2 +-
> 3 files changed, 17 insertions(+), 7 deletions(-)
>
> diff --git a/include/migration/migration.h b/include/migration/migration.h
> index ac2c12c2a518..9e36a97fc5e5 100644
> --- a/include/migration/migration.h
> +++ b/include/migration/migration.h
> @@ -210,6 +210,7 @@ int migrate_fd_close(MigrationState *s);
> void add_migration_state_change_notifier(Notifier *notify);
> void remove_migration_state_change_notifier(Notifier *notify);
> MigrationState *migrate_init(const MigrationParams *params);
> +bool migration_is_blocked(Error **errp);
> bool migration_in_setup(MigrationState *);
> bool migration_has_finished(MigrationState *);
> bool migration_has_failed(MigrationState *);
> diff --git a/migration/migration.c b/migration/migration.c
> index 991313a8629a..afd883b78179 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -992,6 +992,20 @@ void qmp_migrate_incoming(const char *uri, Error **errp)
> once = false;
> }
>
> +bool migration_is_blocked(Error **errp)
> +{
> + if (qemu_savevm_state_blocked(errp)) {
> + return true;
> + }
> +
> + if (migration_blockers) {
> + *errp = error_copy(migration_blockers->data);
> + return true;
> + }
> +
> + return false;
> +}
> +
> void qmp_migrate(const char *uri, bool has_blk, bool blk,
> bool has_inc, bool inc, bool has_detach, bool detach,
> Error **errp)
> @@ -1014,12 +1028,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
> return;
> }
>
> - if (qemu_savevm_state_blocked(errp)) {
> - return;
> - }
> -
> - if (migration_blockers) {
> - *errp = error_copy(migration_blockers->data);
> + if (migration_is_blocked(errp)) {
> return;
> }
>
> diff --git a/migration/savevm.c b/migration/savevm.c
> index 16ba44379870..834664936dfc 100644
> --- a/migration/savevm.c
> +++ b/migration/savevm.c
> @@ -1169,7 +1169,7 @@ static int qemu_savevm_state(QEMUFile *f, Error **errp)
> MigrationState *ms = migrate_init(¶ms);
> ms->to_dst_file = f;
>
> - if (qemu_savevm_state_blocked(errp)) {
> + if (migration_is_blocked(errp)) {
> return -EINVAL;
> }
>
>
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] migration: introduce migrate_is_blocked()
2016-05-11 11:59 ` Paolo Bonzini
@ 2016-05-11 12:10 ` Greg Kurz
2016-05-23 16:12 ` Amit Shah
0 siblings, 1 reply; 6+ messages in thread
From: Greg Kurz @ 2016-05-11 12:10 UTC (permalink / raw)
To: Paolo Bonzini
Cc: Juan Quintela, Peter Maydell, Dr. David Alan Gilbert, qemu-devel
On Wed, 11 May 2016 13:59:19 +0200
Paolo Bonzini <pbonzini@redhat.com> wrote:
> On 04/05/2016 21:44, Greg Kurz wrote:
> > QEMU has currently two ways to prevent migration to occur:
> > - migration blocker when it depends on runtime state
> > - VMStateDescription.unmigratable when migration is not supported at all
> >
> > This patch gathers all the logic into a single function to be called from
> > both the savevm and the migrate paths.
> >
> > This fixes a bug with 9p, at least, where savevm would succeed and the
> > following would happen in the guest after loadvm:
> >
> > $ ls /host
> > ls: cannot access /host: Protocol error
> >
> > With this patch:
> >
> > (qemu) savevm foo
> > Migration is disabled when VirtFS export path '/' is mounted in the guest
> > using mount_tag 'host'
> >
> > Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
> > ---
> >
> > Since there has been some activity on 9p again since a few weeks, maybe it
> > is not too late for 2.6, if everybody agrees the fix is ok ?
>
> The patch is good, but I think the subject should be
>
> savevm: fail if migration blockers are present
>
> The subject you used would be good for the include/migration and
> migration/migration.c parts alone (where you introduce the function
> without any semantic change).
>
Yeah, I agree the subject you are suggesting is far more informative :)
> Apart from this,
>
> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
>
Thanks for the review !
> Thanks,
>
> Paolo
>
Cheers.
--
Greg
> > include/migration/migration.h | 1 +
> > migration/migration.c | 21 +++++++++++++++------
> > migration/savevm.c | 2 +-
> > 3 files changed, 17 insertions(+), 7 deletions(-)
> >
> > diff --git a/include/migration/migration.h b/include/migration/migration.h
> > index ac2c12c2a518..9e36a97fc5e5 100644
> > --- a/include/migration/migration.h
> > +++ b/include/migration/migration.h
> > @@ -210,6 +210,7 @@ int migrate_fd_close(MigrationState *s);
> > void add_migration_state_change_notifier(Notifier *notify);
> > void remove_migration_state_change_notifier(Notifier *notify);
> > MigrationState *migrate_init(const MigrationParams *params);
> > +bool migration_is_blocked(Error **errp);
> > bool migration_in_setup(MigrationState *);
> > bool migration_has_finished(MigrationState *);
> > bool migration_has_failed(MigrationState *);
> > diff --git a/migration/migration.c b/migration/migration.c
> > index 991313a8629a..afd883b78179 100644
> > --- a/migration/migration.c
> > +++ b/migration/migration.c
> > @@ -992,6 +992,20 @@ void qmp_migrate_incoming(const char *uri, Error **errp)
> > once = false;
> > }
> >
> > +bool migration_is_blocked(Error **errp)
> > +{
> > + if (qemu_savevm_state_blocked(errp)) {
> > + return true;
> > + }
> > +
> > + if (migration_blockers) {
> > + *errp = error_copy(migration_blockers->data);
> > + return true;
> > + }
> > +
> > + return false;
> > +}
> > +
> > void qmp_migrate(const char *uri, bool has_blk, bool blk,
> > bool has_inc, bool inc, bool has_detach, bool detach,
> > Error **errp)
> > @@ -1014,12 +1028,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
> > return;
> > }
> >
> > - if (qemu_savevm_state_blocked(errp)) {
> > - return;
> > - }
> > -
> > - if (migration_blockers) {
> > - *errp = error_copy(migration_blockers->data);
> > + if (migration_is_blocked(errp)) {
> > return;
> > }
> >
> > diff --git a/migration/savevm.c b/migration/savevm.c
> > index 16ba44379870..834664936dfc 100644
> > --- a/migration/savevm.c
> > +++ b/migration/savevm.c
> > @@ -1169,7 +1169,7 @@ static int qemu_savevm_state(QEMUFile *f, Error **errp)
> > MigrationState *ms = migrate_init(¶ms);
> > ms->to_dst_file = f;
> >
> > - if (qemu_savevm_state_blocked(errp)) {
> > + if (migration_is_blocked(errp)) {
> > return -EINVAL;
> > }
> >
> >
> >
> >
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] migration: introduce migrate_is_blocked()
2016-05-11 12:10 ` Greg Kurz
@ 2016-05-23 16:12 ` Amit Shah
2016-05-23 17:06 ` Greg Kurz
0 siblings, 1 reply; 6+ messages in thread
From: Amit Shah @ 2016-05-23 16:12 UTC (permalink / raw)
To: Greg Kurz
Cc: Paolo Bonzini, qemu-devel, Peter Maydell, Dr. David Alan Gilbert,
Juan Quintela
On (Wed) 11 May 2016 [14:10:34], Greg Kurz wrote:
> On Wed, 11 May 2016 13:59:19 +0200
> Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> > On 04/05/2016 21:44, Greg Kurz wrote:
> > > QEMU has currently two ways to prevent migration to occur:
> > > - migration blocker when it depends on runtime state
> > > - VMStateDescription.unmigratable when migration is not supported at all
> > >
> > > This patch gathers all the logic into a single function to be called from
> > > both the savevm and the migrate paths.
> > >
> > > This fixes a bug with 9p, at least, where savevm would succeed and the
> > > following would happen in the guest after loadvm:
> > >
> > > $ ls /host
> > > ls: cannot access /host: Protocol error
> > >
> > > With this patch:
> > >
> > > (qemu) savevm foo
> > > Migration is disabled when VirtFS export path '/' is mounted in the guest
> > > using mount_tag 'host'
> > >
> > > Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
> > > ---
> > >
> > > Since there has been some activity on 9p again since a few weeks, maybe it
> > > is not too late for 2.6, if everybody agrees the fix is ok ?
> >
> > The patch is good, but I think the subject should be
> >
> > savevm: fail if migration blockers are present
> >
> > The subject you used would be good for the include/migration and
> > migration/migration.c parts alone (where you introduce the function
> > without any semantic change).
> >
>
> Yeah, I agree the subject you are suggesting is far more informative :)
I'll apply this with the suggested subject.
Please CC the migration maintainers for faster processing next time
around.
Thanks,
Amit
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] migration: introduce migrate_is_blocked()
2016-05-23 16:12 ` Amit Shah
@ 2016-05-23 17:06 ` Greg Kurz
0 siblings, 0 replies; 6+ messages in thread
From: Greg Kurz @ 2016-05-23 17:06 UTC (permalink / raw)
To: Amit Shah
Cc: Paolo Bonzini, qemu-devel, Peter Maydell, Dr. David Alan Gilbert,
Juan Quintela
On Mon, 23 May 2016 21:42:23 +0530
Amit Shah <amit.shah@redhat.com> wrote:
> On (Wed) 11 May 2016 [14:10:34], Greg Kurz wrote:
> > On Wed, 11 May 2016 13:59:19 +0200
> > Paolo Bonzini <pbonzini@redhat.com> wrote:
> >
> > > On 04/05/2016 21:44, Greg Kurz wrote:
> > > > QEMU has currently two ways to prevent migration to occur:
> > > > - migration blocker when it depends on runtime state
> > > > - VMStateDescription.unmigratable when migration is not supported at all
> > > >
> > > > This patch gathers all the logic into a single function to be called from
> > > > both the savevm and the migrate paths.
> > > >
> > > > This fixes a bug with 9p, at least, where savevm would succeed and the
> > > > following would happen in the guest after loadvm:
> > > >
> > > > $ ls /host
> > > > ls: cannot access /host: Protocol error
> > > >
> > > > With this patch:
> > > >
> > > > (qemu) savevm foo
> > > > Migration is disabled when VirtFS export path '/' is mounted in the guest
> > > > using mount_tag 'host'
> > > >
> > > > Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
> > > > ---
> > > >
> > > > Since there has been some activity on 9p again since a few weeks, maybe it
> > > > is not too late for 2.6, if everybody agrees the fix is ok ?
> > >
> > > The patch is good, but I think the subject should be
> > >
> > > savevm: fail if migration blockers are present
> > >
> > > The subject you used would be good for the include/migration and
> > > migration/migration.c parts alone (where you introduce the function
> > > without any semantic change).
> > >
> >
> > Yeah, I agree the subject you are suggesting is far more informative :)
>
> I'll apply this with the suggested subject.
>
> Please CC the migration maintainers for faster processing next time
> around.
>
I had Cc'd Juan (who happens to be away) but I forgot your address... my bad :\
> Thanks,
>
> Amit
>
Cheers !
--
Greg
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-05-23 17:07 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-04 19:44 [Qemu-devel] [PATCH] migration: introduce migrate_is_blocked() Greg Kurz
2016-05-11 9:15 ` Greg Kurz
2016-05-11 11:59 ` Paolo Bonzini
2016-05-11 12:10 ` Greg Kurz
2016-05-23 16:12 ` Amit Shah
2016-05-23 17:06 ` Greg Kurz
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.