[pve-devel] [PATCH librados2-perl] Split method pve_rados_connect

Alwin Antreich a.antreich at proxmox.com
Wed Apr 4 11:54:26 CEST 2018


On Tue, Apr 03, 2018 at 10:25:53AM +0200, Thomas Lamprecht wrote:
>
> Am 03/30/2018 um 12:25 PM schrieb Alwin Antreich:
> > To be able to connect through librados2 without a config file, the
> > method pve_rados_connect is split up into pve_rados_connect and
> > pve_rados_conf_read_file.
> >
> > Signed-off-by: Alwin Antreich <a.antreich at proxmox.com>
> > ---
> >   PVE/RADOS.pm |  9 ++++++++-
> >   RADOS.xs     | 26 +++++++++++++++++++++-----
> >   2 files changed, 29 insertions(+), 6 deletions(-)
> >
> > diff --git a/PVE/RADOS.pm b/PVE/RADOS.pm
> > index aa6a102..ad1c2db 100644
> > --- a/PVE/RADOS.pm
> > +++ b/PVE/RADOS.pm
> > @@ -1,6 +1,6 @@
> >   package PVE::RADOS;
> > -use 5.014002;
> > +use 5.014002; # FIXME: update version??
> >   use strict;
> >   use warnings;
> >   use Carp;
> > @@ -13,6 +13,7 @@ use PVE::RPCEnvironment;
> >   require Exporter;
> >   my $rados_default_timeout = 5;
> > +my $ceph_default_conf = '/etc/ceph/ceph.conf';
> >   our @ISA = qw(Exporter);
> > @@ -164,6 +165,12 @@ sub new {
> >   	    $conn = pve_rados_create() ||
> >   		die "unable to create RADOS object\n";
> > +	    my $ceph_conf = delete $params{ceph_conf} || $ceph_default_conf;
> > +
> > +	    if (-e $ceph_conf) {
> > +		pve_rados_conf_read_file($conn, $ceph_conf);
> > +	    }
> > +
> >   	    pve_rados_conf_set($conn, 'client_mount_timeout', $timeout);
> >   	    foreach my $k (keys %params) {
> > diff --git a/RADOS.xs b/RADOS.xs
> > index a9f6bc3..ad3cf96 100644
> > --- a/RADOS.xs
> > +++ b/RADOS.xs
> > @@ -47,19 +47,35 @@ CODE:
>
> This whole hunk does not apply here...
> A quick look gave me one whitespace problem (see below), but that alone did
> not fix it for me...
> Are you sure you sent all commits between this and origin/master ?
>
> git log origin/master..
I will add a white space cleanup before my v2 of this patch, as it seems
not to apply without the cleanup.

>
>
> >   }
> >   void
> > -pve_rados_connect(cluster)
> > +pve_rados_conf_read_file(cluster, path)
> >   rados_t cluster
> > -PROTOTYPE: $
> > +SV *path
> > +PROTOTYPE: $$
> >   CODE:
> >   {
> > -    DPRINTF("pve_rados_connect\n");
> > +    char *p = NULL;
> > -    int res = rados_conf_read_file(cluster, NULL);
> > +    if (SvOK(path)) {
> > +	p = SvPV_nolen(path);
> > +    }
> > +
> > +    DPRINTF("pve_rados_conf_read_file %s\n", p);
> > +
> > +    int res = rados_conf_read_file(cluster, p);
> >       if (res < 0) {
> >           die("rados_conf_read_file failed - %s\n", strerror(-res));
> >       }
> > +}
> > +
> > +void
> > +pve_rados_connect(cluster)
> > +rados_t cluster
> > +PROTOTYPE: $
> > +CODE:
> > +{
> > +    DPRINTF("pve_rados_connect\n");
>
> The empty line above contains a trailing whitespace in origin/master, which
> your patch does not contain.
see above

>
> > -    res = rados_connect(cluster);
> > +    int res = rados_connect(cluster);
> >       if (res < 0) {
> >           die("rados_connect failed - %s\n", strerror(-res));
> >       }
>




More information about the pve-devel mailing list