use of com.emc.storageos.db.client.model.RemoteDirectorGroup in project coprhd-controller by CoprHD.
the class StorageSynchronizedProcessor method updateCopyModeInRAGroupObjectIfRequired.
/**
* Update copy mode in RA group objects in DB if they don't reflect the latest.
*
* @param copyMode the copy mode from StorageSynchornized
* @param rmObj the RemoteMirrorObject
*/
private void updateCopyModeInRAGroupObjectIfRequired(String copyMode, RemoteMirrorObject rmObj) {
// get source array RA group
URI raGroupURI = rmObj.getTargetRaGroupUri();
RemoteDirectorGroup raGroup = _dbClient.queryObject(RemoteDirectorGroup.class, raGroupURI);
// update the latest copy mode in RA group object in DB
if (raGroup != null && !copyMode.equalsIgnoreCase(raGroup.getSupportedCopyMode()) && updateSupportedCopyMode(raGroup.getSupportedCopyMode())) {
raGroup.setSupportedCopyMode(copyMode);
_dbClient.updateObject(raGroup);
}
// get target array RA group
URI targetRaGroupURI = rmObj.getSourceRaGroupUri();
RemoteDirectorGroup targetRaGroup = _dbClient.queryObject(RemoteDirectorGroup.class, targetRaGroupURI);
if (targetRaGroup != null && !copyMode.equalsIgnoreCase(targetRaGroup.getSupportedCopyMode()) && updateSupportedCopyMode(targetRaGroup.getSupportedCopyMode())) {
targetRaGroup.setSupportedCopyMode(copyMode);
_dbClient.updateObject(targetRaGroup);
}
}
use of com.emc.storageos.db.client.model.RemoteDirectorGroup in project coprhd-controller by CoprHD.
the class FindReachableProvider method find.
@Override
public StorageSystem find() {
RemoteDirectorGroup rdfGroup = dbClient.queryObject(RemoteDirectorGroup.class, target.getSrdfGroup());
StorageSystem rdfGroupSourceSystem = dbClient.queryObject(StorageSystem.class, rdfGroup.getSourceStorageSystemUri());
// if source (from RDFGroup) is not reachable, then try target system.
// Scan would have helped us to find the reachable system but we need to wait for every 10 minutes, had this code explicitly
// to find reachable systems before invoking fail over.
StorageSystem reachableSystem = rdfGroupSourceSystem;
if (!helper.checkConnectionliveness(reachableSystem)) {
StorageSystem rdfGroupTargetSystem = dbClient.queryObject(StorageSystem.class, rdfGroup.getRemoteStorageSystemUri());
log.info("Source Site {} not reachable", rdfGroupSourceSystem.getActiveProviderURI());
if (helper.checkConnectionliveness(rdfGroupTargetSystem)) {
log.info("Target Site {} reachable", rdfGroupTargetSystem.getActiveProviderURI());
reachableSystem = rdfGroupTargetSystem;
} else {
log.info("Target Site {} not reachable", rdfGroupTargetSystem.getActiveProviderURI());
return null;
}
}
log.info("Reachable System found {}", reachableSystem.getActiveProviderURI());
return reachableSystem;
}
use of com.emc.storageos.db.client.model.RemoteDirectorGroup in project coprhd-controller by CoprHD.
the class SRDFScheduler method findRAGroupAssociatedWithCG.
private List<RemoteDirectorGroup> findRAGroupAssociatedWithCG(final Iterator<URI> raGroupIter, final BlockConsistencyGroup cgObj) {
List<RemoteDirectorGroup> groups = storeRAGroupsinList(raGroupIter);
if (null == cgObj) {
return groups;
}
String cgName = cgObj.getAlternateLabel();
if (null == cgName) {
cgName = cgObj.getLabel();
}
List<RemoteDirectorGroup> filteredGroups = new ArrayList<RemoteDirectorGroup>();
for (RemoteDirectorGroup raGroup : groups) {
if ((null != raGroup.getSourceReplicationGroupName() && raGroup.getSourceReplicationGroupName().contains(cgName)) || (null != raGroup.getTargetReplicationGroupName() && raGroup.getTargetReplicationGroupName().contains(cgName))) {
_log.info("Found the RDF Group {} which contains the CG {}. Processing the RDF Group for other validations.", raGroup.getId(), cgObj.getId());
filteredGroups.add(raGroup);
}
}
if (!filteredGroups.isEmpty())
return filteredGroups;
return groups;
}
use of com.emc.storageos.db.client.model.RemoteDirectorGroup in project coprhd-controller by CoprHD.
the class SRDFScheduler method storeRAGroupsinList.
private List<RemoteDirectorGroup> storeRAGroupsinList(final Iterator<URI> raGroupIter) {
List<RemoteDirectorGroup> groups = new ArrayList<RemoteDirectorGroup>();
while (raGroupIter.hasNext()) {
URI raGroupId = raGroupIter.next();
RemoteDirectorGroup raGroup = _dbClient.queryObject(RemoteDirectorGroup.class, raGroupId);
if (!raGroup.getInactive()) {
groups.add(raGroup);
}
}
return groups;
}
use of com.emc.storageos.db.client.model.RemoteDirectorGroup in project coprhd-controller by CoprHD.
the class SRDFScheduler method findRAGroup.
/**
* Match up RA Groups to the source and target storage systems. If a match is found, return the
* ID.
*
* @param sourceStorageSystem
* potential source storage system
* @param targetStorageSystem
* potential target storage system
* @param copyMode
* async, sync mode literals
* @param project
* project requested
* @return Remote Group ID
*/
private URI findRAGroup(final StorageSystem sourceStorageSystem, final StorageSystem targetStorageSystem, final String copyMode, final Project project, final URI consistencyGroupUri) {
URIQueryResultList raGroupsInDB = new URIQueryResultList();
BlockConsistencyGroup cgObj = null;
if (null != consistencyGroupUri) {
cgObj = _dbClient.queryObject(BlockConsistencyGroup.class, consistencyGroupUri);
}
// Primary name check, "V-<projectname>" or "<projectname>"
StringSet grpNames = SRDFUtils.getQualifyingRDFGroupNames(project);
// If placement doesn't require project-based label below, remove this check.
if (project.getLabel().length() > SRDFUtils.RDF_GROUP_NAME_MAX_LENGTH - SRDFUtils.RDF_GROUP_PREFIX.length()) {
_log.warn(String.format("SRDF RA Group Placement: Project name is longer than the number of characters allowed by VMAX for an RA group name. This will cause an issue if you have multiple projects that start with %s", project.getLabel().substring(0, SRDFUtils.RDF_GROUP_NAME_MAX_LENGTH - SRDFUtils.RDF_GROUP_PREFIX.length())));
}
_dbClient.queryByConstraint(ContainmentConstraint.Factory.getStorageDeviceRemoteGroupsConstraint(sourceStorageSystem.getId()), raGroupsInDB);
Iterator<URI> raGroupIter = raGroupsInDB.iterator();
List<RemoteDirectorGroup> raGroups = findRAGroupAssociatedWithCG(raGroupIter, cgObj);
for (RemoteDirectorGroup raGroup : raGroups) {
URI raGroupId = raGroup.getId();
_log.info(String.format("SRDF RA Group Placement: Checking to see if RA Group: %s is suitable for SRDF protection, given the request.", raGroup.getLabel()));
_log.info(String.format("SRDF RA Group Placement: Source Array: %s --> Target Array: %s", sourceStorageSystem.getNativeGuid(), targetStorageSystem.getNativeGuid()));
// Check to see if it exists in the DB and is active
if (null == raGroup || raGroup.getInactive()) {
_log.info("SRDF RA Group Placement: Found that the RA Group is either not in the database or in the deactivated state, not considering.");
continue;
}
// Check to see if the RA Group contains (substring is OK) any of the desired labels
if (raGroup.getLabel() == null || !SRDFUtils.containsRaGroupName(grpNames, raGroup.getLabel())) {
_log.info(String.format("SRDF RA Group Placement: Found that the RA Group does not have a label or does not contain any of the names (%s), which is currently required for leveraging existing RA Groups.", StringUtils.join(grpNames, ",")));
continue;
}
// Check to see if the source storage system ID matches
if (!raGroup.getSourceStorageSystemUri().equals(sourceStorageSystem.getId())) {
_log.info(String.format("SRDF RA Group Placement: Found that the RA Group does not cater to the source storage system we require. We require %s, but this group is defined as %s", sourceStorageSystem.getNativeGuid(), raGroup.getNativeGuid()));
continue;
}
// Check to see if the remote storage system ID matches
if (!raGroup.getRemoteStorageSystemUri().equals(targetStorageSystem.getId())) {
_log.info(String.format("SRDF RA Group Placement: Found that the RA Group does not cater to the remote (target) storage system we require. We require %s, but this group is defined as %s", targetStorageSystem.getNativeGuid(), raGroup.getNativeGuid()));
continue;
}
// Check to see if the connectivity status is UP
if (!raGroup.getConnectivityStatus().equals(RemoteDirectorGroup.ConnectivityStatus.UP.toString())) {
_log.info(String.format("SRDF RA Group Placement: Found that the RA Group is not in the proper connectivity state of UP, instead it is in the state: %s", raGroup.getConnectivityStatus().toString()));
continue;
}
// decision to come.
if (raGroup.getSupportedCopyMode() == null) {
_log.warn(String.format("SRDF RA Group Placement: Copy Mode not set on RA Group %s, probably an unsupported SRDF Deployment: ", raGroup.getLabel()));
}
// for that copy
if (raGroup.getSupportedCopyMode() != null && !raGroup.getSupportedCopyMode().equals(RemoteDirectorGroup.SupportedCopyModes.ALL.toString()) && !raGroup.getSupportedCopyMode().equals(copyMode)) {
_log.info(String.format("SRDF RA Group Placement: Found that the RA Group does is using the proper copy policy of %s, instead it is using copy policy: %s", copyMode, raGroup.getSupportedCopyMode().toString()));
continue;
}
// Look for empty RA Groups alone, which can be used to create this new CG.
if (raGroups.size() > 1 && null != cgObj && raGroup.getVolumes() != null && !raGroup.getVolumes().isEmpty() && !cgObj.getLabel().equalsIgnoreCase(raGroup.getLabel())) {
_log.info(String.format("Found that the RDF Group %s has existing volumes with a CG different from expected: %s .", raGroup.getLabel(), cgObj.getLabel()));
continue;
}
_log.info(String.format("SRDF RA Group Placement: RA Group: %s on %s --> %s is selected for SRDF protection", raGroup.getLabel(), sourceStorageSystem.getNativeGuid(), targetStorageSystem.getNativeGuid()));
return raGroupId;
}
_log.warn("SRDF RA Group Placement: No RA Group was suitable for SRDF protection. See previous log messages for specific failed criteria on each RA Group considered.");
return null;
}
Aggregations