Search in sources :

Example 1 with SmisCreateMetaVolumeJob

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

the class SmisMetaVolumeOperations method bindMetaVolumeToPool.

private void bindMetaVolumeToPool(StorageSystem storageSystem, StoragePool storagePool, Volume volume, MetaVolumeTaskCompleter metaVolumeTaskCompleter, Boolean isLastJob) throws Exception {
    long thinMetaVolumePreAllocateSize = 0;
    if (volume.getThinVolumePreAllocationSize() != null && volume.getThinVolumePreAllocationSize() > 0) {
        thinMetaVolumePreAllocateSize = volume.getThinVolumePreAllocationSize();
    }
    _log.info(String.format("Bind Meta Volume to Pool Start - Array: %s, Pool: %s, %n   Volume: %s, ThinMetaVolumePreAllocateSize: %s, isLastJob: %s", storageSystem.getSerialNumber(), storagePool.getNativeId(), volume.getNativeId(), thinMetaVolumePreAllocateSize, isLastJob));
    try {
        CIMObjectPath configSvcPath = _cimPath.getConfigSvcPath(storageSystem);
        CIMArgument[] inArgs;
        // Prepare parameters and call method to bind meta head
        inArgs = _helper.getBindVolumeInputArguments(storageSystem, storagePool, volume, thinMetaVolumePreAllocateSize);
        CIMArgument[] outArgs = new CIMArgument[5];
        // SmisJob smisJobCompleter =
        // new SmisJob(null, storageSystem.getId(), metaVolumeTaskCompleter.getVolumeTaskCompleter(), "Bind volume to pool job");
        StorageSystem forProvider = _helper.getStorageSystemForProvider(storageSystem, volume);
        _log.info("Selected Provider : {}", forProvider.getNativeGuid());
        SmisJob smisJobCompleter = new SmisCreateMetaVolumeJob(null, forProvider.getId(), storagePool.getId(), volume, metaVolumeTaskCompleter, isLastJob);
        _helper.invokeMethodSynchronously(forProvider, configSvcPath, SmisConstants.EMC_BIND_ELEMENT, inArgs, outArgs, smisJobCompleter);
    } catch (WBEMException e) {
        _log.error("Problem making SMI-S call: ", e);
        ServiceError error = DeviceControllerErrors.smis.unableToCallStorageProvider(e.getMessage());
        metaVolumeTaskCompleter.getVolumeTaskCompleter().error(_dbClient, error);
        throw e;
    } catch (Exception e) {
        _log.error("Problem in bindVolumeToPool: " + volume.getLabel(), e);
        ServiceError error = DeviceControllerErrors.smis.unableToCallStorageProvider(e.getMessage());
        metaVolumeTaskCompleter.getVolumeTaskCompleter().error(_dbClient, error);
        throw e;
    } finally {
        _log.info(String.format("Bind Meta Volume to Pool End - Array:%s, Pool: %s, %n   Volume: %s", storageSystem.getSerialNumber(), storagePool.getNativeId(), volume.getNativeId()));
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) CIMObjectPath(javax.cim.CIMObjectPath) SmisCreateMetaVolumeJob(com.emc.storageos.volumecontroller.impl.smis.job.SmisCreateMetaVolumeJob) 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)

Example 2 with SmisCreateMetaVolumeJob

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

the class SmisMetaVolumeOperations method createMetaVolume.

/**
 * Create meta volume from provided meta head and meta members
 *
 * @param storageSystem storageSystem
 * @param metaHead meta head
 * @param metaMembers list of native ids of meta volume members (not including meta head)
 * @param metaType meta volume type to create, concatenate or stripe
 * @param capabilities capabilities
 * @param metaVolumeTaskCompleter task completer
 */
