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

Stefan Berger stefanb at us.ibm.com
Tue May 25 00:27:52 UTC 2010


Eduardo Otubo <otubo at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100524/38aa79d8/attachment-0001.htm>


More information about the libvir-list mailing list