[libvirt] [PATCH] qemu: clean up migration ports when migration cancelled

Wangyufei (A) james.wangyufei at huawei.com
Thu Nov 7 01:42:51 UTC 2013


It's ok. I applied the original patch and I didn't notice it too. No body is perfect. Fortunately, we found and fixed it immediately. I'll be much more careful next time.

Thanks a lot.

> -----Original Message-----
> From: Jiri Denemark [mailto:jdenemar at redhat.com]
> Sent: Wednesday, November 06, 2013 10:09 PM
> To: Wangyufei (A)
> Cc: libvir-list at redhat.com; Zengjunliang; Wangrui (K)
> Subject: Re: [libvirt] [PATCH] qemu: clean up migration ports when migration
> cancelled
> 
> On Wed, Nov 06, 2013 at 04:17:05 +0000, Wangyufei (A) wrote:
> > >From bfb2dafa8ea183781446c7cbe0376e1a2d41a5ae Mon Sep 17
> 00:00:00 2001
> > From: Zeng Junliang <zengjunliang at huawei.com>
> > Date: Wed, 6 Nov 2013 11:36:57 +0800
> > Subject: [PATCH] qemu: clean up migration ports when migration cancelled
> >
> > If there's a migration cancelled, the bitmap of migration port should be
> cleaned up too.
> >
> > Signed-off-by: Zeng Junliang <zengjunliang at huawei.com>
> > ---
> >  src/qemu/qemu_migration.c |    7 +++++--
> >  1 files changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
> > index 4f35a7a..594d1cd 100644
> > --- a/src/qemu/qemu_migration.c
> > +++ b/src/qemu/qemu_migration.c
> > @@ -4387,12 +4387,16 @@ qemuMigrationFinish(virQEMUDriverPtr
> driver,
> >      qemuDomainObjPrivatePtr priv = vm->privateData;
> >      virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
> >      virCapsPtr caps = NULL;
> > +    unsigned short port = 0;
> 
> No need to initialize port here.
> 
> >
> >      VIR_DEBUG("driver=%p, dconn=%p, vm=%p, cookiein=%s,
> cookieinlen=%d, "
> >                "cookieout=%p, cookieoutlen=%p, flags=%lx,
> retcode=%d",
> >                driver, dconn, vm, NULLSTR(cookiein), cookieinlen,
> >                cookieout, cookieoutlen, flags, retcode);
> >
> > +    port = priv->migrationPort;
> > +    priv->migrationPort = 0;
> > +
> >      if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
> >          goto cleanup;
> >
> > @@ -4439,8 +4443,6 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
> >          }
> >
> >          qemuMigrationStopNBDServer(driver, vm, mig);
> > -        virPortAllocatorRelease(driver->migrationPorts,
> priv->migrationPort);
> > -        priv->migrationPort = 0;
> >
> >          if (flags & VIR_MIGRATE_PERSIST_DEST) {
> >              virDomainDefPtr vmdef;
> > @@ -4573,6 +4575,7 @@ endjob:
> >      }
> >
> >  cleanup:
> > +    virPortAllocatorRelease(driver->migrationPorts, port);
> >      if (vm) {
> >          VIR_FREE(priv->origname);
> >          virObjectUnlock(vm);
> 
> ACK and pushed. My bad for not spotting thins while reviewing the
> original patch.
> 
> Jirka




More information about the libvir-list mailing list