Пример #1
0
 def get_snap(self, name=None):
     if name is not None:
         ret = VNXSnap.get(self._cli, name)
     else:
         snaps = VNXSnap.get(self._cli)
         ret = [s for s in snaps if self.lun_id in s.source_luns]
     return ret
Пример #2
0
 def test_modify_snap_failed(self):
     snap = VNXSnap(cli=t_cli(), name='s2')
     try:
         snap.modify(new_name='s1')
         self.fail('should have raise an exception.')
     except VNXSnapError:
         assert_that(snap._name, equal_to('s2'))
Пример #3
0
 def get_snap(self, name=None):
     if name is not None:
         ret = VNXSnap.get(self._cli, name)
     else:
         snaps = VNXSnap.get(self._cli)
         ret = [s for s in snaps if self.lun_id in s.source_luns]
     return ret
Пример #4
0
 def test_modify_snap_failed(self):
     snap = VNXSnap(cli=t_cli(), name='s2')
     try:
         snap.modify(new_name='s1')
         self.fail('should have raise an exception.')
     except VNXSnapError:
         assert_that(snap._name, equal_to('s2'))
Пример #5
0
 def create_snap(self,
                 name,
                 allow_rw=None,
                 auto_delete=None,
                 keep_for=None):
     return VNXSnap.create(self._cli, self.get_id(self), name, allow_rw,
                           auto_delete, keep_for)
Пример #6
0
 def attach_snap(self, snap):
     snap_name = VNXSnap.get_name(snap)
     out = self._cli.attach_snap(snap_name,
                                 lun_id=self.get_id(self),
                                 poll=self.poll)
     if len(out):
         raise ex.VNXAttachSnapError(out)
Пример #7
0
 def attach_snap(self, snap):
     snap_name = VNXSnap.get_name(snap)
     out = self._cli.attach_snap(snap_name,
                                 lun_id=self.get_id(self),
                                 poll=self.poll)
     ex.raise_if_err(out,
                     'failed to attach snap {}'.format(snap_name),
                     default=ex.VNXAttachSnapError)
Пример #8
0
 def create_snap(self, name, allow_rw=None, auto_delete=None):
     out = self._cli.create_snap(self.get_id(self),
                                 name,
                                 allow_rw,
                                 auto_delete,
                                 poll=self.poll)
     raise_if_err(out, ex.VNXCreateSnapError,
                  'failed to create snap "{}"'.format(name))
     return VNXSnap(name, self._cli)
Пример #9
0
 def test_properties(self):
     snap = VNXSnap('gan_snap', t_cli())
     assert_that(snap.name, equal_to('gan_snap'))
     assert_that(snap.description, equal_to('gan snap'))
     assert_that(snap.creation_time, equal_to('05/24/13 20:06:12'))
     assert_that(snap.last_modify_time, equal_to('07/23/14 12:28:42'))
     assert_that(snap.last_modified_by, equal_to('N/A'))
     assert_that(snap.source_luns, equal_to([57]))
     assert_that(snap.source_cg, equal_to('N/A'))
     assert_that(snap.primary_luns, equal_to([57]))
     assert_that(snap.state, equal_to('Ready'))
     assert_that(snap.status, equal_to('OK(0x0)'))
     assert_that(snap.allow_read_write, equal_to(True))
     assert_that(snap.modified, equal_to(True))
     assert_that(snap.attached_luns, equal_to([]))
     assert_that(snap.allow_auto_delete, equal_to(True))
     assert_that(snap.expiration_date, equal_to('Never'))
     assert_that(snap.existed, equal_to(True))
Пример #10
0
 def f():
     src = VNXSnap.get(t_cli(), name='123')
     src.copy('456')
Пример #11
0
 def test_get_by_name(self):
     snap = VNXSnap.get(t_cli(), name='gan_snap')
     assert_that(snap.creation_time, equal_to('05/24/13 20:06:12'))
Пример #12
0
 def get_snap(self, name=None):
     return VNXSnap.get(self._cli, name)
Пример #13
0
 def get_snap(self, name=None):
     if name is not None:
         ret = VNXSnap.get(self._cli, name)
     else:
         ret = VNXSnapList(self._cli, res=self.get_id(self))
     return ret
Пример #14
0
 def remove_snap(self, name):
     VNXSnap(name, self._cli).remove()
