예제 #1
0
    def expand_lun(self, name, new_size, poll=True):

        lun = self.get_lun(name=name)

        try:
            lun.poll = poll
            lun.expand(new_size, ignore_thresholds=True)
        except storops_ex.VNXLunExpandSizeError as ex:
            LOG.warning(
                _LW("LUN %(name)s is already expanded. "
                    "Message: %(msg)s."), {
                        'name': name,
                        'msg': ex.message
                    })

        except storops_ex.VNXLunPreparingError as ex:
            # The error means the operation cannot be performed because the LUN
            # is 'Preparing'. Wait for a while so that the LUN may get out of
            # the transitioning state.
            with excutils.save_and_reraise_exception():
                LOG.warning(
                    _LW("LUN %(name)s is not ready for extension: "
                        "%(msg)s"), {
                            'name': name,
                            'msg': ex.message
                        })

                utils.wait_until(Condition.is_lun_ops_ready, lun=lun)

        utils.wait_until(Condition.is_lun_expanded, lun=lun, new_size=new_size)
예제 #2
0
 def add_image(self, mirror_name, sp_ip, secondary_lun_id):
     mv = self.vnx.get_mirror_view(mirror_name)
     mv.add_image(sp_ip, secondary_lun_id)
     # Secondary image info usually did not appear, so
     # here add a poll to update.
     utils.update_res_with_poll(mv)
     utils.wait_until(Condition.is_mirror_synced, mirror=mv)
예제 #3
0
파일: client.py 프로젝트: C2python/cinder
 def add_image(self, mirror_name, sp_ip, secondary_lun_id):
     mv = self.vnx.get_mirror_view(mirror_name)
     mv.add_image(sp_ip, secondary_lun_id)
     # Secondary image info usually did not appear, so
     # here add a poll to update.
     utils.update_res_with_poll(mv)
     utils.wait_until(Condition.is_mirror_synced, mirror=mv)
예제 #4
0
파일: client.py 프로젝트: sebrandon1/cinder
 def create_cg_snapshot(self, cg_snap_name, cg_name):
     cg = self.vnx.get_cg(cg_name)
     try:
         snap = cg.create_snap(cg_snap_name, allow_rw=True)
     except storops_ex.VNXSnapNameInUseError:
         snap = self.vnx.get_snap(cg_snap_name)
     utils.wait_until(Condition.is_object_existed, vnx_obj=snap)
     return snap
예제 #5
0
파일: test_utils.py 프로젝트: NetApp/cinder
 def test_wait_until_with_params(self):
     mock_testmethod = mock.Mock(return_value=True)
     utils.wait_until(mock_testmethod,
                      param1=1,
                      param2='test')
     mock_testmethod.assert_has_calls(
         [mock.call(param1=1, param2='test')])
     mock_testmethod.assert_has_calls([mock.call(param1=1, param2='test')])
예제 #6
0
 def create_cg_snapshot(self, cg_snap_name, cg_name):
     cg = self.vnx.get_cg(cg_name)
     try:
         snap = cg.create_snap(cg_snap_name, allow_rw=True)
     except storops_ex.VNXSnapNameInUseError:
         snap = self.vnx.get_snap(cg_snap_name)
     utils.wait_until(Condition.is_object_existed, vnx_obj=snap)
     return snap
예제 #7
0
 def create_consistency_group(self, cg_name, lun_id_list=None):
     try:
         cg = self.vnx.create_cg(name=cg_name, members=lun_id_list)
     except storops_ex.VNXConsistencyGroupNameInUseError:
         cg = self.vnx.get_cg(name=cg_name)
     # Wait until cg is found on VNX, or deletion will fail afterwards
     utils.wait_until(Condition.is_object_existed, vnx_obj=cg)
     return cg
예제 #8
0
파일: client.py 프로젝트: C2python/cinder
 def create_consistency_group(self, cg_name, lun_id_list=None):
     try:
         cg = self.vnx.create_cg(name=cg_name, members=lun_id_list)
     except storops_ex.VNXConsistencyGroupNameInUseError:
         cg = self.vnx.get_cg(name=cg_name)
     # Wait until cg is found on VNX, or deletion will fail afterwards
     utils.wait_until(Condition.is_object_existed, vnx_obj=cg)
     return cg
예제 #9
0
 def test_wait_until_with_params(self):
     mock_testmethod = mock.Mock(side_effect=[False, True])
     mock_testmethod.__name__ = 'test_method'
     utils.wait_until(mock_testmethod,
                      param1=1,
                      param2='test')
     mock_testmethod.assert_has_calls(
         [mock.call(param1=1, param2='test'),
          mock.call(param1=1, param2='test')])
예제 #10
0
파일: client.py 프로젝트: sebrandon1/cinder
    def create_lun(self, pool, name, size, provision, tier, cg_id=None, ignore_thresholds=False):
        pool = self.vnx.get_pool(name=pool)
        try:
            lun = pool.create_lun(
                lun_name=name, size_gb=size, provision=provision, tier=tier, ignore_thresholds=ignore_thresholds
            )
        except storops_ex.VNXLunNameInUseError:
            lun = self.vnx.get_lun(name=name)

        utils.wait_until(condition=Condition.is_lun_io_ready, lun=lun)
        if cg_id:
            cg = self.vnx.get_cg(name=cg_id)
            cg.add_member(lun)
        return lun
