use of com.emc.metalnx.services.machine.util.DataGridServerStatusComparator in project metalnx-web by irods-contrib.
the class ServerServiceImpl method getAllServers.
@Override
public List<DataGridServer> getAllServers(List<DataGridResource> resources, HashMap<String, DataGridServer> serverMapInCache) throws DataGridConnectionRefusedException {
logger.info("Getting the list of all servers of the Grid");
List<DataGridServer> servers = resourceService.getAllResourceServers(resources);
initServerThreads(servers);
for (DataGridServer server : servers) {
String serverHostName = server.getHostname();
List<DataGridResource> serverResources = null;
// Getting general status of the server
String serverInfo = getServerInfo(serverHostName);
ObjectMapper mapper = new ObjectMapper();
String machineStatus = null;
String diskInfo = null;
String rmdInfo = null;
try {
JsonNode json = mapper.readTree(serverInfo);
machineStatus = json.get("serverstatus").toString();
diskInfo = json.get("disk").toString();
rmdInfo = json.get("version").toString();
serverResources = serverMapInCache.get(serverHostName).getResources();
} catch (IOException | NullPointerException e) {
logger.error("Could not parse server information: {}", e.getMessage());
}
ServerUtil.populateDataGridServerStatus(machineStatus, server);
ServerUtil.setDataGridServerRMDInfo(rmdInfo, server);
// Retrieving storage info
long totalStorageAvailable = storageService.totalAvailableStorageOfAServer(serverHostName, diskInfo, serverResources);
long totalStorageUsed = storageService.totalUsedStorageOfAServer(serverHostName, diskInfo, serverResources);
long totalStorage = totalStorageAvailable + totalStorageUsed;
server.setTotalStorage(totalStorage);
server.setTotalStorageAvailable(totalStorageAvailable);
server.setTotalStorageUsed(totalStorageUsed);
}
Collections.sort(servers, new DataGridServerStatusComparator());
return servers;
}
use of com.emc.metalnx.services.machine.util.DataGridServerStatusComparator in project metalnx-web by irods-contrib.
the class ServerServiceImpl method getAllIsilonServers.
@Override
public List<DataGridServer> getAllIsilonServers(List<DataGridResource> resources) {
logger.info("Getting the list of all isilon servers of the Grid");
List<DataGridServer> isilonServers = resourceService.getAllIsilonServers(resources);
Collections.sort(isilonServers, new DataGridServerStatusComparator());
return isilonServers == null || isilonServers.isEmpty() ? null : isilonServers;
}
Aggregations