Search in sources :

Example 11 with XtremIOInitiator

use of com.emc.storageos.xtremio.restapi.model.response.XtremIOInitiator in project coprhd-controller by CoprHD.

the class XtremIOV1Client method getXtremIOInitiatorsInfo.

@Override
public List<XtremIOInitiator> getXtremIOInitiatorsInfo(String clusterName) throws Exception {
    ClientResponse response = get(XtremIOConstants.XTREMIO_INITIATORS_URI);
    XtremIOInitiatorsInfo initiatorPortLinks = getResponseObject(XtremIOInitiatorsInfo.class, response);
    log.info("Returned Initiator Links size : {}", initiatorPortLinks.getInitiators().length);
    List<XtremIOInitiator> initiatorPortList = new ArrayList<XtremIOInitiator>();
    for (XtremIOObjectInfo initiatorPortInfo : initiatorPortLinks.getInitiators()) {
        URI initiatorPortUri = URI.create(URIUtil.getFromPath(initiatorPortInfo.getHref()));
        try {
            response = get(initiatorPortUri);
            XtremIOInitiators initiatorPorts = getResponseObject(XtremIOInitiators.class, response);
            log.info("Initiator Port {}", initiatorPorts.getContent().getName() + "-" + initiatorPorts.getContent().getPortAddress());
            initiatorPortList.add(initiatorPorts.getContent());
        } catch (Exception e) {
            if (null != e.getMessage() && !e.getMessage().contains(XtremIOConstants.OBJECT_NOT_FOUND)) {
                throw e;
            } else {
                log.warn("GET initiator - {} failed with obj_not_found. Initiator might be deleted from the system", initiatorPortUri.toString());
            }
        }
    }
    return initiatorPortList;
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) XtremIOInitiators(com.emc.storageos.xtremio.restapi.model.response.XtremIOInitiators) ArrayList(java.util.ArrayList) XtremIOObjectInfo(com.emc.storageos.xtremio.restapi.model.response.XtremIOObjectInfo) XtremIOInitiatorsInfo(com.emc.storageos.xtremio.restapi.model.response.XtremIOInitiatorsInfo) URI(java.net.URI) XtremIOApiException(com.emc.storageos.xtremio.restapi.errorhandling.XtremIOApiException) XtremIOInitiator(com.emc.storageos.xtremio.restapi.model.response.XtremIOInitiator)

Aggregations

XtremIOInitiator (com.emc.storageos.xtremio.restapi.model.response.XtremIOInitiator)11 XtremIOApiException (com.emc.storageos.xtremio.restapi.errorhandling.XtremIOApiException)7 URI (java.net.URI)7 ArrayList (java.util.ArrayList)7 Initiator (com.emc.storageos.db.client.model.Initiator)6 XtremIOClient (com.emc.storageos.xtremio.restapi.XtremIOClient)4 XtremIOInitiators (com.emc.storageos.xtremio.restapi.model.response.XtremIOInitiators)4 ClientResponse (com.sun.jersey.api.client.ClientResponse)4 HashSet (java.util.HashSet)4 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)3 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)3 HashMap (java.util.HashMap)3 List (java.util.List)3 Set (java.util.Set)3 BlockObject (com.emc.storageos.db.client.model.BlockObject)2 XtremIOInitiatorsInfo (com.emc.storageos.xtremio.restapi.model.response.XtremIOInitiatorsInfo)2 XtremIOObjectInfo (com.emc.storageos.xtremio.restapi.model.response.XtremIOObjectInfo)2 XtremIOVolume (com.emc.storageos.xtremio.restapi.model.response.XtremIOVolume)2 BlockSnapshot (com.emc.storageos.db.client.model.BlockSnapshot)1 ExportMask (com.emc.storageos.db.client.model.ExportMask)1