Search in sources :

Example 1 with MetaVolumeTaskCompleter

use of com.emc.storageos.volumecontroller.impl.block.taskcompleter.MetaVolumeTaskCompleter in project coprhd-controller by CoprHD.

the class SmisStorageDevice method doCreateMetaVolume.

@Override
public void doCreateMetaVolume(final StorageSystem storageSystem, final StoragePool storagePool, Volume volume, final VirtualPoolCapabilityValuesWrapper capabilities, final MetaVolumeRecommendation recommendation, final VolumeCreateCompleter taskCompleter) throws DeviceControllerException {
    StringBuilder logMsgBuilder = new StringBuilder(String.format("Create Meta Volume Start - Array:%s, Pool:%s %n    Volume: %s, id: %s", storageSystem.getSerialNumber(), storagePool.getNativeId(), volume.getLabel(), volume.getId()));
    _log.info(logMsgBuilder.toString());
    boolean isThinlyProvisioned = volume.getThinlyProvisioned();
    String metaVolumeType = volume.getCompositionType();
    long metaMemberCapacity = volume.getMetaMemberSize();
    int metaMemberCount = volume.getMetaMemberCount();
    MetaVolumeTaskCompleter metaVolumeTaskCompleter = new MetaVolumeTaskCompleter(taskCompleter);
    _log.info(String.format("Start of steps to create meta volume: %s, \n   volume ID: %s" + "\n   type: %s, member count: %s, member size: %s. isThinlyProvisioned: %s", volume.getLabel(), volume.getId(), metaVolumeType, metaMemberCount, metaMemberCapacity, isThinlyProvisioned));
    try {
        // Step 1: Create meta volume head
        // Create meta volume head as bound to pool
        _metaVolumeOperations.createMetaVolumeHead(storageSystem, storagePool, volume, metaMemberCapacity, capabilities, metaVolumeTaskCompleter);
        // Step 2: Create meta members
        // Create members as unbound to pool (SMI-S requirement)
        List<String> metaMembers = null;
        if (metaVolumeTaskCompleter.getLastStepStatus() == Job.JobStatus.SUCCESS) {
            metaMembers = _metaVolumeOperations.createMetaVolumeMembers(storageSystem, storagePool, volume, metaMemberCount - 1, metaMemberCapacity, metaVolumeTaskCompleter);
        }
        // Step 3: Create meta volume from the head and meta members
        if (metaVolumeTaskCompleter.getLastStepStatus() == Job.JobStatus.SUCCESS) {
            // Get updated volume ( we need to know its nativeId) which was set in Step 1.
            Volume metaHead = _dbClient.queryObject(Volume.class, volume.getId());
            _metaVolumeOperations.createMetaVolume(storageSystem, storagePool, metaHead, metaMembers, metaVolumeType, capabilities, metaVolumeTaskCompleter);
        }
    } catch (Exception e) {
        _log.error("Problem in doCreateMetaVolume: failed to create meta volume " + volume.getLabel() + " .", e);
    } finally {
        _log.info(String.format("End of steps to create meta volume: %s, \n   volume ID: %s" + "\n   type: %s, member count: %s, member size: %s. isThinlyProvisioned: %s", volume.getLabel(), volume.getId(), metaVolumeType, metaMemberCount, metaMemberCapacity, isThinlyProvisioned));
    }
    // Get updated volume ( we need to know its nativeId) which was set in Step 1.
    volume = _dbClient.queryObject(Volume.class, volume.getId());
    logMsgBuilder = new StringBuilder(String.format("Create Meta Volume End - Array:%s, Pool:%s%n    Volume: %s, id: %s, nativeID: %s", storageSystem.getSerialNumber(), storagePool.getNativeId(), volume.getLabel(), volume.getId(), volume.getNativeId()));
    _log.info(logMsgBuilder.toString());
}
Also used : Volume(com.emc.storageos.db.client.model.Volume) MetaVolumeTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.MetaVolumeTaskCompleter) PrefixConstraint(com.emc.storageos.db.client.constraint.PrefixConstraint) AlternateIdConstraint(com.emc.storageos.db.client.constraint.AlternateIdConstraint) ContainmentConstraint(com.emc.storageos.db.client.constraint.ContainmentConstraint) 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)

