[libvirt] [PATCH] rbd: Do not append Ceph monitor port number 6789 if not provided

Andrea Bolognani abologna at redhat.com
Wed Jan 6 09:41:32 UTC 2016


On Wed, 2016-01-06 at 10:27 +0100, Wido den Hollander wrote:
> 
> On 01/06/2016 09:49 AM, Andrea Bolognani wrote:
> > On Wed, 2016-01-06 at 09:32 +0100, Wido den Hollander wrote:
> > > diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
> > > index 2aa1d90..1354601 100644
> > > --- a/src/util/virstoragefile.c
> > > +++ b/src/util/virstoragefile.c
> > > @@ -2246,7 +2246,7 @@ virStorageSourceRBDAddHost(virStorageSourcePtr src,
> > >           if (VIR_STRDUP(src->hosts[src->nhosts - 1].port, port) < 0)
> > >               goto error;
> > >       } else {
> > > -        if (VIR_STRDUP(src->hosts[src->nhosts - 1].port, "6789") < 0)
> > > +        if (VIR_STRDUP(src->hosts[src->nhosts - 1].port, NULL) < 0)
> > >               goto error;
> > >       }
>> > Shouldn't this be
>> > >           if (VIR_STRDUP(src->hosts[src->nhosts - 1].port, port) < 0)
> > >               goto error;
> > >       } else {
> > > -        if (VIR_STRDUP(src->hosts[src->nhosts - 1].port, "6789") < 0)
> > > -            goto error;
> > > +        src->hosts[src->nhosts - 1].port = NULL;
> > >       }
> 
> What does that benefit? We set it to 6789 and to NULL afterwards? I just
> want to get rid of any hardcoded monitor ports in libvirt for Ceph.

Look again, you'll notice it's a diff :)

I still set the port to NULL, just like your code does, but instead of
using VIR_STRDUP() I use plain assignment.

Cheers.

-- 
Andrea Bolognani
Software Engineer - Virtualization Team




More information about the libvir-list mailing list