use of com.emc.storageos.volumecontroller.impl.smis.job.SmisBlockDeleteCGMirrorJob in project coprhd-controller by CoprHD.
the class AbstractMirrorOperations method deleteGroupMirrors.
@Override
public void deleteGroupMirrors(StorageSystem storage, List<URI> mirrorList, TaskCompleter taskCompleter) throws DeviceControllerException {
_log.info("deleteGroupMirrors operation START");
if (!((storage.getUsingSmis80() && storage.deviceIsType(Type.vmax)) || storage.deviceIsType(Type.vnxblock))) {
throw DeviceControllerException.exceptions.blockDeviceOperationNotSupported();
}
try {
String[] deviceIds = null;
BlockMirror firstMirror = _dbClient.queryObject(BlockMirror.class, mirrorList.get(0));
String repGroupName = firstMirror.getReplicationGroupInstance();
if (NullColumnValueGetter.isNotNullValue(repGroupName)) {
CIMObjectPath repGroupPath = _cimPath.getReplicationGroupPath(storage, repGroupName);
Set<String> deviceIdsSet = _helper.getVolumeDeviceIdsFromStorageGroup(storage, repGroupPath);
deviceIds = deviceIdsSet.toArray(new String[deviceIdsSet.size()]);
// Delete replication group
ReplicationUtils.deleteReplicationGroup(storage, repGroupName, _dbClient, _helper, _cimPath);
// Set mirrors replication group to null
List<BlockMirror> mirrors = _dbClient.queryObject(BlockMirror.class, mirrorList);
for (BlockMirror mirror : mirrors) {
mirror.setConsistencyGroup(NullColumnValueGetter.getNullURI());
mirror.setReplicationGroupInstance(NullColumnValueGetter.getNullStr());
}
_dbClient.persistObject(mirrors);
} else {
deviceIds = _helper.getBlockObjectNativeIds(mirrorList);
}
if (storage.checkIfVmax3()) {
_helper.removeVolumeFromParkingSLOStorageGroup(storage, deviceIds, false);
_log.info("Done invoking remove volumes from parking SLO storage group");
}
CIMObjectPath[] mirrorPaths = _cimPath.getVolumePaths(storage, deviceIds);
CIMObjectPath configSvcPath = _cimPath.getConfigSvcPath(storage);
CIMArgument[] inArgs = null;
if (storage.deviceIsType(Type.vnxblock)) {
inArgs = _helper.getReturnElementsToStoragePoolArguments(mirrorPaths);
} else {
inArgs = _helper.getReturnElementsToStoragePoolArguments(mirrorPaths, SmisConstants.CONTINUE_ON_NONEXISTENT_ELEMENT);
}
CIMArgument[] outArgs = new CIMArgument[5];
_helper.invokeMethod(storage, configSvcPath, SmisConstants.RETURN_ELEMENTS_TO_STORAGE_POOL, inArgs, outArgs);
CIMObjectPath job = _cimPath.getCimObjectPathFromOutputArgs(outArgs, SmisConstants.JOB);
ControllerServiceImpl.enqueueJob(new QueueJob(new SmisBlockDeleteCGMirrorJob(job, storage.getId(), taskCompleter)));
} catch (Exception e) {
_log.error("Problem making SMI-S call: ", e);
ServiceError serviceError = DeviceControllerErrors.smis.unableToCallStorageProvider(e.getMessage());
taskCompleter.error(_dbClient, serviceError);
}
}
Aggregations