def test_enable_persist_perf_stats(self): vnx = VNXSystem('10.244.211.30', heartbeat_interval=0) vnx.enable_persist_perf_stats() assert_that(vnx.is_perf_stats_persisted(), equal_to(True)) vnx.disable_persist_perf_stats() assert_that(vnx.is_perf_stats_persisted(), equal_to(False))
def test_enable_perf_stats_default(self): vnx = VNXSystem('10.244.211.30', heartbeat_interval=0) clz_list = vnx.enable_perf_stats() assert_that(len(clz_list), equal_to(6)) assert_that(vnx.is_perf_stats_enabled(), equal_to(True)) vnx.disable_perf_stats() assert_that(vnx.is_perf_stats_enabled(), equal_to(False))
def test_member_ips(self): vnx = VNXSystem('10.244.211.30', heartbeat_interval=0) assert_that(vnx.spa_ip, equal_to('192.168.1.52')) assert_that(vnx.spb_ip, equal_to('192.168.1.53')) assert_that(vnx.control_station_ip, equal_to('10.244.211.32'))
def test_enable_perf_stats_filtered(self): vnx = VNXSystem('10.244.211.30', heartbeat_interval=0) clz_list = vnx.enable_perf_stats([VNXLun, VNXDisk]) assert_that(len(clz_list), equal_to(2)) vnx.disable_perf_stats()
def f(): return VNXSystem('10.244.211.30', heartbeat_interval=0).spa_ip
def test_member_ip_no_cs(self): vnx = VNXSystem('1.1.1.1', heartbeat_interval=0) assert_that(vnx.control_station_ip, none())
def run_module(): module_args = dict( name=dict(type='str', required=True), lunid=dict(type='int', required=True), state=dict(default='present', choices=['present', 'absent']), ) module_args.update(emc_vnx_argument_spec) result = dict( changed=False, hluid=None ) module = AnsibleModule( argument_spec=module_args, supports_check_mode=True ) if not HAS_LIB: module.fail_json(msg=missing_required_lib('storops >= 0.5.10'), exception=LIB_IMP_ERR) sp_user = module.params['sp_user'] sp_address = module.params['sp_address'] sp_password = module.params['sp_password'] alu = module.params['lunid'] # if the user is working with this module in only check mode we do not # want to make any changes to the environment, just return the current # state with no modifications if module.check_mode: return result try: vnx = VNXSystem(sp_address, sp_user, sp_password) sg = vnx.get_sg(module.params['name']) if sg.existed: if module.params['state'] == 'present': if not sg.has_alu(alu): try: result['hluid'] = sg.attach_alu(alu) result['changed'] = True except VNXAluAlreadyAttachedError: result['hluid'] = sg.get_hlu(alu) except (VNXAttachAluError, VNXStorageGroupError) as e: module.fail_json(msg='Error attaching {0}: ' '{1} '.format(alu, to_native(e)), **result) else: result['hluid'] = sg.get_hlu(alu) if module.params['state'] == 'absent' and sg.has_alu(alu): try: sg.detach_alu(alu) result['changed'] = True except VNXDetachAluNotFoundError: # being not attached when using absent is OK pass except VNXStorageGroupError as e: module.fail_json(msg='Error detaching alu {0}: ' '{1} '.format(alu, to_native(e)), **result) else: module.fail_json(msg='No such storage group named ' '{0}'.format(module.params['name']), **result) except VNXCredentialError as e: module.fail_json(msg='{0}'.format(to_native(e)), **result) module.exit_json(**result)
def vnx2(): vnx = VNXSystem('192.168.1.94', 'sysadmin', 'sysadmin') log.debug('initialize vnx system: {}'.format(vnx)) return vnx
def t_vnx(): vnx = VNXSystem('10.244.211.30', 'sysadmin', 'sysadmin') log.debug('initialize vnx system: {}'.format(vnx)) return vnx