diff --git a/dsms-engine-application/src/main/java/com/dsms/modules/storagepool/task/CreateStoragePoolTask.java b/dsms-engine-application/src/main/java/com/dsms/modules/storagepool/task/CreateStoragePoolTask.java index ac64890606eb44c23315f36d857cb3673433d9b0..c6c040cee739ecae5958f4cb5db556a93e78178c 100644 --- a/dsms-engine-application/src/main/java/com/dsms/modules/storagepool/task/CreateStoragePoolTask.java +++ b/dsms-engine-application/src/main/java/com/dsms/modules/storagepool/task/CreateStoragePoolTask.java @@ -16,6 +16,7 @@ package com.dsms.modules.storagepool.task; +import cn.hutool.core.text.CharSequenceUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONUtil; import com.alibaba.fastjson2.JSON; @@ -23,6 +24,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.ceph.rados.IoCTX; import com.ceph.rados.Rados; import com.dsms.common.constant.*; +import com.dsms.common.exception.DsmsEngineException; import com.dsms.common.remotecall.model.FailedDetail; import com.dsms.common.remotecall.model.FinishedDetail; import com.dsms.common.remotecall.model.RemoteResponse; @@ -162,7 +164,7 @@ public class CreateStoragePoolTask implements TaskStrategy { RemoteResponse createResponse = storagePoolApi.createPool(RemoteCallUtil.generateRemoteRequest(), storagePoolCreateDTO); boolean flag = true;//use to check whether the task in cluster is complete while (flag) { - step = getStepResponse(step, createResponse, String.format(CreateStoragePoolRequest.Create_POOL_SUCCESS, storagePoolCreateDTO.getPoolName()), "create pool fail"); + getStepResponse(step, createResponse, String.format(CreateStoragePoolRequest.Create_POOL_SUCCESS, storagePoolCreateDTO.getPoolName()), "create pool fail"); if (Objects.equals(step.getStepStatus(), TaskStatusEnum.FINISH.getStatus()) || Objects.equals(step.getStepStatus(), TaskStatusEnum.FAIL.getStatus())) { flag = false; } @@ -180,7 +182,7 @@ public class CreateStoragePoolTask implements TaskStrategy { RemoteResponse createResponse = ecProfileApi.createEcProfile(RemoteCallUtil.generateRemoteRequest(), ecProfileDto); boolean flag = true;//use to check whether the task in cluster is complete while (flag) { - step = getStepResponse(step, createResponse, "", "create ec-profile fail"); + getStepResponse(step, createResponse, "", "create ec-profile fail"); if (Objects.equals(step.getStepStatus(), TaskStatusEnum.FINISH.getStatus()) || Objects.equals(step.getStepStatus(), TaskStatusEnum.FAIL.getStatus())) { flag = false; } @@ -199,7 +201,7 @@ public class CreateStoragePoolTask implements TaskStrategy { RemoteResponse createResponse = crushmapApi.createRule(RemoteCallUtil.generateRemoteRequest(), ruleName); boolean flag = true;//use to check whether the task in cluster is complete while (flag) { - step = getStepResponse(step, createResponse, "", "create rule fail"); + getStepResponse(step, createResponse, "", "create rule fail"); if (Objects.equals(step.getStepStatus(), TaskStatusEnum.FINISH.getStatus()) || Objects.equals(step.getStepStatus(), TaskStatusEnum.FAIL.getStatus())) { flag = false; } @@ -217,7 +219,7 @@ public class CreateStoragePoolTask implements TaskStrategy { RemoteResponse createResponse = crushmapApi.createBucket(RemoteCallUtil.generateRemoteRequest(), bucketName, CrushFailureDomainEnum.ROOT.getTypeId(), ""); boolean flag = true;//use to check whether the task in cluster is complete while (flag) { - step = getStepResponse(step, createResponse, String.format(CreateBucketRequest.CREATE_ROOT_BUCKET_SUCCESS, bucketName), "create root bucket result fail"); + getStepResponse(step, createResponse, String.format(CreateBucketRequest.CREATE_ROOT_BUCKET_SUCCESS, bucketName), "create root bucket result fail"); if (Objects.equals(step.getStepStatus(), TaskStatusEnum.FINISH.getStatus()) || Objects.equals(step.getStepStatus(), TaskStatusEnum.FAIL.getStatus())) { flag = false; } @@ -237,7 +239,7 @@ public class CreateStoragePoolTask implements TaskStrategy { RemoteResponse allowResponse = storagePoolApi.allowEcOverWrites(RemoteCallUtil.generateRemoteRequest(), erasurePoolName); boolean flag = true;//use to check whether the task in cluster is complete while (flag) { - step = getStepResponse(step, allowResponse, String.format(AllowEcOverWrites.ALLOW_EC_OVER_WRITES_SUCCESS, poolId), "allow ec over writes fail"); + getStepResponse(step, allowResponse, String.format(AllowEcOverWrites.ALLOW_EC_OVER_WRITES_SUCCESS, poolId), "allow ec over writes fail"); if (Objects.equals(step.getStepStatus(), TaskStatusEnum.FINISH.getStatus()) || Objects.equals(step.getStepStatus(), TaskStatusEnum.FAIL.getStatus())) { flag = false; } @@ -307,7 +309,7 @@ public class CreateStoragePoolTask implements TaskStrategy { return task; } //rule exists but delete failed - if (!(Objects.equals(String.format(DelCrushRuleRequest.DOES_NOT_EXISTS, poolName), delRuleOut) || StrUtil.isEmpty(delRuleOut))) { + if (!(Objects.equals(String.format(DelCrushRuleRequest.DOES_NOT_EXISTS, poolName), delRuleOut) || CharSequenceUtil.isEmpty(delRuleOut))) { return task; } @@ -331,7 +333,7 @@ public class CreateStoragePoolTask implements TaskStrategy { return task; } //ec-profile exists but delete failed - if (!(Objects.equals(String.format(DeleteEcProfileRequest.DOES_NOT_EXIST, poolName), deleteEcProfileOut) || StrUtil.isEmpty(delRuleOut))) { + if (!(Objects.equals(String.format(DeleteEcProfileRequest.DOES_NOT_EXIST, poolName), deleteEcProfileOut) || CharSequenceUtil.isEmpty(delRuleOut))) { return task; } }