Search in sources :

Example 1 with SmisVolumeExpandJob

use of com.emc.storageos.volumecontroller.impl.smis.job.SmisVolumeExpandJob in project coprhd-controller by CoprHD.

the class SmisMetaVolumeOperations method expandVolumeAsMetaVolume.

/**
 * Expand regular volume as a meta volume.
 *
 * @param storageSystem
 * @param metaHead
 * @param metaMembers
 * @param metaType
 * @param metaVolumeTaskCompleter
 * @throws DeviceControllerException
 */
@Override
public void expandVolumeAsMetaVolume(StorageSystem storageSystem, StoragePool storagePool, Volume metaHead, List<String> metaMembers, String metaType, MetaVolumeTaskCompleter metaVolumeTaskCompleter) throws DeviceControllerException {
    String label = null;
    _log.info(String.format("Expand Volume as  Meta Volume Start - Array: %s, Head: %s, Recommended meta type: %s %n   Members:%s", storageSystem.getSerialNumber(), metaHead.getLabel(), metaType, metaMembers));
    label = metaHead.getLabel();
    boolean isRPVolume = false;
    if (metaHead != null) {
        // A volume is of type RP if the volume has an RP copy name or it's a VPlex backing volume associated to a
        // VPlex RP source volume.
        isRPVolume = metaHead.checkForRp() || RPHelper.isAssociatedToAnyRpVplexTypes(metaHead, _dbClient);
    }
    // initialize the retry/attempt variables
    int attempt = 0;
    int retries = 1;
    if (isRPVolume) {
        // if we are dealing with an RP volume, we need to set the retry count appropriately
        retries = MAX_RP_EXPAND_RETRIES;
    }
    // has not been received or processed yet.
    while (attempt++ <= retries) {
        try {
            CIMObjectPath elementCompositionServicePath = _cimPath.getElementCompositionSvcPath(storageSystem);
            CIMArgument[] inArgs;
            inArgs = _helper.getCreateMetaVolumeInputArguments(storageSystem, label, metaHead, metaMembers, metaType, true);
            CIMArgument[] outArgs = new CIMArgument[5];
            // TODO evaluate use of asunc call for the last operation in extend sequence
            // _helper.invokeMethod(storageSystem, elementCompositionServicePath, SmisConstants.CREATE_OR_MODIFY_COMPOSITE_ELEMENT,
            // inArgs,
            // outArgs);
            // CIMObjectPath job = _cimPath.getCimObjectPathFromOutputArgs(outArgs, SmisConstants.JOB);
            // if (job != null) {
            // ControllerServiceImpl.enqueueJob(new QueueJob(new SmisVolumeExpandJob(job, storageSystem.getId(),
            // taskCompleter, "ExpandAsMetaVolume")));
            // }
            // 
            StorageSystem forProvider = _helper.getStorageSystemForProvider(storageSystem, metaHead);
            _log.info("Selected Provider : {}", forProvider.getNativeGuid());
            SmisJob smisJobCompleter = new SmisVolumeExpandJob(null, forProvider.getId(), storagePool.getId(), metaVolumeTaskCompleter, "ExpandAsMetaVolume");
            if (isRPVolume) {
                _log.info(String.format("Attempt %s/%s to expand volume %s, which is associated with RecoverPoint", attempt, MAX_RP_EXPAND_RETRIES, metaHead.getLabel()));
            }
            _helper.invokeMethodSynchronously(forProvider, elementCompositionServicePath, SmisConstants.CREATE_OR_MODIFY_COMPOSITE_ELEMENT, inArgs, outArgs, smisJobCompleter);
            // No exceptions so break out of the retry loop
            break;
        } catch (WBEMException e) {
            _log.error("Problem making SMI-S call: ", e);
            ServiceError error = DeviceControllerErrors.smis.unableToCallStorageProvider(e.getMessage());
            metaVolumeTaskCompleter.getVolumeTaskCompleter().error(_dbClient, _locker, error);
        } catch (Exception e) {
            if (attempt != retries && isRPVolume && e.getMessage().contains("The requested device has active sessions")) {
                // RP has issued an async request to terminate the active session so we just need to wait
                // and retry the expand.
                _log.warn(String.format("Encountered exception attempting to expand RP volume %s.  Waiting %s milliseconds before trying again.  Error: %s", metaHead.getLabel(), RP_EXPAND_WAIT_FOR_RETRY, e.getMessage()));
                try {
                    Thread.sleep(RP_EXPAND_WAIT_FOR_RETRY);
                } catch (InterruptedException e1) {
                    Thread.currentThread().interrupt();
                }
            } else {
                _log.error("Problem in expandVolumeAsMetaVolume: ", e);
                ServiceError error = DeviceControllerErrors.smis.methodFailed("expandVolumeAsMetaVolume", e.getMessage());
                metaVolumeTaskCompleter.getVolumeTaskCompleter().error(_dbClient, _locker, error);
                // Break out of the retry loop
                break;
            }
        }
    }
    _log.info(String.format("Expand Volume as  Meta Volume End - Array:%s, Head:%s, %n  Head device ID: %s, Members:%s", storageSystem.getSerialNumber(), metaHead.getLabel(), metaHead.getNativeId(), metaMembers));
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) CIMObjectPath(javax.cim.CIMObjectPath) WBEMException(javax.wbem.WBEMException) WBEMException(javax.wbem.WBEMException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) SmisJob(com.emc.storageos.volumecontroller.impl.smis.job.SmisJob) CIMArgument(javax.cim.CIMArgument) StorageSystem(com.emc.storageos.db.client.model.StorageSystem) SmisVolumeExpandJob(com.emc.storageos.volumecontroller.impl.smis.job.SmisVolumeExpandJob)

