* [PATCH] migration: Provide a test for migratability
@ 2021-01-21 18:51 Dr. David Alan Gilbert (git)
2021-01-21 20:04 ` Alex Williamson
2021-01-21 22:28 ` Eric Blake
0 siblings, 2 replies; 6+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2021-01-21 18:51 UTC (permalink / raw)
To: qemu-devel, eblake, alex.williamson, laine, peterx
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Provide a simple way to see if there's currently a migration blocker in
operation:
$ ./x86_64-softmmu/qemu-system-x86_64 -nographic -M pc,usb=on -chardev null,id=n -device usb-serial,chardev=n
(qemu) info migratable
Error: State blocked by non-migratable device '0000:00:01.2/1/usb-serial'
$ ./x86_64-softmmu/qemu-system-x86_64 -nographic
(qemu) info migratable
Migratable
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
hmp-commands-info.hx | 14 ++++++++++++++
include/monitor/hmp.h | 1 +
migration/migration.c | 5 +++++
monitor/hmp-cmds.c | 13 +++++++++++++
qapi/migration.json | 14 ++++++++++++++
5 files changed, 47 insertions(+)
diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
index 117ba25f91..c2d7ac2f11 100644
--- a/hmp-commands-info.hx
+++ b/hmp-commands-info.hx
@@ -541,6 +541,20 @@ SRST
Show migration status.
ERST
+ {
+ .name = "migratable",
+ .args_type = "",
+ .params = "",
+ .help = "tests if VM is migratable",
+ .cmd = hmp_info_migratable,
+ },
+
+SRST
+ ''info migratable''
+ Tests whether the VM is currently migratable.
+ERST
+
+
{
.name = "migrate_capabilities",
.args_type = "",
diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
index ed2913fd18..0dd7941daf 100644
--- a/include/monitor/hmp.h
+++ b/include/monitor/hmp.h
@@ -25,6 +25,7 @@ void hmp_info_status(Monitor *mon, const QDict *qdict);
void hmp_info_uuid(Monitor *mon, const QDict *qdict);
void hmp_info_chardev(Monitor *mon, const QDict *qdict);
void hmp_info_mice(Monitor *mon, const QDict *qdict);
+void hmp_info_migratable(Monitor *mon, const QDict *qdict);
void hmp_info_migrate(Monitor *mon, const QDict *qdict);
void hmp_info_migrate_capabilities(Monitor *mon, const QDict *qdict);
void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict);
diff --git a/migration/migration.c b/migration/migration.c
index 5e330cc6eb..8745a5b9f9 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -2234,6 +2234,11 @@ int64_t qmp_query_migrate_cache_size(Error **errp)
return migrate_xbzrle_cache_size();
}
+void qmp_query_migratable(Error **errp)
+{
+ migration_is_blocked(errp);
+}
+
void qmp_migrate_set_speed(int64_t value, Error **errp)
{
MigrateSetParameters p = {
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index ef569035f8..a7f48b3512 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -216,6 +216,19 @@ static char *SocketAddress_to_str(SocketAddress *addr)
}
}
+void hmp_info_migratable(Monitor *mon, const QDict *qdict)
+{
+ Error *err = NULL;
+ /* It's migratable if this succeeds */
+ qmp_query_migratable(&err);
+ if (err) {
+ hmp_handle_error(mon, err);
+ return;
+ }
+
+ monitor_printf(mon, "Migratable\n");
+}
+
void hmp_info_migrate(Monitor *mon, const QDict *qdict)
{
MigrationInfo *info;
diff --git a/qapi/migration.json b/qapi/migration.json
index d1d9632c2a..07aee9907c 100644
--- a/qapi/migration.json
+++ b/qapi/migration.json
@@ -366,6 +366,20 @@
##
{ 'command': 'query-migrate', 'returns': 'MigrationInfo' }
+##
+# @query-migratable:
+# Tests whether it will be possible to migrate the VM in the current state.
+#
+# Returns: nothing on success (i.e. if the VM is migratable)
+#
+# Since: 6.0
+# Example:
+#
+# -> { "execute": "query-migratable" }
+# <- { "return": {} }
+##
+{ 'command': 'query-migratable' }
+
##
# @MigrationCapability:
#
--
2.29.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] migration: Provide a test for migratability
2021-01-21 18:51 [PATCH] migration: Provide a test for migratability Dr. David Alan Gilbert (git)
@ 2021-01-21 20:04 ` Alex Williamson
2021-01-21 20:17 ` Dr. David Alan Gilbert
2021-01-21 22:28 ` Eric Blake
1 sibling, 1 reply; 6+ messages in thread
From: Alex Williamson @ 2021-01-21 20:04 UTC (permalink / raw)
To: Dr. David Alan Gilbert (git); +Cc: peterx, qemu-devel, laine
On Thu, 21 Jan 2021 18:51:13 +0000
"Dr. David Alan Gilbert (git)" <dgilbert@redhat.com> wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
>
> Provide a simple way to see if there's currently a migration blocker in
> operation:
>
> $ ./x86_64-softmmu/qemu-system-x86_64 -nographic -M pc,usb=on -chardev null,id=n -device usb-serial,chardev=n
>
> (qemu) info migratable
> Error: State blocked by non-migratable device '0000:00:01.2/1/usb-serial'
FWIW, a vfio device gets:
(qemu) info migratable
Error: VFIO device doesn't support migration
I think your example is getting the device string because you're
testing something with unmigratable = 1 in the vmsd and the iterator
prints a generic string plus the device, we'd need to make our error
message include the device info. But even without that it seems more
useful than we have currently. Thanks
Tested-by: Alex Williamson <alex.williamson@redhat.com>
> $ ./x86_64-softmmu/qemu-system-x86_64 -nographic
>
> (qemu) info migratable
> Migratable
>
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
> hmp-commands-info.hx | 14 ++++++++++++++
> include/monitor/hmp.h | 1 +
> migration/migration.c | 5 +++++
> monitor/hmp-cmds.c | 13 +++++++++++++
> qapi/migration.json | 14 ++++++++++++++
> 5 files changed, 47 insertions(+)
>
> diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
> index 117ba25f91..c2d7ac2f11 100644
> --- a/hmp-commands-info.hx
> +++ b/hmp-commands-info.hx
> @@ -541,6 +541,20 @@ SRST
> Show migration status.
> ERST
>
> + {
> + .name = "migratable",
> + .args_type = "",
> + .params = "",
> + .help = "tests if VM is migratable",
> + .cmd = hmp_info_migratable,
> + },
> +
> +SRST
> + ''info migratable''
> + Tests whether the VM is currently migratable.
> +ERST
> +
> +
> {
> .name = "migrate_capabilities",
> .args_type = "",
> diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
> index ed2913fd18..0dd7941daf 100644
> --- a/include/monitor/hmp.h
> +++ b/include/monitor/hmp.h
> @@ -25,6 +25,7 @@ void hmp_info_status(Monitor *mon, const QDict *qdict);
> void hmp_info_uuid(Monitor *mon, const QDict *qdict);
> void hmp_info_chardev(Monitor *mon, const QDict *qdict);
> void hmp_info_mice(Monitor *mon, const QDict *qdict);
> +void hmp_info_migratable(Monitor *mon, const QDict *qdict);
> void hmp_info_migrate(Monitor *mon, const QDict *qdict);
> void hmp_info_migrate_capabilities(Monitor *mon, const QDict *qdict);
> void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict);
> diff --git a/migration/migration.c b/migration/migration.c
> index 5e330cc6eb..8745a5b9f9 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -2234,6 +2234,11 @@ int64_t qmp_query_migrate_cache_size(Error **errp)
> return migrate_xbzrle_cache_size();
> }
>
> +void qmp_query_migratable(Error **errp)
> +{
> + migration_is_blocked(errp);
> +}
> +
> void qmp_migrate_set_speed(int64_t value, Error **errp)
> {
> MigrateSetParameters p = {
> diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
> index ef569035f8..a7f48b3512 100644
> --- a/monitor/hmp-cmds.c
> +++ b/monitor/hmp-cmds.c
> @@ -216,6 +216,19 @@ static char *SocketAddress_to_str(SocketAddress *addr)
> }
> }
>
> +void hmp_info_migratable(Monitor *mon, const QDict *qdict)
> +{
> + Error *err = NULL;
> + /* It's migratable if this succeeds */
> + qmp_query_migratable(&err);
> + if (err) {
> + hmp_handle_error(mon, err);
> + return;
> + }
> +
> + monitor_printf(mon, "Migratable\n");
> +}
> +
> void hmp_info_migrate(Monitor *mon, const QDict *qdict)
> {
> MigrationInfo *info;
> diff --git a/qapi/migration.json b/qapi/migration.json
> index d1d9632c2a..07aee9907c 100644
> --- a/qapi/migration.json
> +++ b/qapi/migration.json
> @@ -366,6 +366,20 @@
> ##
> { 'command': 'query-migrate', 'returns': 'MigrationInfo' }
>
> +##
> +# @query-migratable:
> +# Tests whether it will be possible to migrate the VM in the current state.
> +#
> +# Returns: nothing on success (i.e. if the VM is migratable)
> +#
> +# Since: 6.0
> +# Example:
> +#
> +# -> { "execute": "query-migratable" }
> +# <- { "return": {} }
> +##
> +{ 'command': 'query-migratable' }
> +
> ##
> # @MigrationCapability:
> #
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] migration: Provide a test for migratability
2021-01-21 20:04 ` Alex Williamson
@ 2021-01-21 20:17 ` Dr. David Alan Gilbert
0 siblings, 0 replies; 6+ messages in thread
From: Dr. David Alan Gilbert @ 2021-01-21 20:17 UTC (permalink / raw)
To: Alex Williamson; +Cc: peterx, qemu-devel, laine
* Alex Williamson (alex.williamson@redhat.com) wrote:
> On Thu, 21 Jan 2021 18:51:13 +0000
> "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com> wrote:
>
> > From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> >
> > Provide a simple way to see if there's currently a migration blocker in
> > operation:
> >
> > $ ./x86_64-softmmu/qemu-system-x86_64 -nographic -M pc,usb=on -chardev null,id=n -device usb-serial,chardev=n
> >
> > (qemu) info migratable
> > Error: State blocked by non-migratable device '0000:00:01.2/1/usb-serial'
>
> FWIW, a vfio device gets:
>
> (qemu) info migratable
> Error: VFIO device doesn't support migration
>
> I think your example is getting the device string because you're
> testing something with unmigratable = 1 in the vmsd and the iterator
> prints a generic string plus the device, we'd need to make our error
> message include the device info. But even without that it seems more
> useful than we have currently. Thanks
The 'migrate_add_blocker' function just takes the error you give it;
it would be nice to add something like a device_add_migrate_blocker
that filled in the name.
> Tested-by: Alex Williamson <alex.williamson@redhat.com>
Thanks.
Dave
>
> > $ ./x86_64-softmmu/qemu-system-x86_64 -nographic
> >
> > (qemu) info migratable
> > Migratable
> >
> > Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> > ---
> > hmp-commands-info.hx | 14 ++++++++++++++
> > include/monitor/hmp.h | 1 +
> > migration/migration.c | 5 +++++
> > monitor/hmp-cmds.c | 13 +++++++++++++
> > qapi/migration.json | 14 ++++++++++++++
> > 5 files changed, 47 insertions(+)
> >
> > diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
> > index 117ba25f91..c2d7ac2f11 100644
> > --- a/hmp-commands-info.hx
> > +++ b/hmp-commands-info.hx
> > @@ -541,6 +541,20 @@ SRST
> > Show migration status.
> > ERST
> >
> > + {
> > + .name = "migratable",
> > + .args_type = "",
> > + .params = "",
> > + .help = "tests if VM is migratable",
> > + .cmd = hmp_info_migratable,
> > + },
> > +
> > +SRST
> > + ''info migratable''
> > + Tests whether the VM is currently migratable.
> > +ERST
> > +
> > +
> > {
> > .name = "migrate_capabilities",
> > .args_type = "",
> > diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
> > index ed2913fd18..0dd7941daf 100644
> > --- a/include/monitor/hmp.h
> > +++ b/include/monitor/hmp.h
> > @@ -25,6 +25,7 @@ void hmp_info_status(Monitor *mon, const QDict *qdict);
> > void hmp_info_uuid(Monitor *mon, const QDict *qdict);
> > void hmp_info_chardev(Monitor *mon, const QDict *qdict);
> > void hmp_info_mice(Monitor *mon, const QDict *qdict);
> > +void hmp_info_migratable(Monitor *mon, const QDict *qdict);
> > void hmp_info_migrate(Monitor *mon, const QDict *qdict);
> > void hmp_info_migrate_capabilities(Monitor *mon, const QDict *qdict);
> > void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict);
> > diff --git a/migration/migration.c b/migration/migration.c
> > index 5e330cc6eb..8745a5b9f9 100644
> > --- a/migration/migration.c
> > +++ b/migration/migration.c
> > @@ -2234,6 +2234,11 @@ int64_t qmp_query_migrate_cache_size(Error **errp)
> > return migrate_xbzrle_cache_size();
> > }
> >
> > +void qmp_query_migratable(Error **errp)
> > +{
> > + migration_is_blocked(errp);
> > +}
> > +
> > void qmp_migrate_set_speed(int64_t value, Error **errp)
> > {
> > MigrateSetParameters p = {
> > diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
> > index ef569035f8..a7f48b3512 100644
> > --- a/monitor/hmp-cmds.c
> > +++ b/monitor/hmp-cmds.c
> > @@ -216,6 +216,19 @@ static char *SocketAddress_to_str(SocketAddress *addr)
> > }
> > }
> >
> > +void hmp_info_migratable(Monitor *mon, const QDict *qdict)
> > +{
> > + Error *err = NULL;
> > + /* It's migratable if this succeeds */
> > + qmp_query_migratable(&err);
> > + if (err) {
> > + hmp_handle_error(mon, err);
> > + return;
> > + }
> > +
> > + monitor_printf(mon, "Migratable\n");
> > +}
> > +
> > void hmp_info_migrate(Monitor *mon, const QDict *qdict)
> > {
> > MigrationInfo *info;
> > diff --git a/qapi/migration.json b/qapi/migration.json
> > index d1d9632c2a..07aee9907c 100644
> > --- a/qapi/migration.json
> > +++ b/qapi/migration.json
> > @@ -366,6 +366,20 @@
> > ##
> > { 'command': 'query-migrate', 'returns': 'MigrationInfo' }
> >
> > +##
> > +# @query-migratable:
> > +# Tests whether it will be possible to migrate the VM in the current state.
> > +#
> > +# Returns: nothing on success (i.e. if the VM is migratable)
> > +#
> > +# Since: 6.0
> > +# Example:
> > +#
> > +# -> { "execute": "query-migratable" }
> > +# <- { "return": {} }
> > +##
> > +{ 'command': 'query-migratable' }
> > +
> > ##
> > # @MigrationCapability:
> > #
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] migration: Provide a test for migratability
2021-01-21 18:51 [PATCH] migration: Provide a test for migratability Dr. David Alan Gilbert (git)
2021-01-21 20:04 ` Alex Williamson
@ 2021-01-21 22:28 ` Eric Blake
2021-01-25 13:27 ` Dr. David Alan Gilbert
2021-02-02 12:36 ` Dr. David Alan Gilbert
1 sibling, 2 replies; 6+ messages in thread
From: Eric Blake @ 2021-01-21 22:28 UTC (permalink / raw)
To: Dr. David Alan Gilbert (git), qemu-devel, alex.williamson, laine, peterx
On 1/21/21 12:51 PM, Dr. David Alan Gilbert (git) wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
>
> Provide a simple way to see if there's currently a migration blocker in
> operation:
>
> $ ./x86_64-softmmu/qemu-system-x86_64 -nographic -M pc,usb=on -chardev null,id=n -device usb-serial,chardev=n
>
> (qemu) info migratable
> Error: State blocked by non-migratable device '0000:00:01.2/1/usb-serial'
>
> $ ./x86_64-softmmu/qemu-system-x86_64 -nographic
>
> (qemu) info migratable
> Migratable
>
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
> +++ b/qapi/migration.json
> @@ -366,6 +366,20 @@
> ##
> { 'command': 'query-migrate', 'returns': 'MigrationInfo' }
>
> +##
> +# @query-migratable:
> +# Tests whether it will be possible to migrate the VM in the current state.
> +#
> +# Returns: nothing on success (i.e. if the VM is migratable)
Do we really need a new command? Or can we get away with enhancing the
existing 'query-migrate' to add another bool field to 'MigrationInfo'?
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] migration: Provide a test for migratability
2021-01-21 22:28 ` Eric Blake
@ 2021-01-25 13:27 ` Dr. David Alan Gilbert
2021-02-02 12:36 ` Dr. David Alan Gilbert
1 sibling, 0 replies; 6+ messages in thread
From: Dr. David Alan Gilbert @ 2021-01-25 13:27 UTC (permalink / raw)
To: Eric Blake; +Cc: alex.williamson, peterx, qemu-devel, laine
* Eric Blake (eblake@redhat.com) wrote:
> On 1/21/21 12:51 PM, Dr. David Alan Gilbert (git) wrote:
> > From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> >
> > Provide a simple way to see if there's currently a migration blocker in
> > operation:
> >
> > $ ./x86_64-softmmu/qemu-system-x86_64 -nographic -M pc,usb=on -chardev null,id=n -device usb-serial,chardev=n
> >
> > (qemu) info migratable
> > Error: State blocked by non-migratable device '0000:00:01.2/1/usb-serial'
> >
> > $ ./x86_64-softmmu/qemu-system-x86_64 -nographic
> >
> > (qemu) info migratable
> > Migratable
> >
> > Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> > ---
>
>
> > +++ b/qapi/migration.json
> > @@ -366,6 +366,20 @@
> > ##
> > { 'command': 'query-migrate', 'returns': 'MigrationInfo' }
> >
> > +##
> > +# @query-migratable:
> > +# Tests whether it will be possible to migrate the VM in the current state.
> > +#
> > +# Returns: nothing on success (i.e. if the VM is migratable)
>
> Do we really need a new command? Or can we get away with enhancing the
> existing 'query-migrate' to add another bool field to 'MigrationInfo'?
In the case where the VM is not migratable this command errors with the
message set in a migration-blocker (Our migration blocker mechanism
always takes an Error* as the reason).
It didn't seem right to make that change for the existing commands;
so how would you like the existing MigrationInfo to change; a boolean to
say yes/no, and an error/list of errors for the reason?
Dave
> --
> Eric Blake, Principal Software Engineer
> Red Hat, Inc. +1-919-301-3226
> Virtualization: qemu.org | libvirt.org
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] migration: Provide a test for migratability
2021-01-21 22:28 ` Eric Blake
2021-01-25 13:27 ` Dr. David Alan Gilbert
@ 2021-02-02 12:36 ` Dr. David Alan Gilbert
1 sibling, 0 replies; 6+ messages in thread
From: Dr. David Alan Gilbert @ 2021-02-02 12:36 UTC (permalink / raw)
To: Eric Blake; +Cc: alex.williamson, peterx, qemu-devel, laine
* Eric Blake (eblake@redhat.com) wrote:
> On 1/21/21 12:51 PM, Dr. David Alan Gilbert (git) wrote:
> > From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> >
> > Provide a simple way to see if there's currently a migration blocker in
> > operation:
> >
> > $ ./x86_64-softmmu/qemu-system-x86_64 -nographic -M pc,usb=on -chardev null,id=n -device usb-serial,chardev=n
> >
> > (qemu) info migratable
> > Error: State blocked by non-migratable device '0000:00:01.2/1/usb-serial'
> >
> > $ ./x86_64-softmmu/qemu-system-x86_64 -nographic
> >
> > (qemu) info migratable
> > Migratable
> >
> > Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> > ---
>
>
> > +++ b/qapi/migration.json
> > @@ -366,6 +366,20 @@
> > ##
> > { 'command': 'query-migrate', 'returns': 'MigrationInfo' }
> >
> > +##
> > +# @query-migratable:
> > +# Tests whether it will be possible to migrate the VM in the current state.
> > +#
> > +# Returns: nothing on success (i.e. if the VM is migratable)
>
> Do we really need a new command? Or can we get away with enhancing the
> existing 'query-migrate' to add another bool field to 'MigrationInfo'?
OK, new version of this coming up, glued into query-migrate.
Dave
> --
> Eric Blake, Principal Software Engineer
> Red Hat, Inc. +1-919-301-3226
> Virtualization: qemu.org | libvirt.org
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-02-02 12:37 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-21 18:51 [PATCH] migration: Provide a test for migratability Dr. David Alan Gilbert (git)
2021-01-21 20:04 ` Alex Williamson
2021-01-21 20:17 ` Dr. David Alan Gilbert
2021-01-21 22:28 ` Eric Blake
2021-01-25 13:27 ` Dr. David Alan Gilbert
2021-02-02 12:36 ` Dr. David Alan Gilbert
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.