[libvirt] [PATCH 2/2] qemu: Add pre-migration hook

Jiri Denemark jdenemar at redhat.com
Wed Feb 29 12:55:16 UTC 2012


On Tue, Feb 28, 2012 at 17:04:29 -0700, Eric Blake wrote:
> On 02/28/2012 02:49 PM, Jiri Denemark wrote:
> > This hook is called during the Prepare phase on destination host and may
> > be used for changing domain XML.
> > ---
> >  docs/hooks.html.in        |   35 +++++++++++++++++++++++------------
> >  src/qemu/qemu_migration.c |   40 ++++++++++++++++++++++++++++++++++++++++
> >  src/util/hooks.c          |    3 ++-
> >  src/util/hooks.h          |    1 +
> >  4 files changed, 66 insertions(+), 13 deletions(-)
...
> > @@ -1150,6 +1152,43 @@ qemuMigrationPrepareAny(struct qemud_driver *driver,
> >              goto cleanup;
> >      }
> >  
> > +    /* Let migration hook filter domain XML */
> > +    if (virHookPresent(VIR_HOOK_DRIVER_QEMU)) {
> > +        char *xml = virDomainDefFormat(def, VIR_DOMAIN_XML_SECURE);
> > +        int hookret;
> > +
> > +        hookret = virHookCall(VIR_HOOK_DRIVER_QEMU, def->name,
> > +                              VIR_HOOK_QEMU_OP_MIGRATE, VIR_HOOK_SUBOP_BEGIN,
> > +                              NULL, xml, &xmlout);
> 
> Needs to check for xml being NULL on OOM before virHookCall.

Oops, I just copy&pasted the code from other places, where domain XML is
probably not so important so we don't care if the hook gets it or not.

> ACK with those issues fixed.

I fixed the issues and pushed this small series. Thanks.

Jirka




More information about the libvir-list mailing list