[libvirt] [PATCH] storage: Create enough volumes for mpath pool

Osier Yang jyang at redhat.com
Mon Feb 14 13:48:27 UTC 2011


"virStorageBackendCreateVols":
  "names->next" serves as condition expression for "do...while",
however, "names" was shifted before, it then results in one less
loop, and thus, one less volume will be created for mpath pool,
the patch is to fix it.

* src/storage/storage_backend_mpath.c
---
 src/storage/storage_backend_mpath.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/storage/storage_backend_mpath.c b/src/storage/storage_backend_mpath.c
index be4db78..2e85561 100644
--- a/src/storage/storage_backend_mpath.c
+++ b/src/storage/storage_backend_mpath.c
@@ -212,6 +212,7 @@ virStorageBackendCreateVols(virStoragePoolObjPtr pool,
     int retval = -1, is_mpath = 0;
     char *map_device = NULL;
     uint32_t minor = -1;
+    uint32_t next;

     do {
         is_mpath = virStorageBackendIsMultipath(names->name);
@@ -243,9 +244,10 @@ virStorageBackendCreateVols(virStoragePoolObjPtr pool,

         /* Given the way libdevmapper returns its data, I don't see
          * any way to avoid this series of casts. */
-        names = (struct dm_names *)(((char *)names) + names->next);
+        next = names->next;
+        names = (struct dm_names *)(((char *)names) + next);

-    } while (names->next);
+    } while (next);

     retval = 0;
 out:
--
1.7.4




More information about the libvir-list mailing list