[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] phyp: first part of storage management driver




Eduardo Otubo <otubo linux vnet ibm com> wrote on 05/18/2010 05:01:40 PM:


> Please respond to otubo

>
> On 05/14/2010 05:27 PM, Stefan Berger wrote:

> >  > +
> >  > +virStoragePoolPtr
> >  > +phypSPLookupByName(virConnectPtr conn, const char *sp_name)
> >  > +{
> >  > + virStoragePoolPtr sp = NULL;
> >  > + int sp_id = 0;
> >  > + unsigned char sp_uuid[VIR_UUID_BUFLEN];
> >  > +
> >  > + sp_id = phypGetStoragePoolID(sp_name, conn);
> >  > + if (sp_id == -1)
> >  > + return NULL;
> >  > +
> >  > + if (phypGetStoragePoolUUID(sp_uuid, sp_name, conn) == -1)
> >  > + return NULL;
> >  > +
> >  > + sp = virGetStoragePool(conn, sp_name, sp_uuid);
> >  > +
> >  > + if (sp)
> >  > + return sp;
> >  > + else
> >  > + return NULL;
> >
> > Doesn't seem necessary to do if - then here.
> >
> > Just a 'return sp;' should do the trick.
> >



Above the old.

> >
>
>
> Thanks for all the comments.
>
> The following patch fixes the mistakes pointed by you and add a new
> function. Now the pHyp Storage Driver is able to pool-dumpxml also.
>

[...]

> +
> +virStoragePoolPtr
> +phypSPLookupByName(virConnectPtr conn, const char *name)
> +{
> +    virStoragePoolPtr sp = NULL;
> +    unsigned char uuid[VIR_UUID_BUFLEN];
> +
> +    if (phypGetStoragePoolUUID(conn, uuid, name) == -1)
> +        return NULL;
> +
> +    sp = virGetStoragePool(conn, name, uuid);
> +
> +    if (sp)
> +        return sp;
> +    else
> +        return NULL;
> +}


Here the new. Is it really necessary to have an if statement here ?

  Stefan

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]