use of com.emc.fapiclient.ws.SplitterUID 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);
}
}
use of com.emc.fapiclient.ws.SplitterUID in project coprhd-controller by CoprHD.
the class RecoverPointUtils method getSplittersToAttachToForVolume.
/**
* Finds the splitter(s) to attach a volume to (if any need to be attached).
*
* @param impl - handle for FAPI
* @param ClusterUID - site for the volume
* @param volume - volume ID we are looking for
* @return - Set<SplitterUID>
*/
private static Set<SplitterUID> getSplittersToAttachToForVolume(FunctionalAPIImpl impl, ClusterUID ClusterUID, DeviceUID volume) throws RecoverPointException {
Set<SplitterUID> returnSplitters = new HashSet<SplitterUID>();
try {
logger.info("Finding splitters with unattached volumes");
List<SplitterUID> splittersWithUnattachedVols = impl.getAvailableSplittersToAttachToVolume(ClusterUID, volume);
for (SplitterUID splitterUID : splittersWithUnattachedVols) {
SplitterSettings splitterSettings = impl.getSplitterSettings(splitterUID);
List<DeviceUID> unattachedVolumes = impl.getAvailableVolumesToAttachToSplitter(splitterUID, true);
if (!unattachedVolumes.isEmpty()) {
for (DeviceUID unattachedVolume : unattachedVolumes) {
if (unattachedVolume.getId() == volume.getId()) {
returnSplitters.add(splitterSettings.getSplitterUID());
}
}
}
}
return returnSplitters;
} catch (FunctionalAPIActionFailedException_Exception e) {
logger.error(e.getMessage(), e);
throw RecoverPointException.exceptions.exceptionGettingSplittersVolume(e);
} catch (FunctionalAPIInternalError_Exception e) {
logger.error(e.getMessage(), e);
throw RecoverPointException.exceptions.exceptionGettingSplittersVolume(e);
}
}
Aggregations