use of com.emc.fapiclient.ws.ClusterSplittersSettings 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);
}
}
Aggregations