Search in sources :

Example 1 with SmisBlockDeleteCGMirrorJob

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);
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) BlockMirror(com.emc.storageos.db.client.model.BlockMirror) CIMObjectPath(javax.cim.CIMObjectPath) WBEMException(javax.wbem.WBEMException) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) QueueJob(com.emc.storageos.volumecontroller.impl.job.QueueJob) CIMArgument(javax.cim.CIMArgument) SmisBlockDeleteCGMirrorJob(com.emc.storageos.volumecontroller.impl.smis.job.SmisBlockDeleteCGMirrorJob)

Aggregations

BlockMirror (com.emc.storageos.db.client.model.BlockMirror)1 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)1 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)1 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)1 QueueJob (com.emc.storageos.volumecontroller.impl.job.QueueJob)1 SmisBlockDeleteCGMirrorJob (com.emc.storageos.volumecontroller.impl.smis.job.SmisBlockDeleteCGMirrorJob)1 CIMArgument (javax.cim.CIMArgument)1 CIMObjectPath (javax.cim.CIMObjectPath)1 WBEMException (javax.wbem.WBEMException)1