* 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.
Changes in V3:
* Renamed to pool_member_info().
Signed-off-by: Gris Ge <fge(a)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..5a01494 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_MEMBER_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_member_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