Hello Timothy Asir, Bala.FA, Dan Kenigsberg,

I'd like you to do a code review.  Please visit

    https://gerrit.ovirt.org/42363

to review the following change.

Change subject: gluster: fix vg create failed first time during brick create
......................................................................

gluster: fix vg create failed first time during brick create

Currently brick create uses vdsm lvm module for pv create and
blivet to create a vg. This issue not occured if both pv and vg
are created using blivet itself.
But unfortunately blivet has few issues while creating a vg.
Its able to create a vg with a pesize of minimum 1mb only.
Also the vdsm lvm module has some issue while creating a vg.
So this path uses lvm vgcreate command to create the vg
as a workaround.

Change-Id: Ibf558aab450d6c4546c34e9439249c44e930a304
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1226186
Signed-off-by: Timothy Asir Jeyasingh <tjeya...@redhat.com>
Reviewed-on: https://gerrit.ovirt.org/41392
Continuous-Integration: Jenkins CI
Reviewed-by: Bala.FA <barum...@redhat.com>
Reviewed-by: Dan Kenigsberg <dan...@redhat.com>
---
M vdsm/gluster/exception.py
M vdsm/gluster/storagedev.py
2 files changed, 28 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/63/42363/1

diff --git a/vdsm/gluster/exception.py b/vdsm/gluster/exception.py
index fb18177..f95d749 100644
--- a/vdsm/gluster/exception.py
+++ b/vdsm/gluster/exception.py
@@ -440,6 +440,19 @@
         self.message = "Mount point %s is in use" % mountPoint
 
 
+class GlusterHostStorageDeviceVGCreateFailedException(GlusterHostException):
+    code = 4518
+
+    def __init__(self, name=None, devices=None,
+                 stripeSize=None, rc=0, out=(), err=()):
+        GlusterHostException.__init__(self)
+        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 2aeabad..0339d5f 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",)
@@ -172,13 +175,20 @@
 
     def _createVG(vgName, deviceList, stripeSize=0):
         if stripeSize:
-            vg = LVMVolumeGroupDevice(
-                vgName, peSize=blivet.size.Size('%s KiB' % stripeSize),
-                parents=deviceList)
+            # bz#1198568: Blivet always creates vg with 1MB stripe size
+            # Workaround: Till blivet fixes the issue, use vgcreate command
+            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/42363
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibf558aab450d6c4546c34e9439249c44e930a304
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5-gluster
Gerrit-Owner: Darshan N <dnara...@redhat.com>
Gerrit-Reviewer: Bala.FA <barum...@redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <dan...@redhat.com>
Gerrit-Reviewer: Timothy Asir <tjeya...@redhat.com>
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to