处理大屏展示资源使用情况问题

develop
bayuzhen 2024-05-30 17:13:34 +08:00
parent 0c472d7357
commit 7df7518982
3 changed files with 10 additions and 9 deletions

View File

@ -13,6 +13,6 @@ public enum CloudProviderType {
OPENSTACK, VMWARE, ALIYUN, JDCLOUD, UNKNOWN, SCP, H3C, HMC, FUSIONCLOUD, TENCENT, F5, HUAWEI, XEN, POWERVC,
CLOUDOS, AZURE, KINGCLOUD, KUBERNETES, AWS, QCLOUD, TCE, PQCLOUD, MANAGEONE,
JUMPSERVER, HORIZON, TIANYI, HILLSTONE, CISCO, AGILE, NSX, CAMPUS, HCSO, VEEAM, SMARTX, VOLCENGINE,
FUSIONSPHERE,EASYSTACK;
FUSIONSPHERE, EASYSTACK, CLOUDTOWER;
}

View File

@ -74,6 +74,7 @@ public enum VendorType {
HCSO("HCSO"),
FUSIONSPHERE("FUSIONSPHERE"),
EASYSTACK("EASYSTACK"),
CLOUDTOWER("CLOUDTOWER"),
;
private String name;

View File

@ -135,13 +135,13 @@ public class ResourceScreenServiceImpl implements ResourceScreenService {
excessRatio = Long.valueOf(String.valueOf(authentication.get("excessRatio")));
}
if (null != excessRatio && 0L != excessRatio) {
cpuTotal += config.getCpuCore() * config.getCpuAmount() * excessRatio;
memTotal += config.getMemoryCapacity().longValue() * excessRatio;
cpuTotal += (long) Optional.ofNullable(config.getCpuCore()).orElse(0) * Optional.ofNullable(config.getCpuAmount()).orElse(0) * excessRatio;
memTotal += Optional.ofNullable(config.getMemoryCapacity()).orElse(0.0).longValue() * excessRatio;
} else {
cpuTotal += (long) config.getCpuCore() * Optional.ofNullable(config.getCpuAmount()).orElse(0);
memTotal += config.getMemoryCapacity().longValue();
cpuTotal += (long) Optional.ofNullable(config.getCpuCore()).orElse(0) * Optional.ofNullable(config.getCpuAmount()).orElse(0);
memTotal += Optional.ofNullable(config.getMemoryCapacity()).orElse(0.0).longValue();
}
diskTotal += config.getDiskCapacity().intValue();
diskTotal += Optional.ofNullable(config.getDiskCapacity()).orElse(0.0).intValue();
}
}
List<com.bocloud.ims.entity.resource.Server> opServers =
@ -149,9 +149,9 @@ public class ResourceScreenServiceImpl implements ResourceScreenService {
.collect(Collectors.toList());
for (com.bocloud.ims.entity.resource.Server opServer : opServers) {
com.bocloud.ims.entity.resource.ServerConfig config = opServer.getConfig();
cpuTotal += (long) config.getCpuCore() * Optional.ofNullable(config.getCpuAmount()).orElse(0);
diskTotal += config.getDiskCapacity().intValue();
memTotal += config.getMemoryCapacity().longValue();
cpuTotal += (long) Optional.ofNullable(config.getCpuCore()).orElse(0) * Optional.ofNullable(config.getCpuAmount()).orElse(0);
diskTotal += Optional.ofNullable(config.getDiskCapacity()).orElse(0.0).intValue();
memTotal += Optional.ofNullable(config.getMemoryCapacity()).orElse(0.0).longValue();
}
result.put("cpuTotal", cpuTotal);
result.put("memTotal", memTotal);