Beispiel #1
0
 def test_change_name_failed(self):
     l = VNXLun(name='l1', cli=t_cli())
     try:
         l.name = 'l3'
         self.fail('should have raised an exception.')
     except VNXModifyLunError:
         assert_that(l._get_name(), equal_to('l1'))
Beispiel #2
0
 def test_change_name_failed(self):
     l = VNXLun(name='l1', cli=t_cli())
     try:
         l.name = 'l3'
         self.fail('should have raised an exception.')
     except VNXModifyLunError:
         assert_that(l._get_name(), equal_to('l1'))
Beispiel #3
0
 def test_get_snap(self):
     lun = VNXLun(lun_id=196, cli=t_cli())
     assert_that(lun.name, equal_to('Exch-BronzePlan-AppSync-2.2'))
     assert_that(lun.lun_id, equal_to(196))
     snaps = lun.get_snap()
     assert_that(len(snaps), equal_to(13))
     for snap in snaps:
         assert_that(snap.source_luns, has_item(lun.lun_id))
Beispiel #4
0
 def test_get_snap(self):
     lun = VNXLun(lun_id=196, cli=t_cli())
     assert_that(lun.name, equal_to('Exch-BronzePlan-AppSync-2.2'))
     assert_that(lun.lun_id, equal_to(196))
     snaps = lun.get_snap()
     assert_that(len(snaps), equal_to(13))
     for snap in snaps:
         assert_that(snap.source_luns, has_item(lun.lun_id))
Beispiel #5
0
 def test_property_instance_cache(self):
     m1 = VNXLun(name='m1', cli=t_cli())
     s1 = m1.attached_snapshot
     s2 = m1.attached_snapshot
     assert_that(hash(s1), equal_to(hash(s2)))
     m1.update()
     s3 = m1.attached_snapshot
     assert_that(hash(s3), is_not(equal_to(hash(s1))))
     assert_that(s1._cli, not_none())
Beispiel #6
0
 def test_mount_point_properties(self):
     lun = VNXLun(name='l1', cli=t_cli())
     m1 = lun.create_mount_point(name='m1')
     assert_that(m1.name, equal_to('m1'))
     assert_that(m1.lun_id, equal_to(4057))
     s1 = m1.attached_snapshot
     assert_that(s1, instance_of(VNXSnap))
     assert_that(s1._cli, equal_to(t_cli()))
     assert_that(s1._get_name(), equal_to('s1'))
Beispiel #7
0
 def test_create_mount_point(self):
     lun = VNXLun(name='l1', cli=t_cli())
     m1 = lun.create_mount_point(mount_point_name='m1')
     assert_that(m1.name, equal_to('m1'))
     assert_that(m1.lun_id, equal_to(4057))
     assert_that(m1.attached_snapshot, equal_to('s1'))
     m2 = lun.create_mount_point(mount_point_name='m2')
     assert_that(lun.snapshot_mount_points, only_contains(4056, 4057))
     assert_that(m2.attached_snapshot, equal_to('N/A'))
Beispiel #8
0
 def test_mount_point_properties(self):
     lun = VNXLun(name='l1', cli=t_cli())
     m1 = lun.create_mount_point(name='m1')
     assert_that(m1.name, equal_to('m1'))
     assert_that(m1.lun_id, equal_to(4057))
     s1 = m1.attached_snapshot
     assert_that(s1, instance_of(VNXSnap))
     assert_that(s1._cli, equal_to(t_cli()))
     assert_that(s1._get_name(), equal_to('s1'))
Beispiel #9
0
 def test_property_instance_cache(self):
     m1 = VNXLun(name='m1', cli=t_cli())
     s1 = m1.attached_snapshot
     s2 = m1.attached_snapshot
     assert_that(hash(s1), equal_to(hash(s2)))
     m1.update()
     s3 = m1.attached_snapshot
     assert_that(hash(s3), is_not(equal_to(hash(s1))))
     assert_that(s1._cli, not_none())
