[libvirt PATCH v3 2/4] qemu_monitor: add support for get qemu migration blockers

Eugenio Perez Martin eperezma at redhat.com
Wed Jul 20 14:18:16 UTC 2022


On Wed, Jul 20, 2022 at 3:58 PM Jiri Denemark <jdenemar at redhat.com> wrote:
>
> On Wed, Jul 20, 2022 at 14:15:56 +0200, Eugenio Pérez wrote:
> > since qemu 6.0, if migration is blocked for some reason, 'query-migrate'
> > will return an array of error strings describing the migration blockers.
> > This can be used to check whether there are any devices blocking
> > migration, etc.
> >
> > Enable qemu monitor to send this query.  This will allow
> > qemuMigrationSrcIsAllowed to dynamically ask for migration blockers,
> > reducing duplication.
> >
> > Signed-off-by: Eugenio Pérez <eperezma at redhat.com>
> > ---
> > v3:
> > * Squash some patches
> > * Return ok in qemuMonitorJSONGetMigrationBlockers is there are no
> >   blockers.
> > * Move note to function doc.
> > ---
> >  src/qemu/qemu_monitor.c      | 11 +++++++++
> >  src/qemu/qemu_monitor.h      |  4 ++++
> >  src/qemu/qemu_monitor_json.c | 43 ++++++++++++++++++++++++++++++++++++
> >  src/qemu/qemu_monitor_json.h |  3 +++
> >  4 files changed, 61 insertions(+)
> >
> > diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
> > index 109107eaae..e0939beecd 100644
> > --- a/src/qemu/qemu_monitor.c
> > +++ b/src/qemu/qemu_monitor.c
> > @@ -4486,3 +4486,14 @@ qemuMonitorMigrateRecover(qemuMonitor *mon,
> >
> >      return qemuMonitorJSONMigrateRecover(mon, uri);
> >  }
> > +
> > +int
> > +qemuMonitorGetMigrationBlockers(qemuMonitor *mon,
> > +                                char ***blockers)
> > +{
> > +    VIR_DEBUG("blockers=%p", blockers);
> > +
> > +    QEMU_CHECK_MONITOR(mon);
> > +
> > +    return qemuMonitorJSONGetMigrationBlockers(mon, blockers);
> > +}
> > diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
> > index cc1a0bc8c9..b82f198285 100644
> > --- a/src/qemu/qemu_monitor.h
> > +++ b/src/qemu/qemu_monitor.h
> > @@ -1543,3 +1543,7 @@ qemuMonitorChangeMemoryRequestedSize(qemuMonitor *mon,
> >  int
> >  qemuMonitorMigrateRecover(qemuMonitor *mon,
> >                            const char *uri);
> > +
> > +int
> > +qemuMonitorGetMigrationBlockers(qemuMonitor *mon,
> > +                                char ***blockers);
> > diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
> > index 5e4a86e5ad..6d15a458a3 100644
> > --- a/src/qemu/qemu_monitor_json.c
> > +++ b/src/qemu/qemu_monitor_json.c
> > @@ -3338,6 +3338,49 @@ int qemuMonitorJSONMigrate(qemuMonitor *mon,
> >      return 0;
> >  }
> >
> > +/*
> > + * Get the exposed migration blockers.
> > + *
> > + * This function assume qemu has the capability of request them.
> > + *
> > + * It returns a NULL terminated array on blockers if there are any, or it set
> > + * it to NULL otherwise.
> > + */
> > +int qemuMonitorJSONGetMigrationBlockers(qemuMonitor *mon,
>
> I'm sorry for not noticing this in v2, but the return type should be on
> a separate line (yeah, I know the three functions around the place you
> put yours do not follow this).
>

I'll send a new version with this.

> I can change it before pushing to avoid trivial v4 if you don't mind.
>
> With the change
> Reviewed-by: Jiri Denemark <jdenemar at redhat.com>
>



More information about the libvir-list mailing list