@@ -851,17 +851,15 @@ public HostCapacityVO call(HostCapacityVO cap) {
851851 long deltaMemory = ratioMgr .calculateMemoryByRatio (hostUuid , memory );
852852 long availMemory = cap .getAvailableMemory () + deltaMemory ;
853853 if (availMemory > cap .getTotalMemory ()) {
854- throw new CloudRuntimeException (
855- String .format ("invalid memory capacity of host[uuid:%s]," +
856- " available memory[%s] is greater than total memory[%s]." +
857- " Available Memory before is [%s], Delta Memory is [%s]." ,
858- hostUuid ,
859- new DecimalFormat (",###" ).format (availMemory ),
860- new DecimalFormat (",###" ).format (cap .getTotalMemory ()),
861- new DecimalFormat (",###" ).format (cap .getAvailableMemory ()),
862- new DecimalFormat (",###" ).format (deltaMemory )
863- )
864- );
854+ logger .warn (String .format ("memory capacity overflow on host[uuid:%s]," +
855+ " available memory[%s] > total memory[%s], clamping to total." +
856+ " Available Memory before is [%s], Delta Memory is [%s]." ,
857+ hostUuid ,
858+ new DecimalFormat (",###" ).format (availMemory ),
859+ new DecimalFormat (",###" ).format (cap .getTotalMemory ()),
860+ new DecimalFormat (",###" ).format (cap .getAvailableMemory ()),
861+ new DecimalFormat (",###" ).format (deltaMemory )));
862+ availMemory = cap .getTotalMemory ();
865863 }
866864
867865 cap .setAvailableMemory (availMemory );
0 commit comments