@@ -77,17 +77,18 @@ def __init__(self, *args, **kwargs):
7777 @staticmethod
7878 def _get_disk_type_by_storage_pool (pool_info ):
7979 """
80- The method for storage pool to obtain the disk type is as follows:
81- If disk type information exists in 'TIER0CAPACITY','TIER1CAPACITY', 'TIER2CAPACITY',
82- separate them with commas ',' and return them.
80+ Get disk type of the pool.
8381 """
8482 pool_disks = []
8583 for i , x in enumerate (constants .TIER_DISK_TYPES ):
8684 if (pool_info .get ('TIER%dCAPACITY' % i ) and
8785 pool_info .get ('TIER%dCAPACITY' % i ) != '0' ):
8886 pool_disks .append (x )
8987
90- return ',' .join (pool_disks ) if pool_disks else None
88+ if len (pool_disks ) > 1 :
89+ pool_disks = ['mix' ]
90+
91+ return pool_disks [0 ] if pool_disks else None
9192
9293 def do_setup (self , context ):
9394 self .conf .update_config_value ()
@@ -190,12 +191,7 @@ def _get_capacity(self, pool_info):
190191
191192 def _get_disk_type (self , pool_info ):
192193 """Get disk type of the pool."""
193-
194- if not self .configuration .is_dorado_v6 :
195- disk_type = self ._get_disk_type_by_storage_pool (pool_info )
196- else :
197- disk_type = self ._get_disk_type_by_disk_pool (pool_info )
198- LOG .info ("The disk type is %s" , disk_type )
194+ disk_type = self ._get_disk_type_by_storage_pool (pool_info )
199195 return disk_type
200196
201197 def _get_smarttier (self , disk_type ):
@@ -866,24 +862,3 @@ def _merge_roce_mapping(self, local_mapping, remote_mapping):
866862 local_mapping ['portals' ].extend (remote_mapping ['portals' ])
867863 local_mapping ['target_luns' ].extend (remote_mapping ['target_luns' ])
868864 return local_mapping
869-
870- def _get_disk_type_by_disk_pool (self , pool_info ):
871- """
872- The method for disk pool to obtain the disk type is as follows:
873- Check whether diskTypeList contains disk type information.
874- If diskTypeList contains disk type information, separate disk types with commas ','.
875- If diskTypeList does not contain disk type information,
876- use the disk type returned by TIER0DISKTYPE.
877- """
878- pool_disks = []
879- disk_pool_info = self .local_cli .get_disk_pool_by_id (pool_info .get ('PARENTID' ))
880- if disk_pool_info .get ('diskTypeList' ):
881- for disk_type in json .loads (disk_pool_info .get ('diskTypeList' )):
882- if constants .HUAWEI_DISK_DICT .get (disk_type ):
883- pool_disks .append (constants .HUAWEI_DISK_DICT .get (disk_type ))
884-
885- if not pool_disks :
886- pool_disks .append (constants .HUAWEI_DISK_DICT .get (disk_pool_info .get ('TIER0DISKTYPE' )))
887- return pool_disks [0 ]
888-
889- return ',' .join (pool_disks ) if pool_disks else None
0 commit comments