* Add lsm.Client.pool_raid_info() support:
  * Treat NetApp ONTAP aggregate as disk RAID group.
    Use na_disk['aggregate'] property to determine disk ownership.
  * Treat NetApp ONTAP volume as sub-pool.
    Use na_vol['containing-aggregate'] property to determine sub-pool
    ownership.

 * Set lsm.Capabilities.POOL_RAID_INFO.

Signed-off-by: Gris Ge <f...@redhat.com>
---
 plugin/ontap/ontap.py | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/plugin/ontap/ontap.py b/plugin/ontap/ontap.py
index f9f1f56..c3fe2e2 100644
--- a/plugin/ontap/ontap.py
+++ b/plugin/ontap/ontap.py
@@ -545,6 +545,7 @@ def capabilities(self, system, flags=0):
         cap.set(Capabilities.TARGET_PORTS)
         cap.set(Capabilities.DISKS)
         cap.set(Capabilities.VOLUME_RAID_INFO)
+        cap.set(Capabilities.POOL_RAID_INFO)
         return cap
 
     @handle_ontap_errors
@@ -1330,3 +1331,23 @@ def volume_raid_info(self, volume, flags=0):
         return [
             raid_type, Ontap._STRIP_SIZE, disk_count, Ontap._STRIP_SIZE,
             Ontap._OPT_IO_SIZE]
+
+    @handle_ontap_errors
+    def pool_raid_info(self, pool, flags=0):
+        if pool.element_type & Pool.ELEMENT_TYPE_VOLUME:
+            # We got a NetApp volume
+            raid_type = Volume.RAID_TYPE_OTHER
+            member_type = Pool.MEMBER_TYPE_POOL
+            na_vol = self.f.volumes(volume_name=pool.name)[0]
+            disk_ids = [na_vol['containing-aggregate']]
+        else:
+            # We got a NetApp aggregate
+            member_type = Pool.MEMBER_TYPE_DISK
+            na_aggr = self.f.aggregates(aggr_name=pool.name)[0]
+            raid_type = Ontap._raid_type_of_na_aggr(na_aggr)
+            disk_ids = list(
+                Ontap._disk_id(d)
+                for d in self.f.disks()
+                if 'aggregate' in d and d['aggregate'] == pool.name)
+
+        return raid_type, member_type, disk_ids
-- 
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