class UnityLunEnablePerfStatsTest(TestCase): @patch_rest def setUp(self): self.unity = UnitySystem('10.244.223.61', 'a', 'a') self.unity.enable_perf_stats(1, [UnityDisk]) @patch_rest def tearDown(self): self.unity.disable_perf_stats() @patch_rest def test_lun_perf_not_enabled_exception(self): disk = self.unity.get_disk(_id='dae_0_1_disk_0') assert_that(disk.read_iops, is_nan()) def f(): return self.unity.get_lun(_id='sv_2').read_iops assert_that(f, raises(UnityPerfMonNotEnabledError, 'not enabled')) @patch_rest def test_lun_properties_perf_not_enabled(self): lun = self.unity.get_lun(_id='sv_2') assert_that(lun.property_names, is_not(has_item('read_iops'))) disk = self.unity.get_disk(_id='dae_0_1_disk_0') assert_that(disk.property_names(), has_item('read_iops'))
class UnityLunEnablePerfStatsTest(TestCase): @patch_rest def setUp(self): self.unity = UnitySystem('10.244.223.61', 'a', 'a') self.unity.enable_perf_stats(1, [UnityDisk]) @patch_rest def tearDown(self): self.unity.disable_perf_stats() @patch_rest def test_lun_perf_not_enabled_exception(self): disk = self.unity.get_disk(_id='dae_0_1_disk_0') assert_that(disk.read_iops, is_nan()) def f(): return self.unity.get_lun(_id='sv_2').read_iops assert_that(f, raises(UnityPerfMonNotEnabledError, 'not enabled')) @patch_rest def test_lun_properties_perf_not_enabled(self): lun = self.unity.get_lun(_id='sv_2') assert_that(lun.property_names, is_not(has_item('read_iops'))) disk = self.unity.get_disk(_id='dae_0_1_disk_0') assert_that(disk.property_names(), has_item('read_iops')) @patch_rest def test_nested_properties(self): lun = self.unity.get_lun(_id='sv_12') assert_that(lun.pool.raid_type, equal_to(RaidTypeEnum.RAID10)) assert_that(lun.pool.is_fast_cache_enabled, equal_to(False)) assert_that(lun.host_access[0].host.name, equal_to('Virtual_Machine_12'))
class UnityLunEnablePerfStatsTest(TestCase): @patch_rest def setUp(self): self.unity = UnitySystem('10.244.223.61', 'a', 'a') self.unity.enable_perf_stats(1, [UnityDisk]) @patch_rest def tearDown(self): self.unity.disable_perf_stats() @patch_rest def test_lun_perf_not_enabled_exception(self): disk = self.unity.get_disk(_id='dae_0_1_disk_0') assert_that(disk.read_iops, is_nan()) def f(): return self.unity.get_lun(_id='sv_2').read_iops assert_that(f, raises(UnityPerfMonNotEnabledError, 'not enabled')) @patch_rest def test_lun_properties_perf_not_enabled(self): lun = self.unity.get_lun(_id='sv_2') assert_that(lun.property_names, is_not(has_item('read_iops'))) disk = self.unity.get_disk(_id='dae_0_1_disk_0') assert_that(disk.property_names(), has_item('read_iops')) @patch_rest def test_nested_properties(self): lun = self.unity.get_lun(_id='sv_12') assert_that(lun.pool.raid_type, equal_to(RaidTypeEnum.RAID10)) assert_that(lun.pool.is_fast_cache_enabled, equal_to(False)) assert_that(lun.host_access[0].host.name, equal_to('Virtual_Machine_12')) @patch_rest def test_create_snap_of_member_snap_not_support(self): lun = UnityLun(cli=t_rest(), _id='sv_58') assert_that( calling(lun.create_snap).with_args(name='not-support'), raises(UnityCGMemberActionNotSupportError)) @patch_rest def test_thinclone_of_member_snap_not_support(self): lun = UnityLun(cli=t_rest(version='4.3'), _id='sv_58') assert_that( calling(lun.thin_clone).with_args('not-support'), raises(UnityCGMemberActionNotSupportError)) @patch_rest def test_thinclone_of_thick_lun_not_allowed(self): lun = UnityLun(cli=t_rest(version='4.3'), _id='sv_59') assert_that( calling(lun.thin_clone).with_args('not-allowed'), raises(UnityThinCloneNotAllowedError))
def test_get_lun_with_host_access(self): unity = UnitySystem('10.109.22.101', 'admin', 'Password123!') lun = unity.get_lun(_id='sv_567') assert_that(lun.host_access, instance_of(UnityBlockHostAccessList)) access = lun.host_access[0] assert_that(access.access_mask, equal_to(HostLUNAccessEnum.PRODUCTION)) assert_that(access.host, instance_of(UnityHost)) assert_that(access.host.id, equal_to('Host_1'))
def test_get_lun_with_host_access(self): unity = UnitySystem('10.109.22.101', 'admin', 'Password123!') lun = unity.get_lun(_id='sv_567') assert_that(lun.host_access, instance_of(UnityBlockHostAccessList)) access = lun.host_access[0] assert_that(access.access_mask, equal_to(HostLUNAccessEnum.PRODUCTION)) assert_that(access.host, instance_of(UnityHost)) assert_that(access.host.id, equal_to('Host_1'))
import sys import re from storops import UnitySystem import json array_ip = '' array_user = '******' array_pass = '******' unity = UnitySystem(array_ip, array_user, array_pass) luns = unity.get_lun() for lun in luns: lun_id = lun.id lun_name = lun.name lun_wwn = lun.wwn lun_size = lun.size_total / 1024 / 1024 / 1024 print('Lun ID: {}'.format(lun_id)) print('Lun Name: {}'.format(lun_name)) print('Lun Size (GB): {}'.format(lun_size)) print('Lun WWN: {}'.format(lun.wwn)) lun_pool = lun.pool.id print('Lun Pool: {}'.format(lun_pool)) print()
# file.writelines(unity.get_dae().json(indent=4)) # file.writelines(unity.get_disk().json(indent=4)) # file.writelines(unity.get_ssd().json(indent=4)) # file.writelines(unity.get_battery().json(indent=4)) # file.writelines(unity.get_power_supply().json(indent=4)) # file.writelines(unity.get_sas_port().json(indent=4)) # file.writelines(unity.get_ethernet_port().json(indent=4)) # file.writelines(unity.get_ip_port().json(indent=4)) # file.writelines(unity.get_lcc().json(indent=4)) # file.writelines(unity.get_io_module().json(indent=4)) # file.writelines(unity.get_sas_port().json(indent=4)) # file.writelines(unity.get_fan().json(indent=4)) # file.writelines(unity.get_memory_module().json(indent=4)) # file.writelines(unity.get_license().json(indent=4)) # file.writelines(unity.get_capability_profile().json(indent=4)) # file.writelines(unity.get_ssc().json(indent=4)) # file.writelines(unity.get_disk_group().json(indent=4)) # file.writelines(unity.get_pool().json(indent=4)) # file.writelines(unity.get_lun().json(indent=4)) # file.writelines(unity.get_host().json(indent=4)) # file.writelines(unity.get_initiator().json(indent=4)) # file.writelines(unity.get_file_interface().json(indent=4)) # file.writelines(unity.get_link_aggregation().json(indent=4)) # file.writelines(unity.get_filesystem().json(indent=4)) # file.writelines(unity.get_nas_server().json(indent=4)) # file.writelines(unity.get_nfs_server().json(indent=4)) # file.writelines(unity.get_nfs_share().json(indent=4)) # file.writelines(unity.get_cifs_server().json(indent=4)) # file.writelines(unity.get_cifs_share().json(indent=4)) print(unity.get_lun())