Search in sources :

Example 31 with QueueJob

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

the class HDSStorageDevice method doModifyVolumes.

@Override
public void doModifyVolumes(StorageSystem storage, StoragePool storagePool, String opId, List<Volume> volumes, TaskCompleter taskCompleter) throws DeviceControllerException {
    StringBuilder logMsgBuilder = new StringBuilder(String.format("Modify Volume Start - Array:%s, Pool:%s", storage.getSerialNumber(), storagePool.getNativeGuid()));
    String systemObjectID = HDSUtils.getSystemObjectID(storage);
    for (Volume volume : volumes) {
        try {
            HDSApiClient hdsApiClient = hdsApiFactory.getClient(HDSUtils.getHDSServerManagementServerInfo(storage), storage.getSmisUserName(), storage.getSmisPassword());
            logMsgBuilder.append(String.format("%nVolume:%s , IsThinlyProvisioned: %s, tieringPolicy: %s", volume.getLabel(), volume.getThinlyProvisioned(), volume.getAutoTieringPolicyUri()));
            LogicalUnit logicalUnit = hdsApiClient.getLogicalUnitInfo(systemObjectID, HDSUtils.getLogicalUnitObjectId(volume.getNativeId(), storage));
            String policyName = ControllerUtils.getAutoTieringPolicyName(volume.getId(), dbClient);
            String autoTierPolicyName = null;
            if (policyName.equals(Constants.NONE)) {
                autoTierPolicyName = null;
            } else {
                autoTierPolicyName = HitachiTieringPolicy.getPolicy(policyName.replaceAll(HDSConstants.SLASH_OPERATOR, HDSConstants.UNDERSCORE_OPERATOR)).getKey();
            }
            if (null != logicalUnit && null != logicalUnit.getLdevList() && !logicalUnit.getLdevList().isEmpty()) {
                Iterator<LDEV> ldevItr = logicalUnit.getLdevList().iterator();
                if (ldevItr.hasNext()) {
                    LDEV ldev = ldevItr.next();
                    String asyncMessageId = hdsApiClient.modifyThinVolumeTieringPolicy(systemObjectID, logicalUnit.getObjectID(), ldev.getObjectID(), autoTierPolicyName, storage.getModel());
                    if (null != asyncMessageId) {
                        HDSJob modifyHDSJob = new HDSModifyVolumeJob(asyncMessageId, volume.getStorageController(), taskCompleter, HDSModifyVolumeJob.VOLUME_MODIFY_JOB);
                        ControllerServiceImpl.enqueueJob(new QueueJob(modifyHDSJob));
                    } else {
                        throw HDSException.exceptions.asyncTaskFailed("Unable to get async taskId from HiCommand Device Manager for the modify volume call");
                    }
                }
            } else {
                String errorMsg = String.format("No LDEV's found for volume: %s", volume.getId());
                log.info(errorMsg);
                ServiceError serviceError = DeviceControllerErrors.hds.methodFailed("doModifyVolumes", errorMsg);
                taskCompleter.error(dbClient, serviceError);
            }
        } catch (final Exception e) {
            log.error("Problem in doModifyVolumes: ", e);
            ServiceError serviceError = DeviceControllerErrors.hds.methodFailed("doModifyVolumes", e.getMessage());
            taskCompleter.error(dbClient, serviceError);
        }
    }
}
Also used : HDSModifyVolumeJob(com.emc.storageos.volumecontroller.impl.hds.prov.job.HDSModifyVolumeJob) HDSApiClient(com.emc.storageos.hds.api.HDSApiClient) ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) HDSJob(com.emc.storageos.volumecontroller.impl.hds.prov.job.HDSJob) Volume(com.emc.storageos.db.client.model.Volume) LogicalUnit(com.emc.storageos.hds.model.LogicalUnit) LDEV(com.emc.storageos.hds.model.LDEV) 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) HDSException(com.emc.storageos.hds.HDSException)

Example 32 with QueueJob

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

the class HDSCloneOperations method restoreFromSingleClone.

@Override
public void restoreFromSingleClone(StorageSystem storageSystem, URI cloneURI, TaskCompleter taskCompleter) {
    try {
        Volume cloneVolume = dbClient.queryObject(Volume.class, cloneURI);
        Volume sourceVolume = dbClient.queryObject(Volume.class, cloneVolume.getAssociatedSourceVolume());
        hdsProtectionOperations.modifyShadowImagePair(storageSystem, sourceVolume.getNativeId(), cloneVolume.getNativeId(), HDSApiProtectionManager.ShadowImageOperationType.restore);
        ControllerServiceImpl.enqueueJob(new QueueJob(new HDSReplicationSyncJob(storageSystem.getId(), sourceVolume.getNativeId(), cloneVolume.getNativeId(), ReplicationStatus.PAIR, taskCompleter)));
        log.info("FINISH restoreFromSingleClone for {}", cloneURI);
    } catch (Exception e) {
        String errorMsg = String.format(RESTORE_ERROR_MSG_FORMAT, cloneURI);
        log.error(errorMsg, e);
        taskCompleter.error(dbClient, DeviceControllerException.exceptions.activateVolumeFullCopyFailed(e));
    }
}
Also used : HDSReplicationSyncJob(com.emc.storageos.volumecontroller.impl.hds.prov.job.HDSReplicationSyncJob) Volume(com.emc.storageos.db.client.model.Volume) QueueJob(com.emc.storageos.volumecontroller.impl.job.QueueJob) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) HDSException(com.emc.storageos.hds.HDSException)

