* Any disk not have 'aggregate' property is considered as free disk.

 * Added comments indicate how spare and free disk works on ONTAP:
    1. Spare  == free disk
    2. Zeroed spare disk == OK | SPARE | FREE
    3. Non-zeroed spare disk == STOPPED | SPARE | FREE

Changes in V2:
 * Should not mark partner filer's disks as free.
   # Don't check status of partner's disks, simply mark as STATUS_OTHER.

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

diff --git a/plugin/ontap/ontap.py b/plugin/ontap/ontap.py
index b6358a8..570833a 100644
--- a/plugin/ontap/ontap.py
+++ b/plugin/ontap/ontap.py
@@ -265,13 +265,17 @@ class Ontap(IStorageAreaNetwork, INfs):
                 if 'is-zeroed' in na_disk and na_disk['is-zeroed'] == 'true':
                     status |= Disk.STATUS_OK | Disk.STATUS_SPARE_DISK
                 else:
+                    # If spare disk is not zerored, it will be automaticlly
+                    # zeroed before assigned to aggregate.
+                    # Hence we consider non-zeroed spare disks as stopped
+                    # spare disks.
                     status |= Disk.STATUS_STOPPED | Disk.STATUS_SPARE_DISK
             elif rs == 'present':
                 status |= Disk.STATUS_OK
             elif rs == 'partner':
                 # Before we have good way to connect two controller,
                 # we have to mark partner disk as OTHER
-                status |= Disk.STATUS_OTHER
+                return Disk.STATUS_OTHER
 
         if 'is-prefailed' in na_disk and na_disk['is-prefailed'] == 'true':
             status |= Disk.STATUS_STOPPING
@@ -279,6 +283,12 @@ class Ontap(IStorageAreaNetwork, INfs):
         if 'is-offline' in na_disk and na_disk['is-offline'] == 'true':
             status |= Disk.STATUS_ERROR
 
+        if 'aggregate' not in na_disk:
+            # All free disks are automatically marked as spare disks. They
+            # could easily convert to data or parity disk without any
+            # explicit command.
+            status |= Disk.STATUS_FREE
+
         if status == 0:
             status = Disk.STATUS_UNKNOWN
 
-- 
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