[libvirt] [PATCH] qemu_migrate: Fix assign the same port when migrating concurrently

Jiri Denemark jdenemar at redhat.com
Tue Oct 15 11:54:37 UTC 2013


On Tue, Oct 15, 2013 at 11:59:17 +0100, Daniel Berrange wrote:
> On Tue, Oct 15, 2013 at 04:24:14AM +0000, Wangyufei (A) wrote:
> > >From f56b290eab36bbb7a9ac53778a55638d473504d1 Mon Sep 17 00:00:00 2001
> > From: WangYufei <james.wangyufei at huawei.com>
> > Date: Fri, 11 Oct 2013 11:27:13 +0800
> > Subject: [PATCH] qemu_migrate: Fix assign the same port when migrating concurrently
...
> > @@ -2521,8 +2529,9 @@ qemuMigrationPrepareDirect(virQEMUDriverPtr driver,
> >       * to be a correct hostname which refers to the target machine).
> >       */
> >      if (uri_in == NULL) {
> > -        this_port = QEMUD_MIGRATION_FIRST_PORT + port++;
> > -        if (port == QEMUD_MIGRATION_NUM_PORTS) port = 0;
> > +        if (virPortAllocatorAcquire(driver->migrationPorts,
> > +                                    (unsigned short *)&this_port) < 0)
> > +            goto cleanup;
> 
> Just declare 'this_port' to be an 'unsigned short' instead of casting
> it everywhere.
> 
> 
> ACK if you fix that.

Oops, this patch has a few issues that are more serious than this. I'll
be sending an amended patch shortly.

> As a followup, it might be desirable to make the migration port range
> be configurable via /etc/libvirt/qemu.conf, in the same way that we
> have the VNC/SPICE port range configurable.

Yeah, I was planning on making such patch once this one gets pushed.

Jirka




More information about the libvir-list mailing list