use of com.emc.fapiclient.ws.SplitterSettings in project coprhd-controller by CoprHD.
the class RecoverPointUtils method getArraysForCluster.
/**
* Get all of the arrays associated with a cluster
*
* @param impl endpoint interface
* @param clusterUID cluster ID
* @return set of storage systems
* @throws RecoverPointException
*/
public static Set<String> getArraysForCluster(FunctionalAPIImpl impl, ClusterUID clusterUID) throws RecoverPointException {
Set<String> returnArrays = new HashSet<>();
try {
logger.info("Finding arrays associated with RP cluster: " + clusterUID.getId());
// Get the arrays that are configured as splitters.
ClusterSplittersSettings splitterSettings = impl.getSplittersSettingsFromCluster(clusterUID);
if (splitterSettings != null && splitterSettings.getSplittersSettings() != null) {
for (SplitterSettings splitterSetting : splitterSettings.getSplittersSettings()) {
// The splitter name will arrive as:
// VPLEX: FNM0123456789
// VNX: APM0123467890-A
// VMAX: SYMM-01947656483
// In all cases, we need to distill that into a serial number.
//
// NOTE: What would be ideal is to take the SplitterSetting.getArrayID() and get back
// native array information. I could not find that method, so I had to resort to
// this for now. It does work, but it's not ideal. WJEIV
Pattern myPattern = Pattern.compile("[A-Z,a-z,0-9]*");
Matcher m = myPattern.matcher(splitterSetting.getSplitterName());
while (m.find()) {
String s = m.group(0);
// We get around this by finding the third group in the pattern.
if (s.equals("SYMM")) {
// Iterate to the "-"
m.find();
// Iterate to the serial number
m.find();
s = m.group(0);
}
returnArrays.add(s);
logger.info("Found array name: " + s);
break;
}
}
}
return returnArrays;
} catch (FunctionalAPIActionFailedException_Exception e) {
logger.error(e.getMessage(), e);
throw RecoverPointException.exceptions.exceptionGettingArrays(e);
} catch (FunctionalAPIInternalError_Exception e) {
logger.error(e.getMessage(), e);
throw RecoverPointException.exceptions.exceptionGettingArrays(e);
}
}
use of com.emc.fapiclient.ws.SplitterSettings 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