* The docstring of lsm.Client.volume_raid_info() contains full detail
   about this new method. Quick info:
        Usage:
            volume_raid_info(self, volume, flags=0)
        Returns:
            [raid_type, strip_size, extent_count, min_io_size, opt_io_size]
            # strip_size is the size of strip on each disk/extent
            # extent_count is the disk/extent count.
            # min_io_size is minimum I/O size. Also the preferred I/O size
            #   of random I/O.
            # opt_io_size is optimal I/O size. Also the preferred I/O size
            #   of sequential I/O.

 * Why not use 'pool_raid_info' instead?
        Some RAID systems(EMC VMAX/DMX and LVM RAID) are not implementing RAID
        at pool level but at volume level.

 * Why use 'extent_count' instead of 'disk_count'?
        Some RAID systems(EMC VMAX/DMX and LVM RAID) are not using disk
        directly to assemble RAID group.

 * Why we need 'min_io_size' and 'opt_io_size' when we have 'extent_count'
   and 'strip_size'?
        Normally, min_io_size is strip_size, opt_io_size could be calculated by
        raid_type, strip_size and extent_count. But on NetApp, I/O test[1]
        indicate their optimal I/O size is 64KiB no matter how many disks in
        the RAID group. It might[2] because NetApp created a WAFL filesystem on
        RAID group which changed the optimal I/O size.

        In general, the optimal I/O size or min_io_size of some RAID system
        might not base on strip size and RAID disk/extent count.
        We'd better expose those information directly instead forcing user
        to guess from strip size and disk/extent count.

 * New constants:
    Volume.RAID_TYPE_UNKNOWN
    # The plugin failed to detect the volume's RAID type.
    Volume.RAID_TYPE_RAID0
    # Stripe
    Volume.RAID_TYPE_RAID1
    # Mirror for two disks. For 4 disks or more, they are RAID10.
    Volume.RAID_TYPE_RAID3
    # Byte-level striping with dedicated parity
    Volume.RAID_TYPE_RAID4
    # Block-level striping with dedicated parity
    Volume.RAID_TYPE_RAID5
    # Block-level striping with distributed parity
    Volume.RAID_TYPE_RAID6
    # Block-level striping with two distributed parities, aka, RAID-DP
    Volume.RAID_TYPE_RAID10
    # Stripe of mirrors
    Volume.RAID_TYPE_RAID15
    # Parity of mirrors
    Volume.RAID_TYPE_RAID16
    # Dual parity of mirrors
    Volume.RAID_TYPE_RAID50
    # Stripe of parities
    Volume.RAID_TYPE_RAID60
    # Stripe of dual parities
    Volume.RAID_TYPE_RAID51
    # Mirror of parities
    Volume.RAID_TYPE_RAID61
    # Mirror of dual parities
    Volume.RAID_TYPE_JBOD
    # Just bunch of disks, no parity, no striping.
    Volume.RAID_TYPE_MIXED
    # This volume contains multiple RAID settings.
    Volume.RAID_TYPE_OTHER
    # Vendor specific RAID type

    Volume.STRIP_SIZE_UNKNOWN
    Volume.EXTENT_COUNT_UNKNOWN
    Volume.MIN_IO_SIZE_UNKNOWN
    Volume.OPT_IO_SIZE_UNKNOWN

 * New Capability:
    lsm.Volume.VOLUME_RAID_INFO

[1] On a 24 disks RAID6(RAID-DP), 4KiB strip size(not changeable):
    * With I/O size 90112(4096 * 22), write speed is 73.4 MB/s
    * With I/O size 65536, write speed is 86.9 MB/s
      # the optimal_io_size exposed via sysfs from SCSI BLOCK LIMITS(0xB0) VPD

[2] No NetApp official document confirm or deny it. Waiting NetApp's reply.

Changes in V2:
 * Add 'New in 1.2' docstring.

Changes in V4(No change in V3):
 * Change the value of these constants from -1 to 0 to align with
   libblkid/sysfs:
    Volume.STRIP_SIZE_UNKNOWN
    Volume.MIN_IO_SIZE_UNKNOWN
    Volume.OPT_IO_SIZE_UNKNOWN
    Volume.EXTENT_COUNT_UNKNOWN

