Search in sources :

Example 41 with StorageArray

use of com.emc.storageos.hds.model.StorageArray in project coprhd-controller by CoprHD.

the class HDSStorageDevice method validateStorageProviderConnection.

@Override
public boolean validateStorageProviderConnection(String ipAddress, Integer portNumber) {
    boolean isConnectionValid = false;
    try {
        StringBuffer providerID = new StringBuffer(ipAddress).append(HDSConstants.HYPHEN_OPERATOR).append(portNumber);
        URIQueryResultList providerUriList = new URIQueryResultList();
        dbClient.queryByConstraint(AlternateIdConstraint.Factory.getStorageProviderByProviderIDConstraint(providerID.toString()), providerUriList);
        if (providerUriList.iterator().hasNext()) {
            StorageProvider provider = dbClient.queryObject(StorageProvider.class, providerUriList.iterator().next());
            HDSApiClient hdsApiClient = hdsApiFactory.getClient(HDSUtils.getHDSServerManagementServerInfo(provider), provider.getUserName(), provider.getPassword());
            List<StorageArray> storageArrayList = hdsApiClient.getStorageSystemsInfo();
            if (null != storageArrayList && !storageArrayList.isEmpty()) {
                isConnectionValid = true;
            }
        }
    } catch (Exception ex) {
        log.error("Problem in checking provider live connection for ipaddress: {} due to", ipAddress, ex);
    }
    return isConnectionValid;
}
Also used : HDSApiClient(com.emc.storageos.hds.api.HDSApiClient) StorageProvider(com.emc.storageos.db.client.model.StorageProvider) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) HDSException(com.emc.storageos.hds.HDSException) StorageArray(com.emc.storageos.hds.model.StorageArray)

Aggregations

StorageArray (com.emc.storageos.hds.model.StorageArray)41 HashMap (java.util.HashMap)37 ClientResponse (com.sun.jersey.api.client.ClientResponse)25 InputStream (java.io.InputStream)25 URI (java.net.URI)25 JavaResult (org.milyn.payload.JavaResult)25 IOException (java.io.IOException)19 Add (com.emc.storageos.hds.model.Add)13 Get (com.emc.storageos.hds.model.Get)12 LogicalUnit (com.emc.storageos.hds.model.LogicalUnit)12 HostStorageDomain (com.emc.storageos.hds.model.HostStorageDomain)10 Delete (com.emc.storageos.hds.model.Delete)9 EchoCommand (com.emc.storageos.hds.model.EchoCommand)9 Error (com.emc.storageos.hds.model.Error)9 ArrayList (java.util.ArrayList)7 Pool (com.emc.storageos.hds.model.Pool)5 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)3 HDSException (com.emc.storageos.hds.HDSException)3 HDSApiClient (com.emc.storageos.hds.api.HDSApiClient)3 Modify (com.emc.storageos.hds.model.Modify)3