[NEW PATCH] BZ#732980 Devices block size must be 512 (via gerrit-bot)

Federico Simoncelli fsimonce at redhat.com
Thu Sep 15 16:10:24 UTC 2011


New patch submitted by Federico Simoncelli (fsimonce at redhat.com)

You can review this change at: http://gerrit.usersys.redhat.com/855

commit d955b69c70d041d850eaf75fbaaa173ac8fcd2f5
Author: Federico Simoncelli <fsimonce at redhat.com>
Date:   Fri Sep 2 16:43:18 2011 +0000

    BZ#732980 Devices block size must be 512
    
    Change-Id: If303fac85a29bed7b989b0b6302fc4c83075f500

diff --git a/vdsm/constants.py.in.in b/vdsm/constants.py.in.in
index 55b05df..5a10cb1 100644
--- a/vdsm/constants.py.in.in
+++ b/vdsm/constants.py.in.in
@@ -32,6 +32,7 @@ QEMU_PROCESS_USER = '@QEMUUSER@'
 # This is the domain version translation list
 # DO NOT CHANGE OLD VALUES ONLY APPEND
 DOMAIN_VERSIONS = (0, 2)
+SUPPORTED_BLOCKSIZE = ((512, 512),)
 
 # This contains the domains versions that this VDSM
 # accepts currently its all of the version but in the
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index 50e2510..fdcac04 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -763,6 +763,8 @@ class HSM:
                         'devtype': dev.get("devtype", ""),
                         'pathstatus': dev.get("paths", []),
                         'pathlist': dev.get("connections", []),
+                        'logicalblocksize': dev.get("logicalblocksize", ""),
+                        'physicalblocksize': dev.get("physicalblocksize", ""),
                         'partitioned': partitioned}
                 for path in devInfo["pathstatus"]:
                     path["lun"] = path["hbtl"].lun
@@ -855,6 +857,15 @@ class HSM:
                 if domBlockSizes == None:
                     domBlockSizes = blkSize
 
+                # Remove this check when we'll support different block sizes.
+                # Additionally we need to understand if we can determine that
+                # a device has different physical and logical block sizes because
+                # of the device (and not because of some logical layer on the host)
+                # Otherwise we cannot support devices which don't have the same
+                # physical and logical block size.
+                if blkSize not in constants.SUPPORTED_BLOCKSIZE:
+                    raise se.DeviceBlockSizeError(blkSize)
+
                 # Checking device block size
                 if blkSize != domBlockSizes:
                     raise se.VolumeGroupBlockSizeError(domBlockSizes, blkSize)
diff --git a/vdsm/storage/multipath.py b/vdsm/storage/multipath.py
index 269e0e3..804c093 100644
--- a/vdsm/storage/multipath.py
+++ b/vdsm/storage/multipath.py
@@ -226,6 +226,8 @@ def pathListIter(filterGuids=None):
                 "vendor" : "",
                 "product" :"",
                 "fwrev" : "",
+                "logicalblocksize" : "",
+                "physicalblocksize" : "",
                 }
 
 
@@ -252,6 +254,14 @@ def pathListIter(filterGuids=None):
                 except Exception:
                     log.warn("Problem getting fwrev from device `%s`", slave, exc_info=True)
 
+            if not devInfo["logicalblocksize"] or not devInfo["physicalblocksize"]:
+                try:
+                    logBlkSize, phyBlkSize = getDeviceBlockSizes(slave)
+                    devInfo["logicalblocksize"] = str(logBlkSize)
+                    devInfo["physicalblocksize"] = str(phyBlkSize)
+                except Exception:
+                    log.warn("Problem getting blocksize from device `%s`", slave, exc_info=True)
+
             pathInfo = {}
             pathInfo["physdev"] = slave
             pathInfo["state"] = pathStatuses.get(slave, "failed")
diff --git a/vdsm/storage/storage_exception.py b/vdsm/storage/storage_exception.py
index 7bb3f1c..f6fbf20 100644
--- a/vdsm/storage/storage_exception.py
+++ b/vdsm/storage/storage_exception.py
@@ -1010,6 +1010,13 @@ class VolumeGroupBlockSizeError(StorageException):
     code = 517
     message = "All devices in domain must have the same block size"
 
+class DeviceBlockSizeError(StorageException):
+    def __init__(self, devsizes):
+        self.value = "logblksize=%s phyblksize=%s" % \
+                     (devsizes[0], devsizes[1])
+    code = 518
+    message = "Device block size is not supported"
+
 class CannotCreateLogicalVolume(StorageException):
     code = 550
     message = "Cannot create Logical Volume"




More information about the vdsm-patches mailing list