Changes in V5:
  * Rename the return value 'extent_count' to 'disk_count' as it fit the
    most common expectation on RAID.
    For LVM RAID, EMC VMAX and other specific disk slice based RAID,
    the 'disk_count' here means the slice count.
    The constant renamed from EXTENT_COUNT_UNKNOWN to DISK_COUNT_UNKNOWN.

  * Updated docstring to explain the 'disk_count' return value when facing
    RAID system using disk slice.

Signed-off-by: Gris Ge <f...@redhat.com>
---
 python_binding/lsm/_client.py | 103 ++++++++++++++++++++++++++++++++++++++++++
 python_binding/lsm/_data.py   |  42 +++++++++++++++++
 2 files changed, 145 insertions(+)

diff --git a/python_binding/lsm/_client.py b/python_binding/lsm/_client.py
index e637962..a641b1d 100644
--- a/python_binding/lsm/_client.py
+++ b/python_binding/lsm/_client.py
@@ -971,3 +971,106 @@ class Client(INetworkAttachedStorage):
         """
         _check_search_key(search_key, TargetPort.SUPPORTED_SEARCH_KEYS)
         return self._tp.rpc('target_ports', _del_self(locals()))
+
+    ## Returns the RAID information of certain volume
+    # @param    self    The this pointer
+    # @param    raid_type       The RAID type of this volume
+    # @param    strip_size      The size of strip of disk or other storage
+    #                           extent.
+    # @param    disk_count      The count of disks of RAID group(s) where
+    #                           this volume allocated from.
+    # @param    min_io_size     The preferred I/O size of random I/O.
+    # @param    opt_io_size     The preferred I/O size of sequential I/O.
+    # @returns List of target ports, else raises LsmError
+    @_return_requires([int, int, int, int, int])
+    def volume_raid_info(self, volume, flags=FLAG_RSVD):
+        """Query the RAID information of certain volume.
+
+        New in version 1.2.
+
+        Query the RAID type, strip size, extents count, minimum I/O size,
+        optimal I/O size of given volume.
+
+        This method requires this capability:
+            lsm.Capabilities.VOLUME_RAID_INFO
+
+        Args:
+            volume (Volume object): Volume to query
+            flags (int): Reserved for future use. Should be set as
+                lsm.Client.FLAG_RSVD
+        Returns:
+            [raid_type, strip_size, disk_count, min_io_size, opt_io_size]
+
+            raid_type (int): RAID Type of requested volume.
+                Could be one of these values:
+                    Volume.RAID_TYPE_RAID0
+                        Stripe
+                    Volume.RAID_TYPE_RAID1
+                        Two disks Mirror
+                    Volume.RAID_TYPE_RAID3
+                        Byte-level striping with dedicated parity
+                    Volume.RAID_TYPE_RAID4
+                        Block-level striping with dedicated parity
+                    Volume.RAID_TYPE_RAID5
+                        Block-level striping with distributed parity
+                    Volume.RAID_TYPE_RAID6
+                        Block-level striping with two distributed parities,
+                        aka, RAID-DP
+                    Volume.RAID_TYPE_RAID10
+                        Stripe of mirrors
+                    Volume.RAID_TYPE_RAID15
+                        Parity of mirrors
+                    Volume.RAID_TYPE_RAID16
+                        Dual parity of mirrors
+                    Volume.RAID_TYPE_RAID50
+                        Stripe of parities
+                    Volume.RAID_TYPE_RAID60
+                        Stripe of dual parities
+                    Volume.RAID_TYPE_RAID51
+                        Mirror of parities
+                    Volume.RAID_TYPE_RAID61
+                        Mirror of dual parities
+                    Volume.RAID_TYPE_JBOD
+                        Just bunch of disks, no parity, no striping.
+                    Volume.RAID_TYPE_UNKNOWN
+                        The plugin failed to detect the volume's RAID type.
+                    Volume.RAID_TYPE_MIXED
+                        This volume contains multiple RAID settings.
+                    Volume.RAID_TYPE_OTHER
+                        Vendor specific RAID type
+            strip_size(int): The size of strip on each disk or other storage
+                extent.
+                For RAID1/JBOD, it should be set as sector size.
+                If plugin failed to detect strip size, it should be set
+                as Volume.STRIP_SIZE_UNKNOWN(0).
+            disk_count(int): The count of disks used for assembling the RAID
+                group(s) where this volume allocated from.
+                For any RAID system using the slice of disk, this value
+                indicate how many disk slices are used for the RAID.
+                For exmaple, on LVM RAID, the 'disk_count' here indicate the
+                count of PVs used for certain volume.
+                Another example, on EMC VMAX, the 'disk_count' here indicate
+                how many hyper volumes are used for this volume.
+                For any RAID system using remote LUN for data storing, each
+                remote LUN should be count as a disk.
+                If the plugin failed to detect disk_count, it should be set
+                as Volume.DISK_COUNT_UNKNOWN(0).
+            min_io_size(int): The minimum I/O size, device preferred I/O
+                size for random I/O. Any I/O size not equal to a multiple
+                of this value may get significant speed penalty.
+                Normally it refers to strip size of each disk(extent).
+                If plugin failed to detect min_io_size, it should try these
+                values in the sequence of:
+                logical sector size -> physical sector size ->
+                Volume.MIN_IO_SIZE_UNKNOWN(0).
+            opt_io_size(int): The optimal I/O size, device preferred I/O
+                size for sequential I/O. Normally it refers to RAID group
+                stripe size.
+                If plugin failed to detect opt_io_size, it should be set
+                to Volume.OPT_IO_SIZE_UNKNOWN(0).
+        Raises:
+            LsmError:
+                ErrorNumber.NO_SUPPORT
+                    No support.
+        """
+        return self._tp.rpc('volume_raid_info', _del_self(locals()))
diff --git a/python_binding/lsm/_data.py b/python_binding/lsm/_data.py
index 067c766..6fb2325 100644
--- a/python_binding/lsm/_data.py
+++ b/python_binding/lsm/_data.py
@@ -258,6 +258,46 @@ class Volume(IData):
     ADMIN_STATE_DISABLED = 0
     ADMIN_STATE_ENABLED = 1
 
+    RAID_TYPE_UNKNOWN = -1
+    # The plugin failed to detect the volume's RAID type.
+    RAID_TYPE_RAID0 = 0
+    # Stripe
+    RAID_TYPE_RAID1 = 1
+    # Mirror for two disks. For 4 disks or more, they are RAID10.
+    RAID_TYPE_RAID3 = 3
+    # Byte-level striping with dedicated parity
+    RAID_TYPE_RAID4 = 4
+    # Block-level striping with dedicated parity
+    RAID_TYPE_RAID5 = 5
+    # Block-level striping with distributed parity
+    RAID_TYPE_RAID6 = 6
+    # Block-level striping with two distributed parities, aka, RAID-DP
+    RAID_TYPE_RAID10 = 10
+    # Stripe of mirrors
+    RAID_TYPE_RAID15 = 15
+    # Parity of mirrors
+    RAID_TYPE_RAID16 = 16
+    # Dual parity of mirrors
+    RAID_TYPE_RAID50 = 50
+    # Stripe of parities
+    RAID_TYPE_RAID60 = 60
+    # Stripe of dual parities
+    RAID_TYPE_RAID51 = 51
+    # Mirror of parities
+    RAID_TYPE_RAID61 = 61
+    # Mirror of dual parities
+    RAID_TYPE_JBOD = 20
+    # Just bunch of disks, no parity, no striping.
+    RAID_TYPE_MIXED = 21
+    # This volume contains multiple RAID settings.
+    RAID_TYPE_OTHER = 22
+    # Vendor specific RAID type
+
+    STRIP_SIZE_UNKNOWN = 0
+    DISK_COUNT_UNKNOWN = 0
+    MIN_IO_SIZE_UNKNOWN = 0
+    OPT_IO_SIZE_UNKNOWN = 0
+
     def __init__(self, _id, _name, _vpd83, _block_size, _num_of_blocks,
                  _admin_state, _system_id, _pool_id, _plugin_data=None):
         self._id = _id                        # Identifier
@@ -669,6 +709,8 @@ class Capabilities(IData):
 
     VOLUME_ISCSI_CHAP_AUTHENTICATION = 53
 
+    VOLUME_RAID_INFO = 54
+
     VOLUME_THIN = 55
 
     #File system
-- 
1.8.3.1


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Libstoragemgmt-devel mailing list
Libstoragemgmt-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libstoragemgmt-devel

Reply via email to