Example 2 with MetaVolumeTaskCompleter

use of com.emc.storageos.volumecontroller.impl.block.taskcompleter.MetaVolumeTaskCompleter in project coprhd-controller by CoprHD.

the class HDSStorageDevice method doExpandAsMetaVolume.

/*
     * (non-Javadoc)
     * 
     * @see com.emc.storageos.volumecontroller.BlockStorageDevice#doExpandAsMetaVolume(com.emc.storageos.db.client.model.StorageSystem,
     * com.emc.storageos.db.client.model.StoragePool, com.emc.storageos.db.client.model.Volume, long,
     * com.emc.storageos.volumecontroller.impl.smis.MetaVolumeRecommendation, com.emc.storageos.volumecontroller.TaskCompleter)
     */
@Override
public void doExpandAsMetaVolume(StorageSystem storageSystem, StoragePool storagePool, Volume metaHead, long size, MetaVolumeRecommendation recommendation, VolumeExpandCompleter volumeCompleter) throws DeviceControllerException {
    StringBuilder logMsgBuilder = new StringBuilder(String.format("Expand Meta Volume Start - Array:%s, Pool:%s %n Volume: %s, id: %s", storageSystem.getSerialNumber(), storagePool.getNativeId(), metaHead.getLabel(), metaHead.getId()));
    log.info(logMsgBuilder.toString());
    long metaMemberCapacity = recommendation.getMetaMemberSize();
    int metaMemberCount = (int) recommendation.getMetaMemberCount();
    MetaVolumeTaskCompleter metaVolumeTaskCompleter = new MetaVolumeTaskCompleter(volumeCompleter);
    try {
        // Step 1: create meta members.
        List<String> newMetaMembers = metaVolumeOperations.createMetaVolumeMembers(storageSystem, storagePool, metaHead, metaMemberCount, metaMemberCapacity, metaVolumeTaskCompleter);
        log.info("ldevMetaMembers created successfully: {}", newMetaMembers);
        if (metaVolumeTaskCompleter.getLastStepStatus() == Job.JobStatus.SUCCESS) {
            metaVolumeOperations.expandMetaVolume(storageSystem, storagePool, metaHead, newMetaMembers, metaVolumeTaskCompleter);
        } else {
            ServiceError serviceError = DeviceControllerErrors.hds.jobFailed("LDEV Meta Member creation failed");
            volumeCompleter.error(dbClient, serviceError);
        }
    } catch (final InternalException e) {
        log.error("Problem in doExpandAsMetaVolume: ", e);
        volumeCompleter.error(dbClient, e);
    } catch (final Exception e) {
        log.error("Problem in doExpandAsMetaVolume: ", e);
        ServiceError serviceError = DeviceControllerErrors.hds.methodFailed("doExpandAsMetaVolume", e.getMessage());
        volumeCompleter.error(dbClient, serviceError);
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) MetaVolumeTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.MetaVolumeTaskCompleter) AlternateIdConstraint(com.emc.storageos.db.client.constraint.AlternateIdConstraint) 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) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException)

Example 3 with MetaVolumeTaskCompleter

use of com.emc.storageos.volumecontroller.impl.block.taskcompleter.MetaVolumeTaskCompleter in project coprhd-controller by CoprHD.

the class SmisStorageDevice method doExpandAsMetaVolume.

