Search in sources :

Example 1 with XtremIOVolume

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

the class XtremIOExportMaskVolumesValidator method validate.

@Override
public boolean validate() throws Exception {
    log.info("Initiating volume validation of XtremIO ExportMask: " + id);
    try {
        XtremIOClient client = XtremIOProvUtils.getXtremIOClient(getDbClient(), storage, getClientFactory());
        String xioClusterName = client.getClusterDetails(storage.getSerialNumber()).getName();
        Set<String> knownVolumes = new HashSet<>();
        Set<String> igVols = new HashSet<>();
        // get the volumes in the IGs and validate against passed impacted block objects
        for (BlockObject maskVolume : blockObjects) {
            knownVolumes.add(maskVolume.getDeviceLabel());
        }
        List<XtremIOVolume> igVolumes = new ArrayList<>();
        for (String igName : igNames) {
            igVolumes.addAll(XtremIOProvUtils.getInitiatorGroupVolumes(igName, xioClusterName, client));
        }
        for (XtremIOVolume igVolume : igVolumes) {
            igVols.add(igVolume.getVolInfo().get(1));
        }
        log.info("ViPR known volumes present in IG: {}, volumes in IG: {}", knownVolumes, igVols);
        igVols.removeAll(knownVolumes);
        for (String igVol : igVols) {
            getLogger().logDiff(id, "volumes", ValidatorLogger.NO_MATCHING_ENTRY, igVol);
        }
    } catch (Exception ex) {
        log.error("Unexpected exception validating ExportMask volumes: " + ex.getMessage(), ex);
        if (getConfig().isValidationEnabled()) {
            throw DeviceControllerException.exceptions.unexpectedCondition("Unexpected exception validating ExportMask volumes: " + ex.getMessage());
        }
    }
    checkForErrors();
    log.info("Completed volume validation of XtremIO ExportMask: " + id);
    return true;
}
Also used : XtremIOVolume(com.emc.storageos.xtremio.restapi.model.response.XtremIOVolume) XtremIOClient(com.emc.storageos.xtremio.restapi.XtremIOClient) ArrayList(java.util.ArrayList) BlockObject(com.emc.storageos.db.client.model.BlockObject) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) HashSet(java.util.HashSet)

Example 2 with XtremIOVolume

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

the class XtremIOV2Client method getVolumeByIndex.

@Override
public XtremIOVolume getVolumeByIndex(String index, String clusterName) throws Exception {
    String uriString = XtremIOConstants.XTREMIO_V2_VOLUMES_STR.concat(XtremIOConstants.SLASH).concat(index).concat(XtremIOConstants.getInputClusterString(clusterName));
    ClientResponse response = get(URI.create(uriString));
    XtremIOVolumes volumesResponse = getResponseObject(XtremIOVolumes.class, response);
    XtremIOVolume volume = volumesResponse.getContent();
    log.info(volume.toString());
    return volume;
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) XtremIOVolume(com.emc.storageos.xtremio.restapi.model.response.XtremIOVolume) XtremIOVolumes(com.emc.storageos.xtremio.restapi.model.response.XtremIOVolumes)

Example 3 with XtremIOVolume

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

the class XtremIOV2Client method getSnapShotDetails.

@Override
public XtremIOVolume getSnapShotDetails(String snapName, String clusterName) throws Exception {
    String uriStr = XtremIOConstants.XTREMIO_V2_SNAPS_STR.concat(XtremIOConstants.getInputNameForClusterString(snapName, clusterName));
    ClientResponse response = get(URI.create(uriStr));
    XtremIOVolumes volumesResponse = getResponseObject(XtremIOVolumes.class, response);
    XtremIOVolume snap = volumesResponse.getContent();
    log.info(snap.toString());
    return snap;
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) XtremIOVolume(com.emc.storageos.xtremio.restapi.model.response.XtremIOVolume) XtremIOVolumes(com.emc.storageos.xtremio.restapi.model.response.XtremIOVolumes)

Example 4 with XtremIOVolume

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

the class XtremIOV1Client method getSnapShotDetails.

@Override
public XtremIOVolume getSnapShotDetails(String snapName, String clusterName) throws Exception {
    String uriStr = XtremIOConstants.XTREMIO_SNAPS_STR.concat(XtremIOConstants.getInputNameString(snapName));
    ClientResponse response = get(URI.create(uriStr));
    XtremIOVolumes volumesResponse = getResponseObject(XtremIOVolumes.class, response);
    XtremIOVolume snap = volumesResponse.getContent();
    log.info(snap.toString());
    return snap;
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) XtremIOVolume(com.emc.storageos.xtremio.restapi.model.response.XtremIOVolume) XtremIOVolumes(com.emc.storageos.xtremio.restapi.model.response.XtremIOVolumes)

Example 5 with XtremIOVolume

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

the class XtremIOArrayAffinityDiscoverer method filterKnownVolumes.

/**
 * Filter the known volumes in DB, as the preferredPools list in Host needs
 * to have pools of unmanaged volumes alone.
 */
private void filterKnownVolumes(StorageSystem system, DbClient dbClient, XtremIOClient xtremIOClient, String xioClusterName, Set<String> igVolumes) throws Exception {
    Iterator<String> itr = igVolumes.iterator();
    while (itr.hasNext()) {
        String volumeName = itr.next();
        XtremIOVolume xioVolume = xtremIOClient.getVolumeDetails(volumeName, xioClusterName);
        String managedVolumeNativeGuid = NativeGUIDGenerator.generateNativeGuidForVolumeOrBlockSnapShot(system.getNativeGuid(), xioVolume.getVolInfo().get(0));
        Volume dbVolume = DiscoveryUtils.checkStorageVolumeExistsInDB(dbClient, managedVolumeNativeGuid);
        if (dbVolume != null) {
            itr.remove();
        }
    }
}
Also used : XtremIOVolume(com.emc.storageos.xtremio.restapi.model.response.XtremIOVolume) Volume(com.emc.storageos.db.client.model.Volume) XtremIOVolume(com.emc.storageos.xtremio.restapi.model.response.XtremIOVolume)

Aggregations

XtremIOVolume (com.emc.storageos.xtremio.restapi.model.response.XtremIOVolume)27 BlockObject (com.emc.storageos.db.client.model.BlockObject)10 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)10 XtremIOClient (com.emc.storageos.xtremio.restapi.XtremIOClient)10 ClientResponse (com.sun.jersey.api.client.ClientResponse)10 ArrayList (java.util.ArrayList)10 URI (java.net.URI)9 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)8 XtremIOVolumes (com.emc.storageos.xtremio.restapi.model.response.XtremIOVolumes)8 Volume (com.emc.storageos.db.client.model.Volume)6 XtremIOApiException (com.emc.storageos.xtremio.restapi.errorhandling.XtremIOApiException)6 HashSet (java.util.HashSet)6 List (java.util.List)6 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)5 BlockSnapshot (com.emc.storageos.db.client.model.BlockSnapshot)5 HashMap (java.util.HashMap)5 Initiator (com.emc.storageos.db.client.model.Initiator)4 XtremIOConsistencyGroup (com.emc.storageos.xtremio.restapi.model.response.XtremIOConsistencyGroup)4 XtremIOInitiator (com.emc.storageos.xtremio.restapi.model.response.XtremIOInitiator)4 XtremIOObjectInfo (com.emc.storageos.xtremio.restapi.model.response.XtremIOObjectInfo)4