Beispiel #10
0
 def test_create_mount_point(self):
     lun = VNXLun(name='l1', cli=t_cli())
     m1 = lun.create_mount_point(mount_point_name='m1')
     assert_that(m1.name, equal_to('m1'))
     assert_that(m1.lun_id, equal_to(4057))
     assert_that(m1.attached_snapshot, equal_to('s1'))
     m2 = lun.create_mount_point(mount_point_name='m2')
     assert_that(lun.snapshot_mount_points, only_contains(4056, 4057))
     assert_that(m2.attached_snapshot, equal_to('N/A'))
Beispiel #11
0
 def luns(self):
     """Aggregator for ioclass_luns and ioclass_snapshots."""
     lun_list, smp_list = [], []
     if self.ioclass_luns:
         lun_list = map(lambda l: VNXLun(lun_id=l.lun_id, name=l.name,
                                         cli=self._cli), self.ioclass_luns)
     if self.ioclass_snapshots:
         smp_list = map(lambda smp: VNXLun(name=smp.name, cli=self._cli),
                        self.ioclass_snapshots)
     return list(lun_list) + list(smp_list)
Beispiel #12
0
    def test_migration_on_complete_session_not_found(self):
        c = _Counter()

        def on_complete():
            c.increase()

        l0 = VNXLun(name='lun0', cli=t_cli())
        l1 = VNXLun(name='lun1', cli=t_cli())
        l0.migrate(l1, on_complete=on_complete).join()
        assert_that(c.x, equal_to(1))
Beispiel #13
0
    def test_migration_on_error(self):
        c = _Counter()

        def on_error():
            c.decrease()

        l0 = VNXLun(name='lun0', cli=t_cli())
        l2 = VNXLun(name='lun2', cli=t_cli())
        l2.migrate(l0, on_error=on_error).join()
        assert_that(c.x, equal_to(-1))
Beispiel #14
0
 def test_create_mount_point_success(self):
     lun = VNXLun(name='l1', cli=t_cli())
     m2 = lun.create_mount_point(name='m2')
     assert_that(lun.snapshot_mount_points, instance_of(VNXLunList))
     assert_that(str(lun), contains_string('"VNXLunList": ['))
     for smp in lun.snapshot_mount_points:
         assert_that(smp, instance_of(VNXLun))
         pl = smp.primary_lun
         assert_that(pl, instance_of(VNXLun))
         assert_that(pl._get_name(), equal_to('l1'))
     assert_that(m2.attached_snapshot, none())
Beispiel #15
0
 def test_create_mount_point_success(self):
     lun = VNXLun(name='l1', cli=t_cli())
     m2 = lun.create_mount_point(name='m2')
     assert_that(lun.snapshot_mount_points, instance_of(VNXLunList))
     assert_that(str(lun), contains_string('"VNXLunList": ['))
     for smp in lun.snapshot_mount_points:
         assert_that(smp, instance_of(VNXLun))
         pl = smp.primary_lun
         assert_that(pl, instance_of(VNXLun))
         assert_that(pl._get_name(), equal_to('l1'))
     assert_that(m2.attached_snapshot, none())
Beispiel #16
0
 def test_lun_properties(self):
     wwn = '60:06:01:60:12:60:3D:00:95:63:38:87:9D:69:E5:11'
     lun = VNXLun(lun_id=3, cli=t_cli())
     assert_that(lun.state, equal_to('Ready'))
     assert_that(lun.wwn, equal_to(wwn))
     assert_that(lun.status, equal_to('OK(0x0)'))
     assert_that(lun.operation, equal_to('None'))
     assert_that(lun.total_capacity_gb, equal_to(500.0))
     assert_that(lun.current_owner, equal_to(VNXSPEnum.SP_A))
     assert_that(lun.default_owner, equal_to(VNXSPEnum.SP_A))
     assert_that(lun.attached_snapshot, none())
     assert_that(lun.lun_id, equal_to(3))
     assert_that(lun.name, equal_to('File_CS0_21132_0_d7'))
     assert_that(lun.pool_name, equal_to('Pool4File'))
     assert_that(lun.is_thin_lun, equal_to(True))
     assert_that(lun.is_compressed, equal_to(False))
     assert_that(lun.is_dedup, equal_to(False))
     assert_that(lun.initial_tier, equal_to('Optimize Pool'))
     assert_that(lun.tiering_policy, none())
     assert_that(lun.is_private, equal_to(False))
     assert_that(lun.user_capacity_gbs, equal_to(500.0))
     assert_that(lun.consumed_capacity_gbs, equal_to(512.249))
     assert_that(len(lun.snapshot_mount_points), equal_to(0))
     assert_that(lun.primary_lun, none())
     assert_that(lun.raid_type, equal_to(VNXPoolRaidType.RAID_MIXED))
