* Treating sim_disk['role'] == None as Free disk.

Changes in V3(No changes in V2):

 * Remove debug code of 'print sim_disk.items()'.

Signed-off-by: Gris Ge <f...@redhat.com>
---
 plugin/sim/simarray.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/plugin/sim/simarray.py b/plugin/sim/simarray.py
index 3fa7782..ae14848 100644
--- a/plugin/sim/simarray.py
+++ b/plugin/sim/simarray.py
@@ -194,7 +194,7 @@ class BackStore(object):
 
     DISK_KEY_LIST = [
         'id', 'name', 'total_space', 'disk_type', 'status',
-        'owner_pool_id']
+        'owner_pool_id', 'role']
 
     VOL_KEY_LIST = [
         'id', 'vpd83', 'name', 'total_space', 'consumed_size',
@@ -1762,12 +1762,16 @@ def pools(self, flags=0):
 
     @staticmethod
     def _sim_disk_2_lsm(sim_disk):
+        disk_status = Disk.STATUS_OK
+        if sim_disk['role'] is None:
+            disk_status |= Disk.STATUS_FREE
+
         return Disk(
             SimArray._sim_id_to_lsm_id(sim_disk['id'], 'DISK'),
             sim_disk['name'],
             sim_disk['disk_type'], BackStore.BLK_SIZE,
             int(sim_disk['total_space'] / BackStore.BLK_SIZE),
-            Disk.STATUS_OK, BackStore.SYS_ID)
+            disk_status, BackStore.SYS_ID)
 
     @_handle_errors
     def disks(self):
-- 
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