Change in vdsm[master]: [WIP] metaSize calculation as a module function.

ewarszaw at redhat.com ewarszaw at redhat.com
Mon Feb 4 14:29:39 UTC 2013


Eduardo has uploaded a new change for review.

Change subject: [WIP] metaSize calculation as a module function.
......................................................................

[WIP] metaSize calculation as a module function.

Change-Id: If90ba75d11c4962f2e52150e5f381cd93d0e8f35
Signed-off-by: Eduardo <ewarszaw at redhat.com>
---
M vdsm/storage/blockSD.py
1 file changed, 23 insertions(+), 23 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/90/11690/1

diff --git a/vdsm/storage/blockSD.py b/vdsm/storage/blockSD.py
index 9b9674e..aa4059a 100644
--- a/vdsm/storage/blockSD.py
+++ b/vdsm/storage/blockSD.py
@@ -269,6 +269,27 @@
     return
 
 
+def metaSize(vgName):
+    ''' Calc the minimal meta volume size in MB'''
+    # In any case the metadata volume cannot be less than 512MB for the
+    # case of 512 bytes per volume metadata, 2K for domain metadata and
+    # extent size of 128MB. In any case we compute the right size on line.
+    vg = lvm.getVG(vgName)
+    minmetasize = (SD_METADATA_SIZE / sd.METASIZE * int(vg.extent_size) +
+                  (1024 * 1024 - 1)) / (1024 * 1024)
+    metaratio = int(vg.extent_size) / sd.METASIZE
+    metasize = (int(vg.extent_count) * sd.METASIZE +
+               (1024 * 1024 - 1)) / (1024 * 1024)
+    metasize = max(minmetasize, metasize)
+    if metasize > int(vg.free) / (1024 * 1024):
+        raise se.VolumeGroupSizeError("volume group has not enough extents %s"
+                                      " (Minimum %s), VG may be too small" %
+                                      (vg.extent_count,
+                                      (1024 * 1024) / sd.METASIZE))
+    log.info("size %s MB (metaratio %s)" % (metasize, metaratio))
+    return metasize
+
+
 class VGTagMetadataRW(object):
     log = logging.getLogger("storage.Metadata.VGTagMetadataRW")
     METADATA_TAG_PREFIX = "MDT_"
@@ -449,27 +470,6 @@
                           lvmActivationNamespace)
 
     @classmethod
-    def metaSize(cls, vgroup):
-        ''' Calc the minimal meta volume size in MB'''
-        # In any case the metadata volume cannot be less than 512MB for the
-        # case of 512 bytes per volume metadata, 2K for domain metadata and
-        # extent size of 128MB. In any case we compute the right size on line.
-        vg = lvm.getVG(vgroup)
-        minmetasize = (SD_METADATA_SIZE / sd.METASIZE * int(vg.extent_size) +
-                      (1024 * 1024 - 1)) / (1024 * 1024)
-        metaratio = int(vg.extent_size) / sd.METASIZE
-        metasize = (int(vg.extent_count) * sd.METASIZE +
-                    (1024 * 1024 - 1)) / (1024 * 1024)
-        metasize = max(minmetasize, metasize)
-        if metasize > int(vg.free) / (1024 * 1024):
-            raise se.VolumeGroupSizeError(
-                "volume group has not enough extents %s (Minimum %s), VG may "
-                "be too small" % (vg.extent_count,
-                                  (1024 * 1024) / sd.METASIZE))
-        cls.log.info("size %s MB (metaratio %s)" % (metasize, metaratio))
-        return metasize
-
-    @classmethod
     def create(cls, sdUUID, domainName, domClass, vgUUID, storageType,
                version):
         """ Create new storage domain
@@ -509,7 +509,7 @@
             raise se.StorageDomainIsMadeFromTooManyPVs()
 
         # Create metadata service volume
-        metasize = cls.metaSize(vgName)
+        metasize = metaSize(vgName)
         lvm.createLV(vgName, sd.METADATA, "%s" % (metasize))
         # Create the mapping right now so the index 0 is guaranteed
         # to belong to the metadata volume. Since the metadata is at
@@ -721,7 +721,7 @@
 
             lvm.extendVG(self.sdUUID, devices, force)
             self.updateMapping()
-            newsize = self.metaSize(self.sdUUID)
+            newsize = metaSize(self.sdUUID)
             lvm.extendLV(self.sdUUID, sd.METADATA, newsize)
 
     def mapMetaOffset(self, vol_name, slotSize):


--
To view, visit http://gerrit.ovirt.org/11690
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If90ba75d11c4962f2e52150e5f381cd93d0e8f35
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewarszaw at redhat.com>


More information about the vdsm-patches mailing list