Timothy Asir has uploaded a new change for review.
Change subject: gluster: fix brick devices are created with incorrect data alignment ......................................................................
gluster: fix brick devices are created with incorrect data alignment
Removed make partition function and pv create will not create any partition on the given device.
Change-Id: I58cc322cb5140de2d2006d59b4c1dceaba2e5968 Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1270792 Signed-off-by: Timothy Asir Jeyasingh tjeyasin@redhat.com --- M vdsm/gluster/storagedev.py 1 file changed, 28 insertions(+), 44 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/59/47959/1
diff --git a/vdsm/gluster/storagedev.py b/vdsm/gluster/storagedev.py index 1e4402c..4da753e 100644 --- a/vdsm/gluster/storagedev.py +++ b/vdsm/gluster/storagedev.py @@ -76,7 +76,7 @@ 'uuid': '', 'createBrick': createBrick} if isinstance(device.size, blivet.size.Size): - info['size'] = '%s' % device.size.convertTo(spec="MiB") + info['size'] = '%s' % device.size.convertTo(blivet.size.MiB) else: info['size'] = '%s' % device.size if not info['bus'] and device.parents: @@ -137,49 +137,24 @@ return [blivetEnv.devicetree.getDeviceByName(devName.split("/")[-1]) for devName in devNameList]
- def _makePartition(deviceList): - pvDeviceList = [] - doPartitioning = False - for dev in deviceList: - if dev.type not in ['disk', 'dm-multipath']: - pvDeviceList.append(dev) - else: - blivetEnv.initializeDisk(dev) - part = blivetEnv.newPartition(fmt_type="lvmpv", grow=True, - parents=[dev]) - blivetEnv.createDevice(part) - pvDeviceList.append(part) - doPartitioning = True - - if doPartitioning: - blivet.partitioning.doPartitioning(blivetEnv) - return pvDeviceList - def _createPV(deviceList, alignment=0): - def _createAlignedPV(deviceList, alignment): - for dev in deviceList: - # bz#1178705: Blivet always creates pv with 1MB dataalignment - # Workaround: Till blivet fixes the issue, we use lvm pvcreate + for dev in deviceList: + # bz#1178705: Blivet always creates pv with 1MB dataalignment + # Workaround: Till blivet fixes the issue, we use lvm pvcreate + if alignment: rc, out, err = utils.execCmd([_pvCreateCommandPath.cmd, '--dataalignment', '%sk' % alignment, dev.path]) - if rc: - raise ge.GlusterHostStorageDevicePVCreateFailedException( - dev.path, alignment, rc, out, err) - _reset_blivet(blivetEnv) - return _getDeviceList([dev.name for dev in deviceList]) + else: + rc, out, err = utils.execCmd([_pvCreateCommandPath.cmd, + dev.path])
- if alignment: - blivetEnv.doIt() - return _createAlignedPV(deviceList, alignment) - - for dev in deviceList: - lvmpv = blivet.formats.getFormat("lvmpv", device=dev.path) - blivetEnv.formatDevice(dev, lvmpv) - - blivet.partitioning.doPartitioning(blivetEnv) - return deviceList + if rc: + raise ge.GlusterHostStorageDevicePVCreateFailedException( + dev.path, alignment, rc, out, err) + _reset_blivet(blivetEnv) + return _getDeviceList([dev.name for dev in deviceList])
def _createVG(vgName, deviceList, stripeSize=0): if stripeSize: @@ -204,8 +179,11 @@ if not alignment: # bz#1180228: blivet doesn't handle percentage-based sizes properly # Workaround: Till the bz gets fixed, we take only 99% size from vg + vgSizeByte = (vg.size * 99 / 100).convertTo(blivet.size.B) + # calculate roundSize to avoid 'Size is not a multiple of 512' error pool = LVMThinPoolDevice(poolName, parents=[vg], - size=(vg.size * 99 / 100), + size=blivet.size.Size( + (vgSizeByte - vgSizeByte % 512)), grow=True) blivetEnv.createDevice(pool) return pool @@ -283,8 +261,7 @@ if inUseList: raise ge.GlusterHostStorageDeviceInUseException(inUseList)
- pvDeviceList = _makePartition(deviceList) - pvDeviceList = _createPV(pvDeviceList, alignment) + pvDeviceList = _createPV(deviceList, alignment) vg = _createVG(vgName, pvDeviceList, raidParams.get('stripeSize', 0))
# The following calculation is based on the redhat storage performance doc @@ -297,8 +274,8 @@ # and create data LV (poolDataSize) that has a size which is # a multiple of stripe width if alignment: - vgSizeKib = int(vg.size.convertTo(spec="KiB")) - if vg.size.convertTo(spec='MiB') < MIN_VG_SIZE: + vgSizeKib = int(vg.size.convertTo(blivet.size.KiB)) + if vg.size.convertTo(blivet.size.MiB) < MIN_VG_SIZE: metaDataSize = vgSizeKib * MIN_METADATA_PERCENT poolDataSize = vgSizeKib - metaDataSize metaDataSize = (metaDataSize - (metaDataSize % alignment)) @@ -308,8 +285,15 @@ # lvconvert --chunksize alignment --thinpool VOLGROUP/thin_pool # --poolmetadata VOLGROUP/metadata_device_name pool = _createThinPool(poolName, vg, chunkSize, metaDataSize, poolDataSize) + + if alignment: + poolSize = pool.size + else: + # Calculate roundSize to avoid 'Size is not a multiple of 512' error + poolSize = pool.size.convertTo(blivet.size.B)/512 * 512 + thinlv = LVMThinLogicalVolumeDevice(brickName, parents=[pool], - size=pool.size, grow=True) + size=poolSize, grow=True) blivetEnv.createDevice(thinlv) blivetEnv.doIt()
automation@ovirt.org has posted comments on this change.
Change subject: gluster: fix brick devices are created with incorrect data alignment ......................................................................
Patch Set 1:
* Update tracker::#1270792::OK * Check Bug-Url::OK * Check Public Bug::#1270792::OK, public bug * Check Product::#1270792::SKIPPED, and classification Red Hat not oVirt * Check Product::WARN, no bug url with correct product found, make sure you have at least one bug-url with a product in oVirt Red Hat Enterprise Virtualization Manager. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
automation@ovirt.org has posted comments on this change.
Change subject: gluster: fix brick devices are created with incorrect data alignment ......................................................................
Patch Set 2:
* Update tracker::#1270792::OK * Check Bug-Url::OK * Check Public Bug::#1270792::OK, public bug * Check Product::#1270792::SKIPPED, and classification Red Hat not oVirt * Check Product::WARN, no bug url with correct product found, make sure you have at least one bug-url with a product in oVirt Red Hat Enterprise Virtualization Manager. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
Bala.FA has posted comments on this change.
Change subject: gluster: fix brick devices are created with incorrect data alignment ......................................................................
Patch Set 2: Code-Review-1
(1 comment)
https://gerrit.ovirt.org/#/c/47959/2//COMMIT_MSG Commit Message:
Line 10: device If there is no partition on the disk, how do we know a disk has filesystem in it? Does blivet provide such information?
Timothy Asir has posted comments on this change.
Change subject: gluster: fix brick devices are created with incorrect data alignment ......................................................................
Patch Set 2:
(1 comment)
https://gerrit.ovirt.org/#/c/47959/2//COMMIT_MSG Commit Message:
Line 6: Line 7: gluster: fix brick devices are created with incorrect data alignment Line 8: Line 9: Removed make partition function and pv create will not create Line 10: any partition on the given device.
If there is no partition on the disk, how do we know a disk has filesystem
Yes, blivet provides such information,
disk.format.type is not None, will tells us the disk has some kind of data on it.
Also, disk.format.type is not None and not disk.partitioned the first one is True only if the disk contains an actual filesystem (not swap, lvm pv) the second is True if the disk contains a filesystem, swap, lvm pv, luks, &c Line 11: Line 12: Change-Id: I58cc322cb5140de2d2006d59b4c1dceaba2e5968 Line 13: Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1270792
vdsm-patches@lists.fedorahosted.org