Beispiel #17
0
 def test_attach_alu(self):
     sg = self.test_sg()
     lun = VNXLun(name='x', cli=t_cli())
     assert_that(sg.has_alu(0), equal_to(False))
     sg.attach_alu(lun)
     assert_that(sg.has_alu(0), equal_to(True))
     assert_that(sg.get_hlu(0), equal_to(1))
Beispiel #18
0
 def test_lun_perf_counters(self):
     lun = VNXLun(lun_id=3, cli=t_cli())
     assert_that(lun.read_requests, equal_to(1))
     assert_that(lun.read_requests_sp_a, equal_to(2))
     assert_that(lun.read_requests_sp_b, equal_to(3))
     assert_that(lun.write_requests, equal_to(4))
     assert_that(lun.write_requests_sp_a, equal_to(5))
     assert_that(lun.write_requests_sp_b, equal_to(6))
     assert_that(lun.blocks_read, equal_to(7))
     assert_that(lun.blocks_read_sp_a, equal_to(8))
     assert_that(lun.blocks_read_sp_b, equal_to(9))
     assert_that(lun.blocks_written, equal_to(10))
     assert_that(lun.blocks_written_sp_a, equal_to(11))
     assert_that(lun.blocks_written_sp_b, equal_to(12))
     assert_that(lun.busy_ticks, equal_to(13))
     assert_that(lun.busy_ticks_sp_a, equal_to(14))
     assert_that(lun.busy_ticks_sp_b, equal_to(15))
     assert_that(lun.idle_ticks, equal_to(16))
     assert_that(lun.idle_ticks_sp_a, equal_to(17))
     assert_that(lun.idle_ticks_sp_b, equal_to(18))
     assert_that(lun.sum_of_outstanding_requests, equal_to(19))
     assert_that(lun.sum_of_outstanding_requests_sp_a, equal_to(20))
     assert_that(lun.sum_of_outstanding_requests_sp_b, equal_to(21))
     assert_that(lun.non_zero_request_count_arrivals, equal_to(22))
     assert_that(lun.non_zero_request_count_arrivals_sp_a, equal_to(23))
     assert_that(lun.non_zero_request_count_arrivals_sp_b, equal_to(24))
     assert_that(lun.implicit_trespasses, equal_to(25))
     assert_that(lun.implicit_trespasses_sp_a, equal_to(26))
     assert_that(lun.implicit_trespasses_sp_b, equal_to(27))
     assert_that(lun.explicit_trespasses, equal_to(28))
     assert_that(lun.explicit_trespasses_sp_a, equal_to(29))
     assert_that(lun.explicit_trespasses_sp_b, equal_to(30))
     assert_that(lun.extreme_performance, equal_to(1.96))
     assert_that(lun.performance, equal_to(5.68))
     assert_that(lun.capacity, equal_to(92.37))
Beispiel #19
0
 def test_create_with_sp_success(self):
     lun = VNXLun.create(t_cli(),
                         pool_id=0,
                         lun_id=2,
                         size_gb=2,
                         sp_id='A')
     assert_that(lun.user_capacity_gbs, equal_to(2.0))
Beispiel #20
0
 def add_image(self, sp_ip, lun_id,
               recovery_policy=VNXMirrorViewRecoveryPolicy.AUTO,
               sync_rate=VNXMirrorViewSyncRate.HIGH):
     lun_id = VNXLun.get_id(lun_id)
     self._cli.add_mirror_view_image(self._get_name(), sp_ip, lun_id,
                                     recovery_policy, sync_rate,
                                     poll=self.poll)
