Search in sources :

Example 21 with DataGridServer

use of com.emc.metalnx.core.domain.entity.DataGridServer in project metalnx-web by irods-contrib.

the class TestMSIService method testOtherMSIInstalledFor41.

@Test
public void testOtherMSIInstalledFor41() throws DataGridConnectionRefusedException, DataGridRuleException {
    when(mockRuleService.execGetMSIsRule(anyString())).thenReturn(otherMSIList);
    when(irodsServices.isAtLeastIrods420()).thenReturn(false);
    DataGridServer server = msiService.getMSIsInstalled("server1.test.com");
    assertTrue(server.isThereAnyMSI());
    assertMap(otherMSIList, server.getOtherMSIs());
}
Also used : DataGridServer(com.emc.metalnx.core.domain.entity.DataGridServer) Test(org.junit.Test)

Example 22 with DataGridServer

use of com.emc.metalnx.core.domain.entity.DataGridServer in project metalnx-web by irods-contrib.

the class DashboardController method getSystemHealthStatus.

/**
 * Gets the system health status
 *
 * @return the status (normal, error or warning)
 */
private String getSystemHealthStatus() {
    logger.info("getSystemHealthStatus()");
    String status = "normal";
    for (DataGridServer server : servers) {
        serverMap.put(server.getHostname(), server);
        if (server.getMachineStatus().compareTo("error") == 0) {
            status = "error";
            break;
        } else if (server.getMachineStatus().compareTo("warning") == 0 && status.compareTo("normal") == 0) {
            status = "warning";
        }
    }
    return status;
}
Also used : DataGridServer(com.emc.metalnx.core.domain.entity.DataGridServer)

Example 23 with DataGridServer

use of com.emc.metalnx.core.domain.entity.DataGridServer in project metalnx-web by irods-contrib.

the class DashboardController method isAnyIsilonServerWithBadFormedContextString.

/*
	 * *****************************************************************************
	 * *************** ********************************* PRIVATE METHODS
	 * **************************************
	 * *****************************************************************************
	 * ***************
	 */
/**
 * Checks if there is any isilon server that does not have a well formed context
 * string. If there is, this server is removed from the list of servers and will
 * not be shown in the view's server list.
 *
 * @return True, is there is at least one Isilon server that does not have a
 *         well formed string. False, otherwise.
 */
private boolean isAnyIsilonServerWithBadFormedContextString() {
    if (isilonServers == null) {
        return false;
    }
    boolean isIsilonListWithAnyBadFormedContextString = false;
    Iterator<DataGridServer> isiServersIterator = isilonServers.iterator();
    while (isiServersIterator.hasNext()) {
        DataGridServer dataGridServer = isiServersIterator.next();
        if (dataGridServer.getHostname().isEmpty() || dataGridServer.getIp().isEmpty()) {
            isIsilonListWithAnyBadFormedContextString = true;
            isiServersIterator.remove();
        }
    }
    return isIsilonListWithAnyBadFormedContextString;
}
Also used : DataGridServer(com.emc.metalnx.core.domain.entity.DataGridServer)

Example 24 with DataGridServer

use of com.emc.metalnx.core.domain.entity.DataGridServer in project metalnx-web by irods-contrib.

the class ResourceServiceImpl method getAllResourceServers.

@Override
public List<DataGridServer> getAllResourceServers(List<DataGridResource> resources) throws DataGridConnectionRefusedException {
    logger.info("Getting all resource servers");
    List<DataGridServer> servers = new ArrayList<>();
    boolean isResourceWithEmptyHost = false;
    for (DataGridResource resource : resources) {
        logger.debug("Listing resource information: {}", resource);
        if (resource.getContextString().contains("isi_host")) {
            continue;
        } else if (!resource.getHost().isEmpty()) {
            DataGridServer server = new DataGridServer();
            try {
                server.setHostname(resource.getHost());
                server.setIp(machineInfoService.getAddress(resource.getHost()));
                server.setResources(getResourcesOfAServer(server.getHostname(), resources));
            } catch (UnknownHostException e) {
                logger.error("Could not retrieve IP address for [{}]", resource.getHost());
                isResourceWithEmptyHost = true;
            } catch (DataGridConnectionRefusedException e) {
                logger.error("Could not get all resources of the server: ", resource.getHost());
                server.setResources(null);
            }
            if (!isResourceWithEmptyHost && !servers.contains(server)) {
                servers.add(server);
            }
        }
        isResourceWithEmptyHost = false;
    }
    Collections.sort(servers);
    return servers;
}
Also used : DataGridConnectionRefusedException(com.emc.metalnx.core.domain.exceptions.DataGridConnectionRefusedException) UnknownHostException(java.net.UnknownHostException) ArrayList(java.util.ArrayList) DataGridResource(com.emc.metalnx.core.domain.entity.DataGridResource) DataGridServer(com.emc.metalnx.core.domain.entity.DataGridServer)

Example 25 with DataGridServer

use of com.emc.metalnx.core.domain.entity.DataGridServer in project metalnx-web by irods-contrib.

the class ResourceServiceImpl method getAllIsilonServers.

@Override
public List<DataGridServer> getAllIsilonServers(List<DataGridResource> resources) {
    logger.info("Getting all isilon servers");
    List<DataGridServer> isilonServers = new ArrayList<>();
    for (DataGridResource resource : resources) {
        logger.debug("Listing resource information: {}", resource);
        if (resource.getContextString().contains("isi_host")) {
            DataGridServer isilonServer = new DataGridServer();
            String isilonHostIp = getIsilonProperties(resource.getContextString()).get("isi_host");
            if (isilonHostIp == null) {
                isilonHostIp = new String("");
            }
            isilonServer.setHostname(isilonHostIp);
            isilonServer.setIp(isilonHostIp);
            isilonServer.setType(DataGridServerType.ISILON);
            if (!isilonServers.contains(isilonServer)) {
                isilonServers.add(isilonServer);
            }
        }
    }
    Collections.sort(isilonServers);
    logger.info("Isilon servers done");
    return isilonServers;
}
Also used : ArrayList(java.util.ArrayList) DataGridResource(com.emc.metalnx.core.domain.entity.DataGridResource) DataGridServer(com.emc.metalnx.core.domain.entity.DataGridServer)

Aggregations

DataGridServer (com.emc.metalnx.core.domain.entity.DataGridServer)31 Test (org.junit.Test)12 DataGridResource (com.emc.metalnx.core.domain.entity.DataGridResource)7 ArrayList (java.util.ArrayList)5 Matchers.anyString (org.mockito.Matchers.anyString)4 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)4 DataGridMSIPkgInfo (com.emc.metalnx.core.domain.entity.DataGridMSIPkgInfo)2 DataGridConnectionRefusedException (com.emc.metalnx.core.domain.exceptions.DataGridConnectionRefusedException)2 DataGridServerStatusComparator (com.emc.metalnx.services.machine.util.DataGridServerStatusComparator)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 IOException (java.io.IOException)2 UnknownHostException (java.net.UnknownHostException)2 Before (org.junit.Before)2 ServerInformationRetrievalThread (com.emc.metalnx.services.machine.util.ServerInformationRetrievalThread)1 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1