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

Eric Blake eblake at redhat.com
Tue Apr 1 23:39:36 UTC 2014


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).

 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);

-- 
1.9.0




More information about the libvir-list mailing list