Change in vdsm[ovirt-3.5-gluster]: gluster: create vg with custom pesize

tjeyasin at redhat.com tjeyasin at redhat.com
Tue May 26 09:20:03 UTC 2015


Timothy Asir has uploaded a new change for review.

Change subject: gluster: create vg with custom pesize
......................................................................

gluster: create vg with custom pesize

Currently blivet forcefully creates vg with 1mb pesize
This will be an workaround patch till the blivet
bug: https://bugzilla.redhat.com/show_bug.cgi?id=1198568
get fixed.

Change-Id: I6ca89347b537e0ab6cffc2b1293ba9b5a32c366d
Signed-off-by: Timothy Asir Jeyasingh <tjeyasin at redhat.com>
---
M vdsm/gluster/exception.py
M vdsm/gluster/storagedev.py
2 files changed, 25 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/67/41467/1

diff --git a/vdsm/gluster/exception.py b/vdsm/gluster/exception.py
index 8a9f538..824450d 100644
--- a/vdsm/gluster/exception.py
+++ b/vdsm/gluster/exception.py
@@ -440,6 +440,17 @@
         self.message = "Mount point %s is in use" % mountPoint
 
 
+class GlusterHostStorageDeviceVGCreateFailedException(GlusterHostException):
+    code = 4518
+
+    def __init__(self, name, devices, stripeSize, rc=0, out=(), err=()):
+        self.rc = rc
+        self.out = out
+        self.err = err
+        self.message = "Failed to create LVM VG:%s for devices %s with " \
+                       "stripe size %s" % (name, devices, stripeSize)
+
+
 # Hook
 class GlusterHookException(GlusterException):
     code = 4500
diff --git a/vdsm/gluster/storagedev.py b/vdsm/gluster/storagedev.py
index 583548b..aa00054 100644
--- a/vdsm/gluster/storagedev.py
+++ b/vdsm/gluster/storagedev.py
@@ -41,6 +41,9 @@
 
 
 log = logging.getLogger("Gluster")
+_vgCreateCommandPath = utils.CommandPath("vgcreate",
+                                         "/sbin/vgcreate",
+                                         "/usr/sbin/vgcreate",)
 _lvconvertCommandPath = utils.CommandPath("lvconvert",
                                           "/sbin/lvconvert",
                                           "/usr/sbin/lvconvert",)
@@ -165,13 +168,19 @@
 
     def _createVG(vgName, deviceList, stripeSize=0):
         if stripeSize:
-            vg = LVMVolumeGroupDevice(
-                vgName, peSize=blivet.size.Size('%s KiB' % stripeSize),
-                parents=deviceList)
+            devices = ','.join([device.path for device in deviceList])
+            rc, out, err = utils.execCmd([_vgCreateCommandPath.cmd,
+                                          '-s', '%sk' % stripeSize,
+                                          vgName, devices])
+
+            if rc:
+                raise ge.GlusterHostStorageDeviceVGCreateFailedException(
+                    vgName, devices, stripeSize, rc, out, err)
+            blivetEnv.reset()
+            vg = blivetEnv.devicetree.getDeviceByName(vgName)
         else:
             vg = LVMVolumeGroupDevice(vgName, parents=deviceList)
-
-        blivetEnv.createDevice(vg)
+            blivetEnv.createDevice(vg)
         return vg
 
     def _createThinPool(poolName, vg, alignment=0,


-- 
To view, visit https://gerrit.ovirt.org/41467
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6ca89347b537e0ab6cffc2b1293ba9b5a32c366d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5-gluster
Gerrit-Owner: Timothy Asir <tjeyasin at redhat.com>


More information about the vdsm-patches mailing list