@@ -979,11 +979,12 @@ public ClusterResponse createClusterResponse(Cluster cluster, Boolean showCapaci
979979 clusterResponse .setClusterType (cluster .getClusterType ().toString ());
980980 clusterResponse .setAllocationState (cluster .getAllocationState ().toString ());
981981 clusterResponse .setManagedState (cluster .getManagedState ().toString ());
982- String cpuOvercommitRatio = ApiDBUtils .findClusterDetails (cluster .getId (),"cpuOvercommitRatio" ). getValue ( );
983- String memoryOvercommitRatio = ApiDBUtils .findClusterDetails (cluster .getId (),"memoryOvercommitRatio" ). getValue ( );
982+ String cpuOvercommitRatio = ApiDBUtils .findClusterDetails (cluster .getId (),"cpuOvercommitRatio" );
983+ String memoryOvercommitRatio = ApiDBUtils .findClusterDetails (cluster .getId (),"memoryOvercommitRatio" );
984984 clusterResponse .setCpuOvercommitRatio (cpuOvercommitRatio );
985985 clusterResponse .setMemoryOvercommitRatio (memoryOvercommitRatio );
986986
987+
987988 if (showCapacities != null && showCapacities ) {
988989 List <SummedCapacity > capacities = ApiDBUtils .getCapacityByClusterPodZone (null , null , cluster .getId ());
989990 Set <CapacityResponse > capacityResponses = new HashSet <CapacityResponse >();
@@ -994,9 +995,13 @@ public ClusterResponse createClusterResponse(Cluster cluster, Boolean showCapaci
994995 capacityResponse .setCapacityUsed (capacity .getUsedCapacity ());
995996
996997 if (capacity .getCapacityType () == Capacity .CAPACITY_TYPE_CPU ) {
997- capacityResponse .setCapacityTotal (new Long ((long ) (capacity .getTotalCapacity () * Float .parseFloat (cpuOvercommitRatio ))));
998+ if (cpuOvercommitRatio != null ) {
999+ capacityResponse .setCapacityTotal (new Long ((long ) (capacity .getTotalCapacity () * Float .parseFloat (cpuOvercommitRatio ))));
1000+ }
9981001 } else if (capacity .getCapacityType () == Capacity .CAPACITY_TYPE_MEMORY ) {
999- capacityResponse .setCapacityTotal (new Long ((long ) (capacity .getTotalCapacity () * Float .parseFloat (memoryOvercommitRatio ))));
1002+ if (memoryOvercommitRatio != null ) {
1003+ capacityResponse .setCapacityTotal (new Long ((long ) (capacity .getTotalCapacity () * Float .parseFloat (memoryOvercommitRatio ))));
1004+ }
10001005 } else if (capacity .getCapacityType () == Capacity .CAPACITY_TYPE_STORAGE_ALLOCATED ) {
10011006 List <SummedCapacity > c = ApiDBUtils .findNonSharedStorageForClusterPodZone (null , null , cluster .getId ());
10021007 capacityResponse .setCapacityTotal (capacity .getTotalCapacity () - c .get (0 ).getTotalCapacity ());
0 commit comments