Search in sources :

Example 1 with SetVolumeParam

use of com.emc.fapiclient.ws.SetVolumeParam in project coprhd-controller by CoprHD.

the class RecoverPointUtils method verifyCGVolumesAttachedToSplitter.

/**
 * verify that the volumes in a consistency group are connected to a splitter
 *
 * @param impl - handle for FAPI
 * @param groupUID - consistency group to examine volumes on
 * @throws - RecoverPointException
 */
public static void verifyCGVolumesAttachedToSplitter(FunctionalAPIImpl impl, ConsistencyGroupUID groupUID) throws RecoverPointException {
    ConsistencyGroupSettings groupSettings;
    try {
        groupSettings = impl.getGroupSettings(groupUID);
        // Get the consistency group settings
        for (ReplicationSetSettings replicationSet : groupSettings.getReplicationSetsSettings()) {
            // Run over all replication sets
            for (UserVolumeSettings userVolume : replicationSet.getVolumes()) {
                logger.info("Volume : " + RecoverPointUtils.getGuidBufferAsString(userVolume.getVolumeInfo().getRawUids(), false) + " is of type " + userVolume.getVolumeType());
                if (userVolume.getAttachedSplitters().isEmpty()) {
                    String volumeWWN = RecoverPointUtils.getGuidBufferAsString(userVolume.getVolumeInfo().getRawUids(), false);
                    logger.warn("Volume " + volumeWWN + " is not attached to any splitters");
                    Set<SplitterUID> splittersToAttachTo = getSplittersToAttachToForVolume(impl, userVolume.getClusterUID(), userVolume.getVolumeInfo().getVolumeID());
                    for (SplitterUID splitterUID : splittersToAttachTo) {
                        SetVolumeParam volumeParam = new SetVolumeParam();
                        volumeParam.setShouldAttachAsClean(false);
                        volumeParam.setVolumeID(userVolume.getVolumeInfo().getVolumeID());
                        logger.info("Attaching volume " + volumeWWN + " to splitter" + impl.getSplitterName(splitterUID));
                        impl.attachVolumeToSplitter(splitterUID, volumeParam);
                    }
                } else {
                    for (SplitterUID splitterUID : userVolume.getAttachedSplitters()) {
                        logger.info("Volume " + RecoverPointUtils.getGuidBufferAsString(userVolume.getVolumeInfo().getRawUids(), false) + " is attached to splitter " + impl.getSplitterName(splitterUID));
                    }
                }
            }
        }
    } catch (FunctionalAPIActionFailedException_Exception e) {
        logger.error(e.getMessage(), e);
        throw RecoverPointException.exceptions.exceptionGettingSettingsCG(e);
    } catch (FunctionalAPIInternalError_Exception e) {
        logger.error(e.getMessage(), e);
        throw RecoverPointException.exceptions.exceptionGettingSettingsCG(e);
    }
}
Also used : SplitterUID(com.emc.fapiclient.ws.SplitterUID) SetVolumeParam(com.emc.fapiclient.ws.SetVolumeParam) UserVolumeSettings(com.emc.fapiclient.ws.UserVolumeSettings) FunctionalAPIInternalError_Exception(com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception) FunctionalAPIActionFailedException_Exception(com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception) ReplicationSetSettings(com.emc.fapiclient.ws.ReplicationSetSettings) ConsistencyGroupSettings(com.emc.fapiclient.ws.ConsistencyGroupSettings)

Aggregations

ConsistencyGroupSettings (com.emc.fapiclient.ws.ConsistencyGroupSettings)1 FunctionalAPIActionFailedException_Exception (com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception)1 FunctionalAPIInternalError_Exception (com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception)1 ReplicationSetSettings (com.emc.fapiclient.ws.ReplicationSetSettings)1 SetVolumeParam (com.emc.fapiclient.ws.SetVolumeParam)1 SplitterUID (com.emc.fapiclient.ws.SplitterUID)1 UserVolumeSettings (com.emc.fapiclient.ws.UserVolumeSettings)1