[libvirt] [PATCH] phyp: fix logic error on volume creation

Peter Krempa pkrempa at redhat.com
Wed Apr 2 09:49:08 UTC 2014


On 04/02/14 01:39, Eric Blake wrote:
> The phyp code claims that it wants a non-zero value, but actually
> enforces a capacity of zero.  It has been this way since commit
> ebc46fe in June 2010.  Bummer that it has my name as the committer
> - I guess I should have been much more stubborn about not blindly
> taking someone else's 1600-line patch.
> 
> * src/phyp/phyp_driver.c (phypStorageVolCreateXML): Use correct
> logic.
> 
> Signed-off-by: Eric Blake <eblake at redhat.com>
> ---
> 
> The fact that this bug has gone unnoticed for years makes me
> wonder if we are better off just removing the phyp driver from
> our code base, since it is obvious it is not getting much
> testing.  I'm also waiting for a review on this, because although
> I _think_ the code wanted a non-zero capacity, I don't know
> enough about phyp and the "viosvrcmd -c 'mklv -lv'" command line;
> maybe the comments are wrong and it always wanted 0 capacity
> instead (which is the only thing that would get past the
> pre-patch code check).

I leave this dispute for others;

> 
>  src/phyp/phyp_driver.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
> index fc3e7db..3a5eefd 100644
> --- a/src/phyp/phyp_driver.c
> +++ b/src/phyp/phyp_driver.c
> @@ -2003,15 +2003,15 @@ phypStorageVolCreateXML(virStoragePoolPtr pool,
>       * in the moment you create the volume.
>       * */
>      if (voldef->key) {
>          VIR_ERROR(_("Key must be empty, Power Hypervisor will create one for you."));
>          goto err;
>      }
> 
> -    if (voldef->capacity) {
> +    if (!voldef->capacity) {
>          VIR_ERROR(_("Capacity cannot be empty."));
>          goto err;
>      }
> 
>      key = phypBuildVolume(pool->conn, voldef->name, spdef->name,
>                            voldef->capacity);
> 

ACK to this change.

Peter

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140402/e1da8460/attachment-0001.sig>


More information about the libvir-list mailing list