Example #1
0
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'))
Example #2
0
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'))
Example #3
0
    def test_lun_perf_disabled_exception(self):
        unity = UnitySystem('10.244.223.61', 'a', 'a')
        unity.disable_perf_stats()

        def f():
            return unity.get_lun(_id='sv_2').read_iops

        assert_that(f, raises(UnityPerfMonNotEnabledError, 'not enabled'))
Example #4
0
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))