@Override
public void createMetaVolume(StorageSystem storageSystem, StoragePool storagePool, Volume metaHead, List<String> metaMembers, String metaType, VirtualPoolCapabilityValuesWrapper capabilities, MetaVolumeTaskCompleter metaVolumeTaskCompleter) throws Exception {
    String label = null;
    label = metaHead.getLabel();
    try {
        CIMObjectPath elementCompositionServicePath = _cimPath.getElementCompositionSvcPath(storageSystem);
        // Check if meta head is bound to pool. The binding state is not changed by create meta volume call below, so we can know in
        // advance if we need
        // to bind element after this call completes.
        CIMInstance cimVolume = null;
        CIMObjectPath volumePath = _cimPath.getBlockObjectPath(storageSystem, metaHead);
        cimVolume = _helper.getInstance(storageSystem, volumePath, false, false, new String[] { EMC_IS_BOUND });
        String isBoundStr = cimVolume.getPropertyValue(EMC_IS_BOUND).toString();
        Boolean isBound = Boolean.parseBoolean(isBoundStr);
        // When isBound is true, create meta volume job is the last job in meta volume create sequence and we can complete this task.
        // Otherwise, we can complete this task only after binding is executed.
        Boolean isLastJob = isBound;
        _log.info(String.format("Create Meta Volume Start - Array: %s, Head: %s, Type: %s %n   Members:%s, isLastJob: %s", storageSystem.getSerialNumber(), metaHead.getLabel(), metaType, metaMembers, isLastJob));
        CIMArgument[] inArgs;
        // Should not change meta head binding state.
        inArgs = _helper.getCreateMetaVolumeInputArguments(storageSystem, label, metaHead, metaMembers, metaType, false);
        CIMArgument[] outArgs = new CIMArgument[5];
        StorageSystem forProvider = _helper.getStorageSystemForProvider(storageSystem, metaHead);
        _log.info("Selected Provider : {}", forProvider.getNativeGuid());
        SmisJob smisJobCompleter = new SmisCreateMetaVolumeJob(null, forProvider.getId(), storagePool.getId(), metaHead, metaVolumeTaskCompleter, isLastJob);
        _helper.invokeMethodSynchronously(forProvider, elementCompositionServicePath, SmisConstants.CREATE_OR_MODIFY_COMPOSITE_ELEMENT, inArgs, outArgs, smisJobCompleter);
        // thin meta heads are created unbound from pool on VMAX
        if (metaVolumeTaskCompleter.getLastStepStatus() == Job.JobStatus.SUCCESS) {
            if (!isBound) {
                // Set thin meta volume preallocate size when thin meta is bound to pool
                bindMetaVolumeToPool(storageSystem, storagePool, metaHead, metaVolumeTaskCompleter, true);
            }
        }
    } catch (WBEMException e) {
        _log.error("Problem making SMI-S call: ", e);
        ServiceError error = DeviceControllerErrors.smis.unableToCallStorageProvider(e.getMessage());
        metaVolumeTaskCompleter.getVolumeTaskCompleter().error(_dbClient, error);
        throw e;
    } catch (Exception e) {
        _log.error("Problem in createMetaVolume: ", e);
        ServiceError error = DeviceControllerErrors.smis.methodFailed("createMetaVolume", e.getMessage());
        metaVolumeTaskCompleter.getVolumeTaskCompleter().error(_dbClient, error);
        throw e;
    }
    _log.info(String.format("Create 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) SmisCreateMetaVolumeJob(com.emc.storageos.volumecontroller.impl.smis.job.SmisCreateMetaVolumeJob) SmisJob(com.emc.storageos.volumecontroller.impl.smis.job.SmisJob) WBEMException(javax.wbem.WBEMException) CIMInstance(javax.cim.CIMInstance) 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)

Aggregations

StorageSystem (com.emc.storageos.db.client.model.StorageSystem)2 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)2 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)2 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)2 SmisCreateMetaVolumeJob (com.emc.storageos.volumecontroller.impl.smis.job.SmisCreateMetaVolumeJob)2 SmisJob (com.emc.storageos.volumecontroller.impl.smis.job.SmisJob)2 CIMArgument (javax.cim.CIMArgument)2 CIMObjectPath (javax.cim.CIMObjectPath)2 WBEMException (javax.wbem.WBEMException)2 CIMInstance (javax.cim.CIMInstance)1