Пример #15
0
 def attach_snap(self, snap):
     snap_name = VNXSnap.get_name(snap)
     out = self._cli.attach_snap(snap_name, lun_id=self.get_id(self),
                                 poll=self.poll)
     if len(out):
         raise ex.VNXAttachSnapError(out)
Пример #16
0
 def f():
     snap = VNXSnap(cli=t_cli(), name='s5')
     snap.restore(res_id='540', backup_snap='a-existing-snap')
Пример #17
0
 def test_attach_snap(self):
     m1 = VNXLun(name='m1', cli=t_cli())
     s1 = VNXSnap(name='s1', cli=t_cli())
     m1.attach_snap(s1)
     m1.update()
     assert_that(m1.attached_snapshot, equal_to('s1'))
Пример #18
0
def name_to_snap(name):
    if is_valid(name):
        ret = VNXSnap(name=name)
    else:
        ret = None
    return ret
Пример #19
0
 def f():
     snap = VNXSnap(cli=t_cli(), name='s5')
     snap.restore(res_id='541')
Пример #20
0
 def create_snap(self, name, allow_rw=None, auto_delete=None):
     return VNXSnap.create(self._cli, self._get_name(), name, allow_rw,
                           auto_delete)
Пример #21
0
 def f():
     snap = VNXSnap(cli=t_cli(), name='s3')
     snap.remove()
Пример #22
0
 def attach_snap(self, snap):
     snap_name = VNXSnap.get_name(snap)
     out = self._cli.attach_snap(snap_name, lun_id=self.get_id(self),
                                 poll=self.poll)
     ex.raise_if_err(out, 'failed to attach snap {}'.format(snap_name),
                     default=ex.VNXAttachSnapError)
Пример #23
0
 def remove_snap(self, name):
     self._remove_resource(VNXSnap(name, self._cli))
Пример #24
0
 def get_snap(self, name=None):
     if name is not None:
         ret = VNXSnap.get(self._cli, name)
     else:
         ret = VNXSnapList(self._cli, res=self.get_id(self))
     return ret
Пример #25
0
 def restore_snap(self, name):
     VNXSnap(name, self._cli).restore(self.get_id(self))
Пример #26
0
 def delete_snap(self, name):
     self._delete_resource(VNXSnap(name, self._cli))
Пример #27
0
 def test_get_all(self):
     snaps = VNXSnap.get(t_cli())
     assert_that(len(snaps), equal_to(47))
Пример #28
0
 def create_snap(self, name, allow_rw=None, auto_delete=None):
     return VNXSnap.create(self._cli, self._get_name(), name, allow_rw,
                           auto_delete)
Пример #29
0
 def test_get_not_found(self):
     snap = VNXSnap.get(t_cli(), name='xxx')
     assert_that(snap.existed, equal_to(False))
Пример #30
0
 def test_get_all(self):
     snaps = VNXSnap.get(t_cli())
     assert_that(len(snaps), equal_to(47))
Пример #31
0
 def test_modify_snap(self):
     snap = VNXSnap(cli=t_cli(), name='s1')
     snap.modify(new_name='s2', allow_rw=True)
     assert_that(snap._name, equal_to('s2'))
Пример #32
0
 def test_get_by_name(self):
     snap = VNXSnap.get(t_cli(), name='gan_snap')
     assert_that(snap.creation_time, equal_to('05/24/13 20:06:12'))
Пример #33
0
 def f():
     snap = VNXSnap(cli=t_cli(), name='s4')
     snap.delete()
Пример #34
0
 def test_get_not_found(self):
     snap = VNXSnap.get(t_cli(), name='xxx')
     assert_that(snap.existed, equal_to(False))
Пример #35
0
 def f():
     src = VNXSnap.get(t_cli(), name='123')
     src.copy('456')
Пример #36
0
 def test_modify_snap(self):
     snap = VNXSnap(cli=t_cli(), name='s1')
     snap.modify(new_name='s2', rw=True)
     assert_that(snap._name, equal_to('s2'))
Пример #37
0
 def delete_snap(self, name):
     VNXSnap(name, self._cli).delete()
Пример #38
0
 def test_restore_snap(self):
     snap = VNXSnap(cli=t_cli(), name='s5')
     snap.restore(res_id='540')