Example 2 with SmisVolumeExpandJob

use of com.emc.storageos.volumecontroller.impl.smis.job.SmisVolumeExpandJob in project coprhd-controller by CoprHD.

the class SmisMetaVolumeOperations method expandMetaVolume.

/**
 * Expand meta volume.
 *
 * @param storageSystem
 * @param metaHead
 * @param newMetaMembers
 * @param metaVolumeTaskCompleter
 * @throws DeviceControllerException
 */
@Override
public void expandMetaVolume(StorageSystem storageSystem, StoragePool storagePool, Volume metaHead, List<String> newMetaMembers, MetaVolumeTaskCompleter metaVolumeTaskCompleter) throws DeviceControllerException {
    _log.info(String.format("Expand Meta Volume Start - Array: %s, Head: %s, %n   New members:%s", storageSystem.getSerialNumber(), metaHead.getLabel(), newMetaMembers));
    boolean isRPVolume = false;
    if (metaHead != null) {
        // A volume is of type RP if the volume has an RP copy name or it's a VPlex backing volume associated to a
        // VPlex RP source volume.
        isRPVolume = metaHead.checkForRp() || RPHelper.isAssociatedToAnyRpVplexTypes(metaHead, _dbClient);
    }
    // initialize the retry/attempt variables
    int attempt = 0;
    int retries = 1;
    if (isRPVolume) {
        // if we are dealing with an RP volume, we need to set the retry count appropriately
        retries = MAX_RP_EXPAND_RETRIES;
    }
    // has not been received or processed yet.
    while (attempt++ <= retries) {
        try {
            CIMObjectPath elementCompositionServicePath = _cimPath.getElementCompositionSvcPath(storageSystem);
            CIMArgument[] inArgs;
            inArgs = _helper.getExpandMetaVolumeInputArguments(storageSystem, metaHead, newMetaMembers);
            CIMArgument[] outArgs = new CIMArgument[5];
            // TODO evaluate use of asunc call for the last operation in extend sequence
            // _helper.invokeMethod(storageSystem, elementCompositionServicePath, SmisConstants.CREATE_OR_MODIFY_COMPOSITE_ELEMENT,
            // inArgs,
            // outArgs);
            // CIMObjectPath job = _cimPath.getCimObjectPathFromOutputArgs(outArgs, SmisConstants.JOB);
            // if (job != null) {
            // ControllerServiceImpl.enqueueJob(new QueueJob(new SmisVolumeExpandJob(job, storageSystem.getId(),
            // taskCompleter, "ExpandMetaVolume")));
            // }
            StorageSystem forProvider = _helper.getStorageSystemForProvider(storageSystem, metaHead);
            _log.info("Selected Provider : {}", forProvider.getNativeGuid());
            SmisJob smisJobCompleter = new SmisVolumeExpandJob(null, forProvider.getId(), storagePool.getId(), metaVolumeTaskCompleter, "ExpandMetaVolume");
            if (isRPVolume) {
                _log.info(String.format("Attempt %s/%s to expand volume %s, which is associated with RecoverPoint", attempt, MAX_RP_EXPAND_RETRIES, metaHead.getLabel()));
            }
            _helper.invokeMethodSynchronously(forProvider, elementCompositionServicePath, SmisConstants.CREATE_OR_MODIFY_COMPOSITE_ELEMENT, inArgs, outArgs, smisJobCompleter);
            // No exceptions so break out of the retry loop
            break;
        } catch (WBEMException e) {
            _log.error("Problem making SMI-S call: ", e);
            ServiceError error = DeviceControllerErrors.smis.unableToCallStorageProvider(e.getMessage());
            metaVolumeTaskCompleter.getVolumeTaskCompleter().error(_dbClient, _locker, error);
        } catch (Exception e) {
            if (attempt != retries && isRPVolume && e.getMessage().contains("The requested device has active sessions")) {
                // RP has issued an async request to terminate the active session so we just need to wait
                // and retry the expand.
                _log.warn(String.format("Encountered exception attempting to expand RP volume %s.  Waiting %s milliseconds before trying again.  Error: %s", metaHead.getLabel(), RP_EXPAND_WAIT_FOR_RETRY, e.getMessage()));
                try {
                    Thread.sleep(RP_EXPAND_WAIT_FOR_RETRY);
                } catch (InterruptedException e1) {
                    Thread.currentThread().interrupt();
                }
            } else {
                _log.error("Problem in expandMetaVolume: ", e);
                ServiceError error = DeviceControllerErrors.smis.methodFailed("expandVolume", e.getMessage());
                metaVolumeTaskCompleter.getVolumeTaskCompleter().error(_dbClient, _locker, error);
                // Break out of the retry loop
                break;
            }
        }
    }
    _log.info(String.format("Expand Meta Volume End - Array:%s, Head:%s, %n  Head device ID: %s, New members:%s", storageSystem.getSerialNumber(), metaHead.getLabel(), metaHead.getNativeId(), newMetaMembers));
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) CIMObjectPath(javax.cim.CIMObjectPath) SmisJob(com.emc.storageos.volumecontroller.impl.smis.job.SmisJob) WBEMException(javax.wbem.WBEMException) WBEMException(javax.wbem.WBEMException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) CIMArgument(javax.cim.CIMArgument) StorageSystem(com.emc.storageos.db.client.model.StorageSystem) SmisVolumeExpandJob(com.emc.storageos.volumecontroller.impl.smis.job.SmisVolumeExpandJob)