@Override
public void doExpandAsMetaVolume(final StorageSystem storageSystem, final StoragePool storagePool, final Volume volume, final long size, final MetaVolumeRecommendation recommendation, VolumeExpandCompleter volumeCompleter) {
    // To expand a volume as meta volume we need to execute sequence of two SMI-S requests.
    // First, we need to create required number of meta members to supply capacity.
    // Second step depends if input volume is a meta volume or a regular volume.
    // If input volume is a regular volume, we need to create a new meta volume with input
    // volume as its meta head.
    // If input volume is already a meta volume, we need to add new meta members to this volume.
    StringBuilder logMsgBuilder = new StringBuilder(String.format("Expand Meta Volume Start - Array:%s, Pool:%s %n    Volume: %s, id: %s", storageSystem.getSerialNumber(), storagePool.getNativeId(), volume.getLabel(), volume.getId()));
    _log.info(logMsgBuilder.toString());
    String recommendedMetaVolumeType = recommendation.getMetaVolumeType().toString();
    String expansionType = null;
    long metaMemberCapacity = recommendation.getMetaMemberSize();
    int metaMemberCount = (int) recommendation.getMetaMemberCount();
    MetaVolumeTaskCompleter metaVolumeTaskCompleter = new MetaVolumeTaskCompleter(volumeCompleter);
    try {
        boolean tagSet = _helper.doApplyRecoverPointTag(storageSystem, volume, false);
        if (!tagSet) {
            TaskCompleter taskCompleter = metaVolumeTaskCompleter.getVolumeTaskCompleter();
            ServiceError error = DeviceControllerErrors.smis.errorSettingRecoverPointTag("disable");
            taskCompleter.error(_dbClient, error);
            return;
        }
        // First of all check if we need to do cleanup of dangling meta volumes left from previous failed
        // expand attempt (may happen when rollback of expand failed due to smis connection issues -- typically
        // cleanup
        // is done by expand rollback)
        boolean cleanupSuccess = cleanupDanglingMetaMembers(storageSystem, volume);
        if (!cleanupSuccess) {
            // Failed to cleanup dangling meta members: probably still smis issues. Do not expand at this time.
            String errorMessage = String.format("Failed to delete meta volume: %s ,  nativeId: %s . \n" + " Could not cleanup dangling meta members.", volume.getId(), volume.getNativeId());
            ServiceError error = DeviceControllerErrors.smis.methodFailed("doExpandAsMetaVolume", errorMessage);
            TaskCompleter taskCompleter = metaVolumeTaskCompleter.getVolumeTaskCompleter();
            taskCompleter.error(_dbClient, error);
            _log.error(String.format(errorMessage));
            return;
        }
        // Check if this is zero-capacity extension to cleanup dangling meta members.
        if (size == volume.getCapacity()) {
            // This is zero-capacity expansion executed as recovery to cleanup dangling meta members from previous
            // expand failure
            _log.info(String.format("Zero-capacity expansion completed. Array: %s Pool:%s Volume:%s, Capacity: %s  ", storageSystem.getId(), storagePool.getId(), volume.getId(), volume.getCapacity()));
            TaskCompleter taskCompleter = metaVolumeTaskCompleter.getVolumeTaskCompleter();
            taskCompleter.ready(_dbClient);
            return;
        }
        // Check if this is expansion within current total capacity of meta members
        if (recommendation.getMetaMemberCount() == 0) {
            volume.setCapacity(size);
            _dbClient.updateObject(volume);
            _log.info(String.format("Expanded volume within its total meta volume capacity (simple case) - Array: %s Pool:%s, \n" + " Volume: %s, IsMetaVolume: %s, Total meta volume capacity: %s, NewSize: %s", storageSystem.getId(), storagePool.getId(), volume.getId(), volume.getIsComposite(), volume.getTotalMetaMemberCapacity(), volume.getCapacity()));
            TaskCompleter taskCompleter = metaVolumeTaskCompleter.getVolumeTaskCompleter();
            taskCompleter.ready(_dbClient);
            return;
        }
        // Check if we can expand volume using recommended meta volume type:
        // On VMAX striped meta can be formed only when meta head is in unbound from pool.
        // This is our assumption for now --- some ucode versions support case when meta head is bound to pool when
        // striped meta volume
        // is formed.
        expansionType = _metaVolumeOperations.defineExpansionType(storageSystem, volume, recommendedMetaVolumeType, metaVolumeTaskCompleter);
        _log.info(String.format("Meta volume type used for expansion: %s, recommended meta volume type: %s", expansionType, recommendedMetaVolumeType));
        // update expansion type in completer
        volumeCompleter.setMetaVolumeType(expansionType);
        _log.info(String.format("Start of steps to expand volume as meta volume: %s, \n   volume ID: %s" + "\n   expansion type: %s, new member count: %s, member size: %s, is already meta volume: %s .", volume.getLabel(), volume.getId(), expansionType, metaMemberCount, metaMemberCapacity, volume.getIsComposite()));
        // Step 1: Create new meta members
        // Create members as unbound to pool (SMI-S requirement)
        List<String> metaMembers = null;
        metaMembers = _metaVolumeOperations.createMetaVolumeMembers(storageSystem, storagePool, volume, metaMemberCount, metaMemberCapacity, metaVolumeTaskCompleter);
        if (metaVolumeTaskCompleter.getLastStepStatus() == Job.JobStatus.SUCCESS) {
            if (volume.getIsComposite()) {
                // Step 2: Expand meta volume with meta members used for expansion
                _metaVolumeOperations.expandMetaVolume(storageSystem, storagePool, volume, metaMembers, metaVolumeTaskCompleter);
                // Step 3: Delete BCV helper volume from array. Required only for vmax.
                if (expansionType.equals(Volume.CompositionType.STRIPED.toString()) && metaVolumeTaskCompleter.getLastStepStatus() == Job.JobStatus.SUCCESS && storageSystem.getSystemType().equalsIgnoreCase(DiscoveredDataObject.Type.vmax.toString())) {
                    _metaVolumeOperations.deleteBCVHelperVolume(storageSystem, volume);
                }
            } else {
                // Step 2: Create meta volume from the original volume (head) and meta
                // members used for expansion
                _metaVolumeOperations.expandVolumeAsMetaVolume(storageSystem, storagePool, volume, metaMembers, expansionType, metaVolumeTaskCompleter);
            }
        }
    } catch (Exception e) {
        _log.error("Problem in doExpandMetaVolumes: failed to expand meta volume " + volume.getLabel() + " .", e);
        ServiceError error = DeviceControllerErrors.smis.methodFailed("doExpandAsMetaVolume", e.getMessage());
        volumeCompleter.error(_dbClient, error);
    } finally {
        _log.info(String.format("End of steps to expand volume as meta volume: %s, \n   volume ID: %s" + "\n   type: %s, new member count: %s, member size: %s.", volume.getLabel(), volume.getId(), expansionType, metaMemberCount, metaMemberCapacity));
    }
    logMsgBuilder = new StringBuilder(String.format("Expand Volume End - Array:%s, Pool:%s%n    Volume: %s, id: %s", storageSystem.getSerialNumber(), storagePool.getNativeId(), volume.getLabel(), volume.getId()));
    _log.info(logMsgBuilder.toString());
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) MetaVolumeTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.MetaVolumeTaskCompleter) MetaVolumeTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.MetaVolumeTaskCompleter) VolumeTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.VolumeTaskCompleter) TaskCompleter(com.emc.storageos.volumecontroller.TaskCompleter) MultiVolumeTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.MultiVolumeTaskCompleter) PrefixConstraint(com.emc.storageos.db.client.constraint.PrefixConstraint) AlternateIdConstraint(com.emc.storageos.db.client.constraint.AlternateIdConstraint) ContainmentConstraint(com.emc.storageos.db.client.constraint.ContainmentConstraint) 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)