Beispiel #21
0
 def test_attach_alu_success(self):
     sg = self.sg_7
     lun = VNXLun(name='x', cli=t_cli())
     assert_that(sg.has_alu(0), equal_to(False))
     hlu = sg.attach_alu(lun)
     assert_that(sg.has_alu(0), equal_to(True))
     assert_that(sg.get_hlu(0), equal_to(1))
     assert_that(hlu, equal_to(1))
Beispiel #22
0
def normalize_lun(luns, cli):
    if isinstance(luns, int):
        return [VNXLun(lun_id=luns, cli=cli)]
    elif isinstance(luns, VNXLun):
        return [luns]
    elif isinstance(luns, list) or isinstance(luns, VNXLunList):
        return luns
    elif luns is None:
        return []
    else:
        raise ValueError('Invalid format for luns.')
Beispiel #23
0
 def create_lun(self,
                lun_name=None,
                size_gb=1,
                lun_id=None,
                provision=None,
                tier=None,
                ignore_thresholds=None):
     pool = {}
     if self._pool_id is not None:
         pool['pool_id'] = self._pool_id
     else:
         pool['pool_name'] = self._get_name()
     ret = self._cli.create_pool_lun(lun_name=lun_name,
                                     lun_id=lun_id,
                                     size_gb=size_gb,
                                     provision=provision,
                                     tier=tier,
                                     ignore_thresholds=ignore_thresholds,
                                     poll=self.poll,
                                     **pool)
     raise_if_err(ret, ex.VNXCreateLunError, 'error creating lun.')
     return VNXLun(lun_id, lun_name, self._cli)
Beispiel #24
0
 def test_lun_tier_invalid_str(self):
     lun = VNXLun()
     self.assertRaises(AttributeError, setattr, lun, 'tier', 'invalid')
Beispiel #25
0
 def test_lun_provision_compressed(self):
     lun = VNXLun()
     lun.is_thin_lun = True
     lun.is_compressed = True
     lun.dedup_state = False
     assert_that(lun.provision, equal_to(VNXProvisionEnum.COMPRESSED))
Beispiel #26
0
 def test_lun_provision_str_not_valid(self):
     lun = VNXLun()
     self.assertRaises(AttributeError, setattr, lun, 'provision', 'invalid')
Beispiel #27
0
 def f():
     l = VNXLun(lun_id=4000, cli=t_cli())
     l.tier = VNXTieringEnum.LOW
Beispiel #28
0
 def get_lun(self):
     return VNXLun(lun_id=2, cli=t_cli())
Beispiel #29
0
 def test_delete_lun_has_smp(self):
     l = VNXLun(lun_id=196, cli=t_cli())
     # no error raised
     l.delete(force=True)
Beispiel #30
0
 def f():
     l = VNXLun(lun_id=1, cli=t_cli())
     l.expand(12)
Beispiel #31
0
 def f():
     l1 = VNXLun(name='not_exists', cli=t_cli())
     l1.delete()
Beispiel #32
0
 def set_property():
     l1 = VNXLun(name='l1', cli=t_cli())
     l1.is_dedup = False
Beispiel #33
0
 def f():
     lun = VNXLun(name='y', cli=t_cli())
     lun.delete(force=True)
Beispiel #34
0
 def f():
     l2 = VNXLun(name='in_sg', cli=t_cli())
     l2.delete()
Beispiel #35
0
 def test_create_mirror_view(self):
     l = VNXLun(lun_id=245, cli=t_cli())
     mv = l.create_mirror_view('mv0')
     assert_that(mv.state, equal_to('Active'))
Beispiel #36
0
 def f():
     l1 = VNXLun(lun_id=1, cli=t_cli())
     l2 = VNXLun(lun_id=2, cli=t_cli())
     l1.migrate(l2)
Beispiel #37
0
 def f():
     l1 = VNXLun(lun_id=3, cli=t_cli())
     l1.create_snap('s1')