Example 3 with SmisVolumeExpandJob

use of com.emc.storageos.volumecontroller.impl.smis.job.SmisVolumeExpandJob in project coprhd-controller by CoprHD.

the class SmisStorageDevice method doExpandVolume.

@Override
public void doExpandVolume(final StorageSystem storageSystem, final StoragePool pool, final Volume volume, final Long size, final TaskCompleter taskCompleter) throws DeviceControllerException {
    _log.info(String.format("Expand Volume Start - Array: %s, Pool: %s, Volume: %s, New size: %d", storageSystem.getSerialNumber(), pool.getNativeGuid(), volume.getLabel(), size));
    MetaVolumeTaskCompleter metaVolumeTaskCompleter = new MetaVolumeTaskCompleter(taskCompleter);
    try {
        if (!doesStorageSystemSupportVolumeExpand(storageSystem)) {
            ServiceError error = DeviceControllerErrors.smis.volumeExpandIsNotSupported(storageSystem.getNativeGuid());
            taskCompleter.error(_dbClient, error);
            return;
        }
        boolean tagSet = _helper.doApplyRecoverPointTag(storageSystem, volume, false);
        if (!tagSet) {
            ServiceError error = DeviceControllerErrors.smis.errorSettingRecoverPointTag("disable");
            taskCompleter.error(_dbClient, error);
            return;
        }
        CIMObjectPath configSvcPath = _cimPath.getConfigSvcPath(storageSystem);
        CIMArgument[] inArgs = _helper.getExpandVolumeInputArguments(storageSystem, pool, volume, size);
        CIMArgument[] outArgs = new CIMArgument[5];
        _helper.invokeMethod(storageSystem, configSvcPath, SmisConstants.CREATE_OR_MODIFY_ELEMENT_FROM_STORAGE_POOL, inArgs, outArgs);
        CIMObjectPath job = _cimPath.getCimObjectPathFromOutputArgs(outArgs, SmisConstants.JOB);
        if (job != null) {
            ControllerServiceImpl.enqueueJob(new QueueJob(new SmisVolumeExpandJob(job, storageSystem.getId(), pool.getId(), metaVolumeTaskCompleter, "ExpandVolume")));
        }
    } catch (WBEMException e) {
        _log.error("Problem making SMI-S call: ", e);
        ServiceError error = DeviceControllerErrors.smis.unableToCallStorageProvider(e.getMessage());
        taskCompleter.error(_dbClient, error);
    } catch (Exception e) {
        _log.error("Problem in doExpandVolume: ", e);
        ServiceError error = DeviceControllerErrors.smis.methodFailed("doExpandVolume", e.getMessage());
        taskCompleter.error(_dbClient, error);
    }
    _log.info(String.format("Expand Volume End - Array: %s, Pool: %s, Volume: %s", storageSystem.getSerialNumber(), pool.getNativeGuid(), volume.getLabel()));
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) MetaVolumeTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.MetaVolumeTaskCompleter) CIMObjectPath(javax.cim.CIMObjectPath) WBEMException(javax.wbem.WBEMException) QueueJob(com.emc.storageos.volumecontroller.impl.job.QueueJob) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) WBEMException(javax.wbem.WBEMException) CIMArgument(javax.cim.CIMArgument) SmisVolumeExpandJob(com.emc.storageos.volumecontroller.impl.smis.job.SmisVolumeExpandJob)

Aggregations

DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)3 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)3 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)3 SmisVolumeExpandJob (com.emc.storageos.volumecontroller.impl.smis.job.SmisVolumeExpandJob)3 CIMArgument (javax.cim.CIMArgument)3 CIMObjectPath (javax.cim.CIMObjectPath)3 WBEMException (javax.wbem.WBEMException)3 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)2 SmisJob (com.emc.storageos.volumecontroller.impl.smis.job.SmisJob)2 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)1 MetaVolumeTaskCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.MetaVolumeTaskCompleter)1 QueueJob (com.emc.storageos.volumecontroller.impl.job.QueueJob)1