Example 4 with MetaVolumeTaskCompleter

use of com.emc.storageos.volumecontroller.impl.block.taskcompleter.MetaVolumeTaskCompleter 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)4 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)4 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)4 MetaVolumeTaskCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.MetaVolumeTaskCompleter)4 AlternateIdConstraint (com.emc.storageos.db.client.constraint.AlternateIdConstraint)3 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)3 WBEMException (javax.wbem.WBEMException)3 ContainmentConstraint (com.emc.storageos.db.client.constraint.ContainmentConstraint)2 PrefixConstraint (com.emc.storageos.db.client.constraint.PrefixConstraint)2 Volume (com.emc.storageos.db.client.model.Volume)1 HDSException (com.emc.storageos.hds.HDSException)1 TaskCompleter (com.emc.storageos.volumecontroller.TaskCompleter)1 MultiVolumeTaskCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.MultiVolumeTaskCompleter)1 VolumeTaskCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.VolumeTaskCompleter)1 QueueJob (com.emc.storageos.volumecontroller.impl.job.QueueJob)1 SmisVolumeExpandJob (com.emc.storageos.volumecontroller.impl.smis.job.SmisVolumeExpandJob)1 CIMArgument (javax.cim.CIMArgument)1 CIMObjectPath (javax.cim.CIMObjectPath)1