qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: peterx@redhat.com, qemu-devel@nongnu.org, laine@redhat.com
Subject: Re: [PATCH] migration: Provide a test for migratability
Date: Thu, 21 Jan 2021 20:17:18 +0000	[thread overview]
Message-ID: <20210121201718.GT3072@work-vm> (raw)
In-Reply-To: <20210121130442.370b9569@omen.home.shazbot.org>

* 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



  reply	other threads:[~2021-01-21 20:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210121201718.GT3072@work-vm \
    --to=dgilbert@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=laine@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).