Example 33 with QueueJob

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

the class AbstractCloneOperations method resyncSingleClone.

@Override
@SuppressWarnings("rawtypes")
public void resyncSingleClone(StorageSystem storageSystem, URI cloneVolume, TaskCompleter taskCompleter) {
    _log.info("START resyncSingleClone operation");
    Volume clone = null;
    try {
        callEMCRefreshIfRequired(_dbClient, _helper, storageSystem, Arrays.asList(cloneVolume));
        clone = _dbClient.queryObject(Volume.class, cloneVolume);
        URI sourceUri = clone.getAssociatedSourceVolume();
        Volume sourceObj = _dbClient.queryObject(Volume.class, sourceUri);
        StorageSystem sourceSystem = _dbClient.queryObject(StorageSystem.class, sourceObj.getStorageController());
        CIMObjectPath syncObject = _cimPath.getStorageSynchronized(sourceSystem, sourceObj, storageSystem, clone);
        CIMInstance instance = _helper.checkExists(storageSystem, syncObject, false, false);
        if (instance != null) {
            CIMArgument[] inArgs = _helper.getResyncReplicaInputArguments(syncObject);
            CIMArgument[] outArgs = new CIMArgument[5];
            _helper.callModifyReplica(storageSystem, inArgs, outArgs);
            CIMObjectPath job = _cimPath.getCimObjectPathFromOutputArgs(outArgs, SmisConstants.JOB);
            if (job != null) {
                ControllerServiceImpl.enqueueJob(new QueueJob(new SmisCloneResyncJob(job, storageSystem.getId(), taskCompleter)));
            }
        } else {
            String errorMsg = "The clone is already detached. resync will not be performed.";
            _log.info(errorMsg);
            ServiceError error = DeviceControllerErrors.smis.methodFailed("resyncSingleClone", errorMsg);
            taskCompleter.error(_dbClient, error);
        }
    } catch (Exception e) {
        String errorMsg = String.format(RESYNC_ERROR_MSG_FORMAT, cloneVolume);
        _log.error(errorMsg, e);
        taskCompleter.error(_dbClient, DeviceControllerException.exceptions.resynchronizeFullCopyFailed(e));
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) Volume(com.emc.storageos.db.client.model.Volume) SmisCloneResyncJob(com.emc.storageos.volumecontroller.impl.smis.job.SmisCloneResyncJob) CIMObjectPath(javax.cim.CIMObjectPath) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) QueueJob(com.emc.storageos.volumecontroller.impl.job.QueueJob) CIMInstance(javax.cim.CIMInstance) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) WBEMException(javax.wbem.WBEMException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem) CIMArgument(javax.cim.CIMArgument)

Example 34 with QueueJob

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

the class AbstractMirrorOperations method deleteSingleVolumeMirror.

