Skip to content

Commit

Permalink
Merge branch 'master' into lianq_0630
Browse files Browse the repository at this point in the history
  • Loading branch information
lianqiang-git committed Jul 23, 2021
2 parents b96af03 + c594f64 commit 121f5f7
Show file tree
Hide file tree
Showing 25 changed files with 723 additions and 362 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.huawei.dmestore.utils.StringUtil;
import com.vmware.vim.binding.vmodl.list;
import com.vmware.vim.binding.vmodl.map;

Expand Down Expand Up @@ -631,7 +632,18 @@ public Map<String, Object> createHostGroup(Map<String, Object> params) throws Dm
hostgroupmap.put(NAME_FIELD, ToolUtils.jsonToStr(jsonObject.get(NAME_FIELD)));
}
}else {
throw new DmeException("create hostgroup error,the DME return"+responseEntity);
String desc = "";
try {
JsonObject vjson = new JsonParser().parse(responseEntity.getBody().toString()).getAsJsonObject();
desc = StringUtil.dealQuotationMarks(ToolUtils.getStr(vjson.get("error_msg")));
}catch (Exception ess){
desc = "";
}
if (!StringUtils.isEmpty(desc)) {
throw new DmeException("create hostgroup error,the DME return " + responseEntity.getStatusCode() + "," + desc);
}else {
throw new DmeException("create hostgroup error,the DME return " + responseEntity.getStatusCode());
}
}
}
} catch (DmeException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,8 @@ private void parseStoragePoolDetail(String storageId, StorageDetail storageObj,
compressedCapacity += storagePool.getCompressedCapacity();
}
if (isDorado) {
storageObj.setFreeEffectiveCapacity(
totalPoolCapicity - blockFileCapacity- protectionCapacity);
// storageObj.setFreeEffectiveCapacity(
// totalPoolCapicity - blockFileCapacity- protectionCapacity);
storageObj.setUsableCapacity(totalPoolCapicity);
} else {
// (圈内)总容量
Expand Down Expand Up @@ -431,6 +431,7 @@ public List<StoragePool> getStoragePools(String storageId, String mediaType) thr
}
try {
ResponseEntity<String> responseEntity = dmeAccessService.accessByJson(url, HttpMethod.GET, params);
LOG.info(gson.toJson(responseEntity));
int code = responseEntity.getStatusCodeValue();
if (code != HttpStatus.OK.value()) {
throw new DmeException(CODE_503, "search oriented storage pool error");
Expand Down Expand Up @@ -1377,20 +1378,30 @@ private String getDataStoreOnVolume(String volumeId) throws DmeSqlException {

private String getDiskType(JsonObject poolObject) throws DmeException {
String diskType = "";
if (!StringUtils.isEmpty(poolObject.get("tier0DiskType")) && !"0".equalsIgnoreCase(ToolUtils.jsonToStr(poolObject.get("tier0DiskType")))){
diskType = DmeConstants.TIER_DISK_TYPE.get(ToolUtils.jsonToStr(poolObject.get("tier0DiskType")));
if (!StringUtils.isEmpty(ToolUtils.jsonToStr(poolObject.get("tier0DiskType"))) && !"0".equalsIgnoreCase(ToolUtils.jsonToStr(poolObject.get("tier0DiskType")))){
if (!StringUtils.isEmpty(DmeConstants.TIER_DISK_TYPE.get(ToolUtils.jsonToStr(poolObject.get("tier0DiskType"))))) {
diskType = DmeConstants.TIER_DISK_TYPE.get(ToolUtils.jsonToStr(poolObject.get("tier0DiskType")));
}
}
if (!StringUtils.isEmpty(poolObject.get("tier1DiskType")) && !"0".equalsIgnoreCase(ToolUtils.jsonToStr(poolObject.get("tier1DiskType")))){
diskType = diskType + "/" + DmeConstants.TIER_DISK_TYPE.get(ToolUtils.jsonToStr(poolObject.get("tier1DiskType")));
if (!StringUtils.isEmpty(ToolUtils.jsonToStr(poolObject.get("tier1DiskType"))) && !"0".equalsIgnoreCase(ToolUtils.jsonToStr(poolObject.get("tier1DiskType")))){
if (!StringUtils.isEmpty(DmeConstants.TIER_DISK_TYPE.get(ToolUtils.jsonToStr(poolObject.get("tier1DiskType"))))) {
diskType = diskType + "/" + DmeConstants.TIER_DISK_TYPE.get(ToolUtils.jsonToStr(poolObject.get("tier1DiskType")));
}
}
if (!StringUtils.isEmpty(poolObject.get("tier2DiskType")) && !"0".equalsIgnoreCase(ToolUtils.jsonToStr(poolObject.get("tier2DiskType")))){
diskType = diskType + "/" +DmeConstants.TIER_DISK_TYPE.get(ToolUtils.jsonToStr(poolObject.get("tier2DiskType")));
if (!StringUtils.isEmpty(ToolUtils.jsonToStr(poolObject.get("tier2DiskType"))) && !"0".equalsIgnoreCase(ToolUtils.jsonToStr(poolObject.get("tier2DiskType")))){
if (!StringUtils.isEmpty(DmeConstants.TIER_DISK_TYPE.get(ToolUtils.jsonToStr(poolObject.get("tier2DiskType"))))) {
diskType = diskType + "/" + DmeConstants.TIER_DISK_TYPE.get(ToolUtils.jsonToStr(poolObject.get("tier2DiskType")));
}
}
if (!StringUtils.isEmpty(poolObject.get("tier3DiskType")) && !"0".equalsIgnoreCase(ToolUtils.jsonToStr(poolObject.get("tier3DiskType")))){
diskType = diskType + "/" + DmeConstants.TIER_DISK_TYPE.get(ToolUtils.jsonToStr(poolObject.get("tier3DiskType")));
if (!StringUtils.isEmpty(ToolUtils.jsonToStr(poolObject.get("tier3DiskType"))) && !"0".equalsIgnoreCase(ToolUtils.jsonToStr(poolObject.get("tier3DiskType")))){
if (!StringUtils.isEmpty(DmeConstants.TIER_DISK_TYPE.get(ToolUtils.jsonToStr(poolObject.get("tier3DiskType"))))) {
diskType = diskType + "/" + DmeConstants.TIER_DISK_TYPE.get(ToolUtils.jsonToStr(poolObject.get("tier3DiskType")));
}
}
if (!StringUtils.isEmpty(poolObject.get("tier4DiskType")) && !"0".equalsIgnoreCase(ToolUtils.jsonToStr(poolObject.get("tier4DiskType")))){
diskType = diskType + "/" +DmeConstants.TIER_DISK_TYPE.get(ToolUtils.jsonToStr(poolObject.get("tier4DiskType")));
if (!StringUtils.isEmpty(ToolUtils.jsonToStr(poolObject.get("tier4DiskType"))) && !"0".equalsIgnoreCase(ToolUtils.jsonToStr(poolObject.get("tier4DiskType")))){
if (!StringUtils.isEmpty(DmeConstants.TIER_DISK_TYPE.get(ToolUtils.jsonToStr(poolObject.get("tier4DiskType"))))) {
diskType = diskType + "/" + DmeConstants.TIER_DISK_TYPE.get(ToolUtils.jsonToStr(poolObject.get("tier4DiskType")));
}
}
if (diskType.startsWith("/")){
diskType = diskType.substring(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ public JsonObject getDatasetsStatisticsQueryBody(String serviceLevelId, String i
JsonObject timeRange = new JsonObject();
timeRange.addProperty("beginTime", timeMap.get("beginTime"));
timeRange.addProperty("endTime", timeMap.get("endTime"));
timeRange.addProperty("granularity", "30m");
timeRange.addProperty("granularity", "30min");
if ("stat-lun".equals(dataSetType) || "stat-storage-pool".equals(dataSetType)) {
} else if ("perf-lun".equals(dataSetType) || "perf-stat-storage-pool-details".equals(
dataSetType)) {
Expand Down Expand Up @@ -906,7 +906,7 @@ private String parseDataSetResult(String result){
JsonObject i = iterator.next().getAsJsonObject();
DmeDatasetBean dmeDatasetBean = new DmeDatasetBean();
dmeDatasetBean.setTimestamp(i.get("key").getAsLong());
JsonObject per = i.getAsJsonObject("tier-pool-sum-totalCapacity-perform").getAsJsonObject("buckets");
JsonObject per = i.getAsJsonObject("tier-pool-sum-totalCapacity-perform").getAsJsonArray("buckets").get(0).getAsJsonObject();
dmeDatasetBean.setTotalCapacity(per.getAsJsonObject("sum-totalCapacity").get("value").getAsFloat());
dmeDatasetBean.setUsedCapacity(per.getAsJsonObject("sum-usedCapacity").get("value").getAsFloat());
dmeDatasetBean.setThroughput(per.getAsJsonObject("sum-throughput").get("value").getAsFloat());
Expand Down
Loading

0 comments on commit 121f5f7

Please sign in to comment.