[PATCH] phyp: fix logic error on volume creation

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

 



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@xxxxxxxxxx>
---

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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]