Search in sources :

Example 1 with SmisCreateVmaxCGTargetVolumesJob

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

the class VmaxSnapshotOperations method createTargetDevices.

/**
 * Method will invoke the SMI-S operation to create 'count' number of VDEVs of the
 * specified capacity.
 *
 * If any errors, taskCompleter will be updated.
 *
 * Note; This method will kick off of an asynchronous job. The SmisCreateVmaxCGTargetVolumesJob
 * encapsulates this. When the task completes successfully, it will continue the
 * work of completing the snapshot operation.
 *
 * @param storage - StorageSystem where VDEVs will be created
 * @param poolPath - CIMObject representing the pool to allocate targets from
 * @param storageSetting - Setting that allows for VDEV creation
 * @param label - Name to appl to each VDEV
 * @param createInactive - whether the snapshot needs to to be created with sync_active=true/false
 * @param count - Number of VDEVs
 * @param capacity - Size of each VDEV
 * @param taskCompleter - Completer object used for task status update
 * @throws DeviceControllerException
 *
 * @return - List of native Ids
 */
private List<String> createTargetDevices(StorageSystem storage, CIMObjectPath poolPath, CIMObjectPath volumeGroupPath, CIMInstance storageSetting, String sourceGroupName, String label, Boolean createInactive, int count, long capacity, TaskCompleter taskCompleter) throws DeviceControllerException {
    _log.info(format("Creating target devices: Storage System: {0}, Consistency Group: {1}, Pool: {2}, Count: {3}", storage.getId(), sourceGroupName, poolPath, count));
    try {
        CIMObjectPath configSvcPath = _cimPath.getConfigSvcPath(storage);
        CIMArgument[] inArgs = null;
        if (storage.checkIfVmax3()) {
            inArgs = _helper.getCreateVolumesBasedOnVolumeGroupInputArguments(storage, poolPath, volumeGroupPath, label, count, capacity);
        } else {
            inArgs = _helper.getCreateVolumesBasedOnSettingInputArguments(storage, poolPath, storageSetting, label, count, capacity);
        }
        CIMArgument[] outArgs = new CIMArgument[5];
        SmisCreateVmaxCGTargetVolumesJob job = new SmisCreateVmaxCGTargetVolumesJob(null, storage.getId(), sourceGroupName, label, createInactive, taskCompleter);
        _helper.invokeMethodSynchronously(storage, configSvcPath, _helper.createVolumesMethodName(storage), inArgs, outArgs, job);
        return job.getTargetDeviceIds();
    } catch (Exception e) {
        final String errMsg = format("An error occurred when creating target devices on storage system {0}", storage.getId());
        _log.error(errMsg, e);
        taskCompleter.error(_dbClient, SmisException.errors.methodFailed(_helper.createVolumesMethodName(storage), e.getMessage()));
        throw new SmisException(errMsg, e);
    }
}
Also used : SmisCreateVmaxCGTargetVolumesJob(com.emc.storageos.volumecontroller.impl.smis.job.SmisCreateVmaxCGTargetVolumesJob) SmisException(com.emc.storageos.volumecontroller.impl.smis.SmisException) CIMObjectPath(javax.cim.CIMObjectPath) SmisException(com.emc.storageos.volumecontroller.impl.smis.SmisException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) WBEMException(javax.wbem.WBEMException) CIMArgument(javax.cim.CIMArgument)

Example 2 with SmisCreateVmaxCGTargetVolumesJob

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

the class ReplicationUtils method createTargetDevices.

/**
 * Method will invoke the SMI-S operation to create the target volumes
 *
 * @param storageSystem - StorageSystem where the pool and snapshot exist
 * @param sourceGroupName - Name of source group
 * @param label - Name to be applied to each snapshot volume
 * @param createInactive - whether the snapshot needs to to be created with sync_active=true/false
 * @param count - Number of target Volumes to create
 * @param storagePoolUri - Storage Pool to use for creation of target volumes.
 * @param capacity - Size of the Volumes to create
 * @param isThinlyProvisioned
 * @param taskCompleter - Completer object used for task status update
 * @param dbClient
 * @param helper - smisCommandHelper
 * @param cimPath - CIMObjectPathFactory
 *
 * @throws DeviceControllerException
 *
 * @returns - List of native Ids
 */
public static List<String> createTargetDevices(StorageSystem storageSystem, String sourceGroupName, String label, Boolean createInactive, int count, URI storagePoolUri, long capacity, boolean isThinlyProvisioned, Volume sourceVolume, TaskCompleter taskCompleter, DbClient dbClient, SmisCommandHelper helper, CIMObjectPathFactory cimPath) throws DeviceControllerException {
    _log.info(format("Creating target devices for: Storage System: {0}, Consistency Group: {1}, Pool: {2}, Count: {3}", storageSystem.getId(), sourceGroupName, storagePoolUri, count));
    try {
        StoragePool storagePool = dbClient.queryObject(StoragePool.class, storagePoolUri);
        CIMObjectPath configSvcPath = cimPath.getConfigSvcPath(storageSystem);
        CIMArgument[] inArgs = null;
        if (storageSystem.checkIfVmax3()) {
            CIMObjectPath volumeGroupPath = helper.getVolumeGroupPath(storageSystem, storageSystem, sourceVolume, storagePool);
            CIMObjectPath poolPath = helper.getPoolPath(storageSystem, storagePool);
            inArgs = helper.getCreateVolumesBasedOnVolumeGroupInputArguments(storageSystem, poolPath, volumeGroupPath, label, count, capacity);
        } else {
            inArgs = helper.getCreateVolumesInputArguments(storageSystem, storagePool, label, capacity, count, isThinlyProvisioned, null, true);
        }
        CIMArgument[] outArgs = new CIMArgument[5];
        SmisCreateVmaxCGTargetVolumesJob job = new SmisCreateVmaxCGTargetVolumesJob(null, storageSystem.getId(), sourceGroupName, label, createInactive, taskCompleter);
        helper.invokeMethodSynchronously(storageSystem, configSvcPath, helper.createVolumesMethodName(storageSystem), inArgs, outArgs, job);
        return job.getTargetDeviceIds();
    } catch (Exception e) {
        final String errMsg = format("An error occurred when creating target devices VMAX system {0}", storageSystem.getId());
        _log.error(errMsg, e);
        taskCompleter.error(dbClient, SmisException.errors.methodFailed(helper.createVolumesMethodName(storageSystem), e.getMessage()));
        throw new SmisException(errMsg, e);
    }
}
Also used : SmisCreateVmaxCGTargetVolumesJob(com.emc.storageos.volumecontroller.impl.smis.job.SmisCreateVmaxCGTargetVolumesJob) StoragePool(com.emc.storageos.db.client.model.StoragePool) CIMObjectPath(javax.cim.CIMObjectPath) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) WBEMException(javax.wbem.WBEMException) CIMArgument(javax.cim.CIMArgument)

Aggregations

DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)2 SmisCreateVmaxCGTargetVolumesJob (com.emc.storageos.volumecontroller.impl.smis.job.SmisCreateVmaxCGTargetVolumesJob)2 CIMArgument (javax.cim.CIMArgument)2 CIMObjectPath (javax.cim.CIMObjectPath)2 WBEMException (javax.wbem.WBEMException)2 StoragePool (com.emc.storageos.db.client.model.StoragePool)1 SmisException (com.emc.storageos.volumecontroller.impl.smis.SmisException)1