@Override
public void deleteSingleVolumeMirror(StorageSystem storage, URI mirror, TaskCompleter taskCompleter) throws DeviceControllerException {
    _log.info("deleteSingleVolumeMirror operation START");
    try {
        BlockMirror mirrorObj = _dbClient.queryObject(BlockMirror.class, mirror);
        if (storage.checkIfVmax3()) {
            _helper.removeVolumeFromParkingSLOStorageGroup(storage, new String[] { mirrorObj.getNativeId() }, false);
            _log.info("Done invoking remove volume {} from parking SLO storage group", mirrorObj.getNativeId());
        }
        CIMObjectPath mirrorPath = _cimPath.getBlockObjectPath(storage, mirrorObj);
        CIMObjectPath configSvcPath = _cimPath.getConfigSvcPath(storage);
        CIMArgument[] inArgs = _helper.getDeleteMirrorInputArguments(storage, mirrorPath);
        CIMArgument[] outArgs = new CIMArgument[5];
        _helper.invokeMethod(storage, configSvcPath, SmisConstants.RETURN_TO_STORAGE_POOL, inArgs, outArgs);
        CIMObjectPath job = _cimPath.getCimObjectPathFromOutputArgs(outArgs, SmisConstants.JOB);
        if (job != null) {
            ControllerServiceImpl.enqueueJob(new QueueJob(new SmisBlockDeleteMirrorJob(job, storage.getId(), taskCompleter)));
        }
    } catch (Exception e) {
        _log.info("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) QueueJob(com.emc.storageos.volumecontroller.impl.job.QueueJob) SmisBlockDeleteMirrorJob(com.emc.storageos.volumecontroller.impl.smis.job.SmisBlockDeleteMirrorJob) WBEMException(javax.wbem.WBEMException) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) CIMArgument(javax.cim.CIMArgument)

Example 35 with QueueJob

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

the class AbstractMirrorOperations method createSingleVolumeMirror.

@Override
public void createSingleVolumeMirror(StorageSystem storage, URI mirror, Boolean createInactive, TaskCompleter taskCompleter) throws DeviceControllerException {
    _log.info("createSingleVolumeMirror operation START");
    try {
        BlockMirror mirrorObj = _dbClient.queryObject(BlockMirror.class, mirror);
        StoragePool targetPool = _dbClient.queryObject(StoragePool.class, mirrorObj.getPool());
        Volume source = _dbClient.queryObject(Volume.class, mirrorObj.getSource());
        TenantOrg tenant = _dbClient.queryObject(TenantOrg.class, source.getTenant().getURI());
        String tenantName = tenant.getLabel();
        String targetLabelToUse = _nameGenerator.generate(tenantName, mirrorObj.getLabel(), mirror.toString(), '-', SmisConstants.MAX_VOLUME_NAME_LENGTH);
        CIMObjectPath replicationSvcPath = _cimPath.getControllerReplicationSvcPath(storage);
        CIMArgument[] inArgs = null;
        if (storage.checkIfVmax3()) {
            CIMObjectPath volumeGroupPath = _helper.getVolumeGroupPath(storage, storage, source, targetPool);
            CIMInstance replicaSettingData = getDefaultReplicationSettingData(storage);
            inArgs = _helper.getCreateElementReplicaMirrorInputArguments(storage, source, targetPool, createInactive, targetLabelToUse, volumeGroupPath, replicaSettingData);
        } else {
            inArgs = _helper.getCreateElementReplicaMirrorInputArguments(storage, source, targetPool, createInactive, targetLabelToUse);
        }
        CIMArgument[] outArgs = new CIMArgument[5];
        _helper.invokeMethod(storage, replicationSvcPath, SmisConstants.CREATE_ELEMENT_REPLICA, inArgs, outArgs);
        CIMObjectPath job = _cimPath.getCimObjectPathFromOutputArgs(outArgs, SmisConstants.JOB);
        if (job != null) {
            ControllerServiceImpl.enqueueJob(new QueueJob(new SmisBlockCreateMirrorJob(job, storage.getId(), !createInactive, taskCompleter)));
            // Resynchronizing state applies to the initial copy as well as future
            // re-synchronization's.
            mirrorObj.setSyncState(SynchronizationState.RESYNCHRONIZING.toString());
            _dbClient.persistObject(mirrorObj);
        }
    } catch (final InternalException e) {
        _log.info("Problem making SMI-S call: ", e);
        taskCompleter.error(_dbClient, e);
    } catch (Exception e) {
        _log.info("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) StoragePool(com.emc.storageos.db.client.model.StoragePool) CIMObjectPath(javax.cim.CIMObjectPath) SmisBlockCreateMirrorJob(com.emc.storageos.volumecontroller.impl.smis.job.SmisBlockCreateMirrorJob) CIMInstance(javax.cim.CIMInstance) WBEMException(javax.wbem.WBEMException) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) Volume(com.emc.storageos.db.client.model.Volume) TenantOrg(com.emc.storageos.db.client.model.TenantOrg) QueueJob(com.emc.storageos.volumecontroller.impl.job.QueueJob) CIMArgument(javax.cim.CIMArgument)

Aggregations

DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)109 QueueJob (com.emc.storageos.volumecontroller.impl.job.QueueJob)109 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)104 Volume (com.emc.storageos.db.client.model.Volume)51 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)43 BlockSnapshot (com.emc.storageos.db.client.model.BlockSnapshot)41 CIMObjectPath (javax.cim.CIMObjectPath)41 VNXeApiClient (com.emc.storageos.vnxe.VNXeApiClient)40 VNXeCommandJob (com.emc.storageos.vnxe.models.VNXeCommandJob)40 VNXeException (com.emc.storageos.vnxe.VNXeException)36 WBEMException (javax.wbem.WBEMException)33 ControllerException (com.emc.storageos.volumecontroller.ControllerException)32 CIMArgument (javax.cim.CIMArgument)32 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)25 URI (java.net.URI)24 ArrayList (java.util.ArrayList)23 TenantOrg (com.emc.storageos.db.client.model.TenantOrg)20 Snapshot (com.emc.storageos.db.client.model.Snapshot)18 VNXeFileTaskCompleter (com.emc.storageos.volumecontroller.impl.vnxe.job.VNXeFileTaskCompleter)18 FileShare (com.emc.storageos.db.client.model.FileShare)16