use of com.emc.storageos.volumecontroller.impl.smis.job.SmisBlockCreateCGMirrorJob in project coprhd-controller by CoprHD.
the class VmaxMirrorOperations method createGroupMirrors.
@Override
public void createGroupMirrors(StorageSystem storage, List<URI> mirrorList, Boolean createInactive, TaskCompleter taskCompleter) throws DeviceControllerException {
_log.info("createGroupMirrors operation START");
List<BlockMirror> mirrors = null;
try {
if (!storage.getUsingSmis80()) {
throw DeviceControllerException.exceptions.blockDeviceOperationNotSupported();
}
mirrors = _dbClient.queryObject(BlockMirror.class, mirrorList);
BlockMirror firstMirror = mirrors.get(0);
Volume sourceVolume = _dbClient.queryObject(Volume.class, firstMirror.getSource());
String sourceGroupName = ConsistencyGroupUtils.getSourceConsistencyGroupName(sourceVolume, _dbClient);
String replicaLabel = ControllerUtils.generateLabel(sourceVolume.getLabel(), firstMirror.getLabel());
// CTRL-5640: ReplicationGroup may not be accessible after provider fail-over.
ReplicationUtils.checkReplicationGroupAccessibleOrFail(storage, sourceVolume, _dbClient, _helper, _cimPath);
// Create CG mirrors
CIMObjectPath job = VmaxGroupOperationsUtils.internalCreateGroupReplica(storage, sourceGroupName, replicaLabel, null, createInactive, taskCompleter, SYNC_TYPE.MIRROR, _dbClient, _helper, _cimPath);
ControllerServiceImpl.enqueueJob(new QueueJob(new SmisBlockCreateCGMirrorJob(job, storage.getId(), taskCompleter)));
for (BlockMirror mirror : mirrors) {
mirror.setSyncState(SynchronizationState.SYNCHRONIZED.name());
}
_dbClient.persistObject(mirrors);
} catch (Exception e) {
_log.error("Problem making SMI-S call: ", e);
// Roll back changes
if (mirrors != null && !mirrors.isEmpty()) {
for (BlockMirror mirrorObj : mirrors) {
mirrorObj.setInactive(true);
}
}
_dbClient.persistObject(mirrors);
ServiceError error = DeviceControllerErrors.smis.methodFailed("createGroupMirrors", e.getMessage());
taskCompleter.error(_dbClient, error);
}
_log.info("createGroupMirrors operation END");
}
Aggregations