def _get_tier_opt(tier): ret = [] if tier is not None: possible_tiers = VNXTieringEnum.get_all() if tier in possible_tiers: ret += VNXTieringEnum.get_opt(tier) else: raise ValueError('not supported tiering type: {}. ' 'valid candidates: {}' .format(tier, possible_tiers)) return ret
def _get_tier_opt(tier): ret = [] if tier is not None: possible_tiers = VNXTieringEnum.get_all() if tier in possible_tiers: ret += VNXTieringEnum.get_opt(tier) else: raise ValueError('not supported tiering type: {}. ' 'valid candidates: {}'.format( tier, possible_tiers)) return ret
def tier(self): try: tier = VNXTieringEnum.get_tier(self.initial_tier, self.tiering_policy) except AttributeError: tier = self.DEFAULT_TIER return tier
def tier(self, new_tier): new_tier = VNXTieringEnum.parse(new_tier) out = self._cli.modify_lun(lun_id=self._lun_id, lun_name=self._name, new_tier=new_tier, poll=self.poll) msg = 'error change lun tier.' ex.raise_if_err(out, msg, default=ex.VNXModifyLunError)
def tier(self): try: tier = VNXTieringEnum.get_tier( self.initial_tier, self.tiering_policy) except AttributeError: tier = self.DEFAULT_TIER return tier
def test_get_opt(self): opt = VNXTieringEnum.get_opt(VNXTieringEnum.HIGH_AUTO) self.assertEqual( '-initialTier highestAvailable -tieringPolicy autoTier', ' '.join(opt))
def test_valid_tier_enum(self): auto = VNXTieringEnum('auto') assert_that(auto, equal_to(VNXTieringEnum.AUTO))
def f(): VNXTieringEnum('abc')
def f(): VNXTieringEnum.get_opt('na')
def test_get_opt(self): opt = VNXTieringEnum.get_opt(VNXTieringEnum.HIGH_AUTO) assert_that( ' '.join(opt), equal_to('-initialTier highestAvailable -tieringPolicy autoTier'))