Change in vdsm[master]: gluster: fix build error in F20 due to blivet version issue
tjeyasin at redhat.com
tjeyasin at redhat.com
Thu Mar 19 13:07:46 UTC 2015
Timothy Asir has uploaded a new change for review.
Change subject: gluster: fix build error in F20 due to blivet version issue
......................................................................
gluster: fix build error in F20 due to blivet version issue
The latest version which is available in fedora 21 returns
device size in object to provide more information about the
device size whereas the lower version of blivet provides the
device size as a numeric (MiB) value. Unfortunatly fedora 20
and other OS does not support the latest version and vdsm
failed to build the rpm.
This patch fix this issue by handling the device size based
on unit type.
Change-Id: Ibf2af69637b7d247225433a7736c49f6c5fefe1d
Signed-off-by: Timothy Asir Jeyasingh <tjeyasin at redhat.com>
---
M vdsm.spec.in
M vdsm/gluster/storagedev.py
2 files changed, 26 insertions(+), 15 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/42/38942/1
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 01e6d97..6d12a42 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -121,7 +121,7 @@
BuildRequires: python-ordereddict
%endif
%if 0%{?rhel} > 6 || 0%{?fedora}
-BuildRequires: python-blivet >= 0.61.14
+BuildRequires: python-blivet
%endif
# Autotools BuildRequires
@@ -700,7 +700,7 @@
Requires: glusterfs-server
Requires: python-magic
%if 0%{?rhel} > 6 || 0%{?fedora}
-Requires: python-blivet >= 0.61.14
+Requires: python-blivet
%endif
%description gluster
diff --git a/vdsm/gluster/storagedev.py b/vdsm/gluster/storagedev.py
index a860179..5817ef4 100644
--- a/vdsm/gluster/storagedev.py
+++ b/vdsm/gluster/storagedev.py
@@ -25,7 +25,7 @@
import blivet
import blivet.formats
import blivet.formats.fs
-import blivet.size
+import blivet.size as size
from blivet.devices import LVMVolumeGroupDevice
from blivet.devices import LVMThinPoolDevice
from blivet.devices import LVMLogicalVolumeDevice
@@ -66,7 +66,7 @@
'mountPoint': '',
'uuid': '',
'createBrick': createBrick}
- if isinstance(device.size, blivet.size.Size):
+ if isinstance(device.size, size.Size):
info['size'] = '%s' % device.size.convertTo(spec="MiB")
else:
info['size'] = '%s' % device.size
@@ -157,9 +157,8 @@
def _createVG(vgName, deviceList, stripeSize=0):
if stripeSize:
- vg = LVMVolumeGroupDevice(
- vgName, peSize=blivet.size.Size('%s KiB' % stripeSize),
- parents=deviceList)
+ vg = LVMVolumeGroupDevice(vgName, peSize=stripeSize,
+ parents=deviceList)
else:
vg = LVMVolumeGroupDevice(vgName, parents=deviceList)
@@ -179,12 +178,13 @@
else:
metaName = "meta-%s" % poolName
vgPoolName = "%s/%s" % (vg.name, poolName)
+ if isinstance(vg.size, size.Size):
+ poolMetaDataSize = size.Size('%d KiB' % poolMetaDataSize)
+ poolDataSize = size.Size('%d KiB' % poolDataSize)
metaLv = LVMLogicalVolumeDevice(
- metaName, parents=[vg],
- size=blivet.size.Size('%d KiB' % poolMetaDataSize))
+ metaName, parents=[vg], size=poolMetaDataSize)
poolLv = LVMLogicalVolumeDevice(
- poolName, parents=[vg],
- size=blivet.size.Size('%d KiB' % poolDataSize))
+ poolName, parents=[vg], size=poolDataSize)
blivetEnv.createDevice(metaLv)
blivetEnv.createDevice(poolLv)
blivetEnv.doIt()
@@ -247,16 +247,27 @@
pvDeviceList = _makePartition(deviceList)
pvDeviceList = _createPV(pvDeviceList, alignment)
- vg = _createVG(vgName, pvDeviceList, raidParams.get('stripeSize', 0))
+
+ stripeSize = raidParams.get('stripeSize', 0)
+ if isinstance(deviceList[0].size, size.Size):
+ if stripeSize:
+ stripeSize = size.Size('%s KiB' % stripeSize)
+ vg = _createVG(vgName, pvDeviceList, stripeSize)
# The following calculation is based on the redhat storage performance doc
# http://docbuilder.usersys.redhat.com/22522
# /#chap-Configuring_Red_Hat_Storage_for_Enhancing_Performance
if alignment:
- vgSizeKib = int(vg.size.convertTo(spec="KiB"))
- if vg.size.convertTo(spec='MiB') < MIN_VG_SIZE:
- metaDataSize = vgSizeKib * MIN_METADATA_PERCENT
+ if isinstance(vg.size, size.Size):
+ vgSizeKib = int(vg.size.convertTo(spec="KiB"))
+ # size.Size(MIN_VG_SIZE * 1024) = 1024 MiB
+ if vg.size.convertTo(spec='MiB') < size.Size(MIN_VG_SIZE * 1024):
+ metaDataSize = vgSizeKib * MIN_METADATA_PERCENT
+ else:
+ vgSizeKib = vg.size * 1024
+ if vg.size < MIN_VG_SIZE:
+ metaDataSize = vgSizeKib * MIN_METADATA_PERCENT
poolDataSize = vgSizeKib - metaDataSize
metaDataSize = (metaDataSize - (metaDataSize % alignment))
poolDataSize = (poolDataSize - (poolDataSize % alignment))
--
To view, visit https://gerrit.ovirt.org/38942
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibf2af69637b7d247225433a7736c49f6c5fefe1d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Timothy Asir <tjeyasin at redhat.com>
More information about the vdsm-patches
mailing list