fun compareHardware(hwMap: Map<String?, String>, checkDisk: Boolean): String? { val localMemSizeStr: String = ServerProbe.getInstance().getMemorySize() val localCpuCoreStr: String = ServerProbe.getInstance().getCpuCoreNum() hwMap[PropertyConstants.PROPERTY_KEY_DISK_CAPACITY] if (localMemSizeStr != hwMap[PropertyConstants.PROPERTY_KEY_MEMORY_SIZE]) { log.warn( "Local memory {} is not the same as selected cluster {}", localMemSizeStr, hwMap[PropertyConstants.PROPERTY_KEY_MEMORY_SIZE] ) return String.format( "Local memory {%s} is not the same as selected cluster {%s}", localMemSizeStr, hwMap[PropertyConstants.PROPERTY_KEY_MEMORY_SIZE] ) } if (localCpuCoreStr != hwMap[PropertyConstants.PROPERTY_KEY_CPU_CORE]) { log.warn( "Local CPU core number {} is not the same as selected cluster {}", localCpuCoreStr, hwMap[PropertyConstants.PROPERTY_KEY_CPU_CORE] )return String.format( "Local CPU core number {%s} is not the same as selected cluster {%s}", localCpuCoreStr, hwMap[PropertyConstants.PROPERTY_KEY_CPU_CORE] ) } if (checkDisk && !hasSameDiskInfo( hwMap[PropertyConstants.PROPERTY_KEY_DISK], hwMap[PropertyConstants.PROPERTY_KEY_DISK_CAPACITY] ) ) { log.warn( "Local disk(s) are not the same as selected cluster capacity {}", hwMap[PropertyConstants.PROPERTY_KEY_DISK_CAPACITY] ) return String.format( "Local disk(s) are not the same as selected cluster capacity {%s}", hwMap[PropertyConstants.PROPERTY_KEY_DISK_CAPACITY] ) } return null }
Check local node hardware ( i.e . Memory size , CPU core , Disk Capacity ) are the same as in the input map .