use of com.emc.metalnx.core.domain.entity.DataGridServer in project metalnx-web by irods-contrib.
the class MSIServiceImpl method findServerByHostname.
/**
* Looks for a server instance based on its hostname
*
* @param host
* server's hostname
* @return server instance
*/
private DataGridServer findServerByHostname(String host) throws DataGridConnectionRefusedException {
// update list of servers
getMSIInfoForAllServers();
DataGridServer server = null;
for (DataGridServer s : servers) {
if (host.equals(s.getHostname())) {
server = s;
break;
}
}
return server;
}
use of com.emc.metalnx.core.domain.entity.DataGridServer 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.core.domain.entity.DataGridServer 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;
}
use of com.emc.metalnx.core.domain.entity.DataGridServer in project metalnx-web by irods-contrib.
the class StorageServiceImpl method totalUsedStorageOfGrid.
@Override
public long totalUsedStorageOfGrid(List<DataGridServer> servers) {
logger.info("Get total used storage of the grid");
long totalUsedStorage = 0;
for (DataGridServer dataGridServer : servers) {
totalUsedStorage += dataGridServer.getTotalStorageUsed();
}
return totalUsedStorage;
}
use of com.emc.metalnx.core.domain.entity.DataGridServer in project metalnx-web by irods-contrib.
the class TestPluginService method testMSIListForIRODS41X.
@Test
public void testMSIListForIRODS41X() throws DataGridConnectionRefusedException, DataGridRuleException {
when(mockRuleService.execGetMSIsRule(anyString())).thenReturn(new ArrayList<>());
when(irodsServices.isAtLeastIrods420()).thenReturn(false);
DataGridServer server = msiService.getMSIsInstalled("server1.test.com");
assertFalse(server.isThereAnyMSI());
}
Aggregations