use of com.emc.storageos.db.client.model.RemoteDirectorGroup in project coprhd-controller by CoprHD.
the class SRDFLinkStartCompleter method complete.
@Override
protected void complete(DbClient dbClient, Status status, ServiceCoded coded) throws DeviceControllerException {
_log.info("Completing with status: {}", status);
try {
setDbClient(dbClient);
switch(status) {
case ready:
Volume target = getTargetVolume();
// a target R2 for CG.
if (null != sourceCGUri) {
URI targetSystemUri = target.getStorageController();
StorageSystem targetSystem = dbClient.queryObject(StorageSystem.class, targetSystemUri);
if (targetSystem.getTargetCgs() == null) {
targetSystem.setTargetCgs(new StringSet());
}
targetSystem.getTargetCgs().add(sourceCGUri.toString());
dbClient.persistObject(targetSystem);
}
RemoteDirectorGroup group = dbClient.queryObject(RemoteDirectorGroup.class, target.getSrdfGroup());
group.setSourceReplicationGroupName(sourceRepGroup);
group.setTargetReplicationGroupName(targetRepGroup);
dbClient.persistObject(group);
break;
default:
_log.info("Unable to handle status: {}", status);
}
recordSRDFOperation(dbClient, OperationTypeEnum.CREATE_SRDF_LINK, status, getSourceVolume().getId().toString(), getTargetVolume().getId().toString());
} catch (Exception e) {
_log.error("Failed updating status. SRDFLinkStart {}, for task " + getOpId(), getId(), e);
} finally {
super.complete(dbClient, status, coded);
}
}
use of com.emc.storageos.db.client.model.RemoteDirectorGroup in project coprhd-controller by CoprHD.
the class StorageProcessor method checkRAGroupExistsInDB.
protected RemoteDirectorGroup checkRAGroupExistsInDB(DbClient dbClient, CIMInstance instance) {
String raGroupNativeGuid = NativeGUIDGenerator.generateRAGroupNativeGuid(instance);
_logger.info("RA Group Id :" + raGroupNativeGuid);
@SuppressWarnings("deprecation") List<URI> raGroupUris = dbClient.queryByConstraint(AlternateIdConstraint.Factory.getRAGroupByNativeGuidConstraint(raGroupNativeGuid));
for (URI raGroupURI : raGroupUris) {
RemoteDirectorGroup raGroup = dbClient.queryObject(RemoteDirectorGroup.class, raGroupURI);
if (null != raGroup && !raGroup.getInactive()) {
return raGroup;
}
}
return null;
}
use of com.emc.storageos.db.client.model.RemoteDirectorGroup in project coprhd-controller by CoprHD.
the class RemoteConnCollectionToVolumeProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
try {
@SuppressWarnings("unchecked") final Iterator<CIMObjectPath> it = (Iterator<CIMObjectPath>) resultObj;
@SuppressWarnings("unchecked") Map<String, RemoteMirrorObject> volumeToRAGroupMap = (Map<String, RemoteMirrorObject>) keyMap.get(Constants.UN_VOLUME_RAGROUP_MAP);
_dbClient = (DbClient) keyMap.get(Constants.dbClient);
CIMObjectPath raGroupPath = getObjectPathfromCIMArgument(args);
String ragGroupId = NativeGUIDGenerator.generateRAGroupNativeGuid(raGroupPath);
_log.debug("RA Group Id :" + ragGroupId);
RemoteDirectorGroup remoteGroup = getRAGroupUriFromDB(_dbClient, ragGroupId);
if (null == remoteGroup) {
_log.warn("RA Group {} not found", ragGroupId);
return;
}
boolean is80Provider = keyMap.containsKey(Constants.IS_NEW_SMIS_PROVIDER) && Boolean.valueOf(keyMap.get(Constants.IS_NEW_SMIS_PROVIDER).toString());
RemoteDirectorGroup targetRemoteGroup = SRDFUtils.getAssociatedTargetRemoteDirectorGroup(_dbClient, is80Provider, ragGroupId);
while (it.hasNext()) {
CIMObjectPath volumePath = it.next();
RemoteMirrorObject rmObj = new RemoteMirrorObject();
addPath(keyMap, operation.getResult(), volumePath);
String unManagedVolumeNativeGuid = getUnManagedVolumeNativeGuidFromVolumePath(volumePath);
// Changes to copy mode in RemoteDirectorGroup is updated in StorageSynchronizedProcessor
rmObj.setCopyMode(remoteGroup.getSupportedCopyMode());
rmObj.setSourceRaGroupUri(remoteGroup.getId());
if (targetRemoteGroup != null) {
rmObj.setTargetRaGroupUri(targetRemoteGroup.getId());
}
if (!volumeToRAGroupMap.containsKey(unManagedVolumeNativeGuid)) {
volumeToRAGroupMap.put(unManagedVolumeNativeGuid, rmObj);
}
}
} catch (Exception e) {
_log.error("Updating Copy Mode for UnManaged Volumes failed", e);
}
}
use of com.emc.storageos.db.client.model.RemoteDirectorGroup in project coprhd-controller by CoprHD.
the class SRDFOperations method createListReplicas.
public void createListReplicas(StorageSystem system, List<URI> sources, List<URI> targets, boolean addWaitForCopyState, TaskCompleter completer) {
try {
Volume firstTarget = dbClient.queryObject(Volume.class, targets.get(0));
RemoteDirectorGroup group = dbClient.queryObject(RemoteDirectorGroup.class, firstTarget.getSrdfGroup());
StorageSystem targetSystem = dbClient.queryObject(StorageSystem.class, firstTarget.getStorageController());
int modeValue = Mode.valueOf(firstTarget.getSrdfCopyMode()).getMode();
CIMObjectPath srcRepSvcPath = cimPath.getControllerReplicationSvcPath(system);
CIMObjectPath repCollectionPath = cimPath.getRemoteReplicationCollection(system, group);
boolean formatVolumeFlagNeeded = ((SRDFMirrorCreateCompleter) completer).getVirtualPoolChangeURI() == null;
boolean emptyRDFGroup = group.getVolumes() == null || group.getVolumes().isEmpty();
CIMInstance replicationSettingDataInstance = getReplicationSettingDataInstance(system, modeValue, !emptyRDFGroup, formatVolumeFlagNeeded);
List<CIMObjectPath> sourcePaths = new ArrayList<>();
List<CIMObjectPath> targetPaths = new ArrayList<>();
// Due to this reason code is changed to fetch one volume at a time in the loop.
for (URI sourceVolumeURI : sources) {
Volume sourceVolume = dbClient.queryObject(Volume.class, sourceVolumeURI);
log.debug("sourceVolumeId:{} sourceNativeId {}", sourceVolume.getId(), sourceVolume.getNativeId());
sourcePaths.add(cimPath.getVolumePath(system, sourceVolume.getNativeId()));
}
for (URI targetVolumeURI : targets) {
Volume targetVolume = dbClient.queryObject(Volume.class, targetVolumeURI);
log.debug("targetVolumeId:{} targetNativeId {}", targetVolume.getId(), targetVolume.getNativeId());
targetPaths.add(cimPath.getVolumePath(targetSystem, targetVolume.getNativeId()));
}
CIMArgument[] inArgs = helper.getCreateListReplicaInputArguments(system, sourcePaths.toArray(new CIMObjectPath[sourcePaths.size()]), targetPaths.toArray(new CIMObjectPath[targetPaths.size()]), modeValue, repCollectionPath, replicationSettingDataInstance, addWaitForCopyState);
CIMArgument[] outArgs = new CIMArgument[5];
helper.invokeMethodSynchronously(system, srcRepSvcPath, SmisConstants.CREATE_LIST_REPLICA, inArgs, outArgs, new SmisSRDFCreateMirrorJob(null, system.getId(), completer));
completer.ready(dbClient);
} catch (WBEMException wbeme) {
log.error("SMI-S error creating mirrors for {}", Joiner.on(',').join(sources), wbeme);
ServiceError error = SmisException.errors.jobFailed(wbeme.getMessage());
WorkflowStepCompleter.stepFailed(completer.getOpId(), error);
completer.error(dbClient, error);
} catch (Exception e) {
log.error("Error creating mirrors for {}", Joiner.on(',').join(sources), e);
ServiceError error = SmisException.errors.jobFailed(e.getMessage());
WorkflowStepCompleter.stepFailed(completer.getOpId(), error);
completer.error(dbClient, error);
}
}
use of com.emc.storageos.db.client.model.RemoteDirectorGroup in project coprhd-controller by CoprHD.
the class SRDFOperations method changeRemoteDirectorGroup.
private void changeRemoteDirectorGroup(URI remoteGroupUri) {
RemoteDirectorGroup group = dbClient.queryObject(RemoteDirectorGroup.class, remoteGroupUri);
// Swap names
String srcName = group.getSourceReplicationGroupName();
group.setSourceReplicationGroupName(group.getTargetReplicationGroupName());
group.setTargetReplicationGroupName(srcName);
// TODO Should we swap anything else here? Source/Remote system?
dbClient.persistObject(group);
}
Aggregations