On 11/18/2015 01:13 PM, Pavel Boldin wrote: > Create a UNIX socket that will be a target for outgoing NBD connection > from the QEMU side. > > Signed-off-by: Pavel Boldin <pbol...@mirantis.com> > --- > src/qemu/qemu_migration.c | 24 +++++++++++++++++++++++- > 1 file changed, 23 insertions(+), 1 deletion(-) > > diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c > index fb2a216..d587c56 100644 > --- a/src/qemu/qemu_migration.c > +++ b/src/qemu/qemu_migration.c > @@ -4597,7 +4597,7 @@ static int doTunnelMigrate(virQEMUDriverPtr driver, > size_t nmigrate_disks, > const char **migrate_disks) > { > - virNetSocketPtr sock = NULL; > + virNetSocketPtr sock = NULL, nbdSock = NULL; > int ret = -1; > qemuMigrationSpec spec; > virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver); > @@ -4613,6 +4613,23 @@ static int doTunnelMigrate(virQEMUDriverPtr driver, > spec.fwdType = MIGRATION_FWD_STREAM; > spec.fwd.stream = st; > > + if (nmigrate_disks) { > + spec.nbd_tunnel_unix_socket.sock = -1; > + spec.nbd_tunnel_unix_socket.file = NULL; > + > + if (virAsprintf(&spec.nbd_tunnel_unix_socket.file, > + "%s/domain-%s/qemu.nbdtunnelmigrate.src", > + cfg->libDir, vm->def->name) < 0) > + goto cleanup; > + > + if (virNetSocketNewListenUNIX(spec.nbd_tunnel_unix_socket.file, 0700, > + cfg->user, cfg->group, > + &nbdSock) < 0 || > + virNetSocketListen(nbdSock, 1) < 0) > + goto cleanup; > + > + spec.nbd_tunnel_unix_socket.sock = virNetSocketGetFD(nbdSock); > + }
We can now get to cleanup without "spec.destType" being set. The first thing it does is check it - so it's uninitialized according to Coverity. Probably need to move the following 2 lines up > > spec.destType = MIGRATION_DEST_FD; > spec.dest.fd.qemu = -1; > @@ -4643,6 +4660,11 @@ static int doTunnelMigrate(virQEMUDriverPtr driver, > VIR_FREE(spec.dest.unix_socket.file); > } > > + if (nmigrate_disks) { > + virObjectUnref(nbdSock); ?? VIR_FORCE_CLOSE(spec.nbd_tunnel_unix_socket.sock); John > + VIR_FREE(spec.nbd_tunnel_unix_socket.file); > + } > + > virObjectUnref(cfg); > return ret; > } > -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list