Beispiel #38
0
 def test_lun_tier_high(self):
     lun = VNXLun()
     lun.tiering_policy = 'Highest Available'
     lun.initial_tier = 'Highest Available'
     assert_that(lun.tier, equal_to(VNXTieringEnum.HIGH))
Beispiel #39
0
 def method_call():
     l1 = VNXLun(name='l1', cli=t_cli())
     l1.disable_dedup()
Beispiel #40
0
 def test_create_mirror_view(self):
     lun = VNXLun(245)
     mv = self.vnx.create_mirror_view('mv0', lun)
     assert_that(mv.state, equal_to('Active'))
Beispiel #41
0
 def f():
     l2 = VNXLun(name='l3', cli=t_cli())
     l2.enable_dedup()
Beispiel #42
0
 def get_lun(self, lun_id=None, name=None, lun_type=None):
     return VNXLun.get(self._cli, lun_id=lun_id, name=name,
                       lun_type=lun_type)
Beispiel #43
0
 def prop():
     l1 = VNXLun(lun_id=19, cli=t_cli())
     l1.is_compressed = False
Beispiel #44
0
 def f():
     l = VNXLun(lun_id=0, cli=t_cli())
     l.expand(999999)
Beispiel #45
0
 def method():
     l1 = VNXLun(lun_id=19, cli=t_cli())
     l1.disable_compression()
Beispiel #46
0
 def f():
     l1 = VNXLun(lun_id=11, cli=t_cli())
     l1.create_snap('s1')
Beispiel #47
0
 def f():
     l1 = VNXLun(lun_id=3, cli=t_cli())
     l1.enable_compression(VNXCompressionRate.LOW, True)
Beispiel #48
0
 def test_lun_provision_default(self):
     lun = VNXLun()
     self.assertEqual(VNXProvisionEnum.THICK, lun.provision)
Beispiel #49
0
 def method():
     l1 = VNXLun(lun_id=19, cli=t_cli())
     l1.enable_compression(VNXCompressionRate.HIGH)
Beispiel #50
0
 def test_lun_provision_dedup(self):
     lun = VNXLun()
     lun.is_thin_lun = True
     lun.is_compressed = False
     lun.dedup_state = True
     assert_that(lun.provision, equal_to(VNXProvisionEnum.DEDUPED))
Beispiel #51
0
 def test_get_id_list(self):
     l22 = VNXLun(lun_id=22)
     l23 = VNXLun(lun_id=23)
     assert_that(VNXLun.get_id_list(l22, l23), only_contains(22, 23))
Beispiel #52
0
 def test_lun_tier_default(self):
     lun = VNXLun()
     self.assertEqual(VNXTieringEnum.HIGH_AUTO, lun.tier)
Beispiel #53
0
 def test_get_id_with_update(self):
     m1 = VNXLun(name='m1', cli=t_cli())
     assert_that(VNXLun.get_id(m1), equal_to(4057))
Beispiel #54
0
 def test_lun_tier_auto(self):
     lun = VNXLun()
     lun.tiering_policy = 'Auto Tier'
     lun.initial_tier = 'Optimize Pool'
     assert_that(lun.tier, equal_to(VNXTieringEnum.AUTO))
Beispiel #55
0
 def test_get_id(self):
     l1 = VNXLun(lun_id=11)
     assert_that(VNXLun.get_id(l1), equal_to(11))
Beispiel #56
0
 def test_get_migration_session(self):
     source = VNXLun(lun_id=0)
     ms = self.vnx.get_migration_session(source)
     assert_that(ms.existed, equal_to(True))
Beispiel #57
0
 def get_lun(self):
     lun_list = VNXLun.get(self._cli, poll=self.poll)
     return [l for l in lun_list if l.pool_name == self.name]
Beispiel #58
0
 def test_create_mirror_view_async(self):
     lun = VNXLun(71)
     mv = self.vnx.create_mirror_view_async('testdr_003', lun)
     assert_that(mv.state, equal_to('Active'))
Beispiel #59
0
 def f():
     l2 = VNXLun(name='l2', cli=t_cli())
     l2.delete()