def delete_service_volume_by_id(self,
                                    tenant,
                                    service,
                                    volume_id,
                                    user_name=''):
        volume = volume_repo.get_service_volume_by_pk(volume_id)
        if not volume:
            return 404, "需要删除的路径不存在", None
        # if volume.volume_type == volume.SHARE:
        # 判断当前共享目录是否被使用
        mnt = mnt_repo.get_mnt_by_dep_id_and_mntname(service.service_id,
                                                     volume.volume_name)
        if mnt:
            return 403, "当前路径被共享,无法删除", None
        if service.create_status == "complete":
            data = dict()
            data["operator"] = user_name
            try:
                res, body = region_api.delete_service_volumes(
                    service.service_region, tenant.tenant_name,
                    service.service_alias, volume.volume_name,
                    tenant.enterprise_id, data)
                logger.debug(
                    "service {0} delete volume {1}, result {2}".format(
                        service.service_cname, volume.volume_name, body))
            except region_api.CallApiError as e:
                if e.status != 404:
                    raise ServiceHandleException(
                        msg="delete volume from region failure",
                        msg_show="从集群删除存储发生错误",
                        status_code=500)
        volume_repo.delete_volume_by_id(volume_id)
        volume_repo.delete_file_by_volume(volume)

        return 200, "success", volume
    def delete_service_volume_by_id(self, tenant, service, volume_id):
        volume = volume_repo.get_service_volume_by_pk(volume_id)
        if not volume:
            return 404, u"需要删除的路径不存在", None
        if volume.volume_type == volume.SHARE:
            # 判断当前共享目录是否被使用
            mnt = mnt_repo.get_mnt_by_dep_id_and_mntname(service.service_id, volume.volume_name)
            if mnt:
                return 403, u"当前持久化路径被共享,无法删除", None
        if service.create_status == "complete":
            res, body = region_api.delete_service_volumes(
                service.service_region, tenant.tenant_name, service.service_alias, volume.volume_name,
                tenant.enterprise_id
            )
            logger.debug(
                "service {0} delete volume {1}, result {2}".format(service.service_cname, volume.volume_name, body))

        volume_repo.delete_volume_by_id(volume_id)
        return 200, u"success", volume