Ejemplo n.º 1
0
    def test_update(self):
        parser = get_vnx_parser('VNXConsistencyGroup')
        data = {
            parser.NAME.key: 'test cg name',
            parser.LUN_LIST.key: [1, 5, 7],
            parser.STATE.key: 'Offline'
        }

        cg = VNXConsistencyGroup()
        cg.update(data)

        assert_that(cg.name, equal_to('test cg name'))
        assert_that(cg.lun_list, only_contains(1, 5, 7))
        assert_that(cg.state, equal_to('Offline'))
Ejemplo n.º 2
0
    def test_update(self):
        parser = get_parser_config('VNXConsistencyGroup')
        data = {
            parser.NAME.key: 'test cg name',
            parser.LUN_LIST.key: [1, 5, 7],
            parser.STATE.key: 'Offline'
        }

        cg = VNXConsistencyGroup()
        cg.update(data)

        self.assertEqual('test cg name', cg.name)
        self.assertEqual([1, 5, 7], cg.lun_list)
        self.assertEqual('Offline', cg.state)
Ejemplo n.º 3
0
 def test_parse(self):
     output = """
             Name:  test cg name
             Name:  another cg
             """
     cgs = VNXConsistencyGroup.parse_all(output)
     assert_that(len(cgs), equal_to(2))
     names = [cg.name for cg in cgs]
     assert_that(names, has_item('test cg name'))
     assert_that(names, has_item('another cg'))
Ejemplo n.º 4
0
 def test_parse(self):
     output = """
             Name:  test cg name
             Name:  another cg
             """
     cgs = VNXConsistencyGroup.parse_all(output)
     self.assertEqual(2, len(cgs))
     names = [cg.name for cg in cgs]
     assert_that(names, has_item('test cg name'))
     assert_that(names, has_item('another cg'))
Ejemplo n.º 5
0
 def test_list_consistency_group(self):
     cg_list = VNXConsistencyGroup.get(t_cli())
     assert_that(len(cg_list), equal_to(2))
     assert_that(cg_list.name, only_contains('another cg', 'test cg name'))
Ejemplo n.º 6
0
 def test_cg_empty_member_property(self):
     cg = VNXConsistencyGroup(name='cg0', cli=t_cli())
     assert_that(len(cg.lun_list), equal_to(0))
Ejemplo n.º 7
0
 def f():
     cg = VNXConsistencyGroup(name="cg2", cli=t_cli())
     cg.create_snap('cg1_snap')
Ejemplo n.º 8
0
 def create_cg(self, name, members=None):
     return VNXConsistencyGroup.create(self._cli, name=name,
                                       members=members)
Ejemplo n.º 9
0
 def test_has_member(self):
     cg = VNXConsistencyGroup('test_cg', t_cli())
     lun = VNXLun(lun_id=1)
     assert_that(cg.has_member(lun), equal_to(True))
     assert_that(cg.has_member(7), equal_to(False))
Ejemplo n.º 10
0
 def f():
     cg = VNXConsistencyGroup(name="test_cg", cli=t_cli())
     with cg.with_no_poll():
         cg.add_member(1, 2, 3)
Ejemplo n.º 11
0
 def delete_cg(self, name):
     self._delete_resource(VNXConsistencyGroup(name, self._cli))
Ejemplo n.º 12
0
 def test_update_consistency_group_list_member(self):
     cg_list = VNXConsistencyGroup.get(t_cli())
     cg = cg_list[1]
     name = cg.name
     cg.update()
     assert_that(cg.name, equal_to(name))
Ejemplo n.º 13
0
 def f():
     cg = VNXConsistencyGroup(name="test_cg", cli=t_cli())
     with cg.with_no_poll():
         cg.add_member(1, 2, 3)
Ejemplo n.º 14
0
 def test_has_member(self):
     cg = VNXConsistencyGroup('test_cg', t_cli())
     lun = VNXLun(lun_id=1)
     assert_that(cg.has_member(lun), equal_to(True))
     assert_that(cg.has_member(7), equal_to(False))
Ejemplo n.º 15
0
 def f():
     cg = VNXConsistencyGroup('test_cg', t_cli())
     m1 = VNXLun(name='m1', cli=t_cli())
     m2 = VNXLun(name='m2', cli=t_cli())
     cg.add_member(m1, m2)
Ejemplo n.º 16
0
 def test_properties(self):
     cg = VNXConsistencyGroup(name="test_cg", cli=t_cli())
     assert_that(cg.name, equal_to('test_cg'))
     assert_that(cg.lun_list.lun_id, only_contains(1, 3))
     assert_that(cg.state, equal_to('Ready'))
     assert_that(cg.existed, equal_to(True))
Ejemplo n.º 17
0
 def f():
     cg = VNXConsistencyGroup(name="cg1", cli=t_cli())
     cg.add_member(1)
Ejemplo n.º 18
0
 def f():
     VNXConsistencyGroup.create(cli=t_cli(), name='cg0')
Ejemplo n.º 19
0
 def f():
     cg = VNXConsistencyGroup('test_cg', t_cli())
     m1 = VNXLun(name='m1', cli=t_cli())
     m2 = VNXLun(name='m2', cli=t_cli())
     cg.add_member(m1, m2)
Ejemplo n.º 20
0
 def f():
     cg = VNXConsistencyGroup(cli=t_cli(), name='cg0')
     cg.delete()
Ejemplo n.º 21
0
 def get_cg(self, name=None):
     return VNXConsistencyGroup.get(self._cli, name)
Ejemplo n.º 22
0
 def test_create_cg_snap_success(self):
     cg = VNXConsistencyGroup(name="cg1", cli=t_cli())
     snap = cg.create_snap('cg1_snap')
     assert_that(snap._name, equal_to('cg1_snap'))
     assert_that(snap.source_luns, only_contains(1))
     assert_that(snap.source_cg, equal_to('cg1'))
Ejemplo n.º 23
0
 def remove_cg(self, name):
     self._remove_resource(VNXConsistencyGroup(name, self._cli))
Ejemplo n.º 24
0
 def test_list_consistency_group(self):
     assert_that(len(VNXConsistencyGroup.get(t_cli())), equal_to(2))