예제 #11
0
파일: client.py 프로젝트: sebrandon1/cinder
    def verify_migration(self, src_id, dst_id, dst_wwn):
        """Verify whether migration session finished successfully.

        :param src_id:  source LUN id
        :param dst_id:  destination LUN id
        :param dst_wwn: destination LUN WWN
        :returns Boolean: True or False
        """
        src_lun = self.vnx.get_lun(lun_id=src_id)

        utils.wait_until(condition=self.session_finished, interval=common.INTERVAL_30_SEC, src_lun=src_lun)
        new_lun = self.vnx.get_lun(lun_id=dst_id)
        new_wwn = new_lun.wwn
        if not new_wwn or new_wwn != dst_wwn:
            return True
        else:
            return False
예제 #12
0
    def create_lun(self, pool, name, size, provision,
                   tier, cg_id=None, ignore_thresholds=False):
        pool = self.vnx.get_pool(name=pool)
        try:
            lun = pool.create_lun(lun_name=name,
                                  size_gb=size,
                                  provision=provision,
                                  tier=tier,
                                  ignore_thresholds=ignore_thresholds)
        except storops_ex.VNXLunNameInUseError:
            lun = self.vnx.get_lun(name=name)

        utils.wait_until(condition=Condition.is_lun_io_ready, lun=lun)
        if cg_id:
            cg = self.vnx.get_cg(name=cg_id)
            cg.add_member(lun)
        return lun
예제 #13
0
    def verify_migration(self, src_id, dst_id, dst_wwn):
        """Verify whether migration session finished successfully.

        :param src_id:  source LUN id
        :param dst_id:  destination LUN id
        :param dst_wwn: destination LUN WWN
        :returns Boolean: True or False
        """
        src_lun = self.vnx.get_lun(lun_id=src_id)

        utils.wait_until(condition=self.session_finished,
                         interval=common.INTERVAL_30_SEC,
                         src_lun=src_lun)
        new_lun = self.vnx.get_lun(lun_id=dst_id)
        new_wwn = new_lun.wwn
        if not new_wwn or new_wwn != dst_wwn:
            return True
        else:
            return False
예제 #14
0
파일: client.py 프로젝트: C2python/cinder
    def expand_lun(self, name, new_size, poll=True):

        lun = self.get_lun(name=name)

        try:
            lun.poll = poll
            lun.expand(new_size, ignore_thresholds=True)
        except storops_ex.VNXLunExpandSizeError as ex:
            LOG.warning(_LW("LUN %(name)s is already expanded. "
                            "Message: %(msg)s."),
                        {'name': name, 'msg': ex.message})

        except storops_ex.VNXLunPreparingError as ex:
            # The error means the operation cannot be performed because the LUN
            # is 'Preparing'. Wait for a while so that the LUN may get out of
            # the transitioning state.
            with excutils.save_and_reraise_exception():
                LOG.warning(_LW("LUN %(name)s is not ready for extension: "
                                "%(msg)s"),
                            {'name': name, 'msg': ex.message})

                utils.wait_until(Condition.is_lun_ops_ready, lun=lun)

        utils.wait_until(Condition.is_lun_expanded, lun=lun, new_size=new_size)
예제 #15
0
 def test_wait_until(self):
     mock_testmethod = mock.Mock(side_effect=[False, True])
     utils.wait_until(mock_testmethod)
     mock_testmethod.assert_has_calls([mock.call(), mock.call()])
예제 #16
0
 def sync_image(self, mirror_name):
     mv = self.vnx.get_mirror_view(mirror_name)
     mv.sync_image()
     utils.wait_until(Condition.is_mirror_synced, mirror=mv)
예제 #17
0
 def test_wait_until(self):
     mock_testmethod = mock.Mock(return_value=True)
     utils.wait_until(mock_testmethod, interval=0)
     mock_testmethod.assert_has_calls([mock.call()])
예제 #18
0
 def test_wait_until_with_params(self):
     mock_testmethod = mock.Mock(return_value=True)
     utils.wait_until(mock_testmethod, param1=1, param2='test')
     mock_testmethod.assert_has_calls([mock.call(param1=1, param2='test')])
     mock_testmethod.assert_has_calls([mock.call(param1=1, param2='test')])
예제 #19
0
파일: test_utils.py 프로젝트: NetApp/cinder
 def test_wait_until(self):
     mock_testmethod = mock.Mock(return_value=True)
     utils.wait_until(mock_testmethod, interval=0)
     mock_testmethod.assert_has_calls([mock.call()])
예제 #20
0
파일: client.py 프로젝트: C2python/cinder
 def sync_image(self, mirror_name):
     mv = self.vnx.get_mirror_view(mirror_name)
     mv.sync_image()
     utils.wait_until(Condition.is_mirror_synced, mirror=mv)