Search in sources :

Example 1 with SmisBlockCreateSnapshotJob

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

the class VmaxSnapshotOperations method createSingleVolumeSnapshot.

/**
 * Should implement creation of a single volume snapshot. That is a volume that
 * is not in any consistency group.
 *
 * @param storage [required] - StorageSystem object representing the array
 * @param snapshot [required] - BlockSnapshot URI representing the previously created
 *            snap for the volume
 * @param createInactive - whether the snapshot needs to to be created with sync_active=true/false
 * @param readOnly - Indicates if the snapshot should be read only.
 * @param taskCompleter - TaskCompleter object used for the updating operation status.
 */
@Override
public void createSingleVolumeSnapshot(StorageSystem storage, URI snapshot, Boolean createInactive, Boolean readOnly, TaskCompleter taskCompleter) throws DeviceControllerException {
    // List of target device ids
    List<String> targetDeviceIds = null;
    try {
        BlockSnapshot snapshotObj = _dbClient.queryObject(BlockSnapshot.class, snapshot);
        _log.info("createSingleVolumeSnapshot operation START");
        Volume volume = _dbClient.queryObject(Volume.class, snapshotObj.getParent());
        // Need to terminate an restore sessions, so that we can
        // restore from the same snapshot multiple times
        terminateAnyRestoreSessionsForVolume(storage, volume, taskCompleter);
        TenantOrg tenant = _dbClient.queryObject(TenantOrg.class, volume.getTenant().getURI());
        String tenantName = tenant.getLabel();
        String snapLabelToUse = _nameGenerator.generate(tenantName, snapshotObj.getLabel(), snapshot.toString(), '-', storage.getUsingSmis80() ? SmisConstants.MAX_SMI80_SNAPSHOT_NAME_LENGTH : SmisConstants.MAX_SNAPSHOT_NAME_LENGTH);
        CIMObjectPath replicationSvcPath = _cimPath.getControllerReplicationSvcPath(storage);
        CIMArgument[] inArgs = null;
        CIMArgument[] outArgs = new CIMArgument[5];
        if (storage.checkIfVmax3()) {
            CIMObjectPath volumeGroupPath = _helper.getVolumeGroupPath(storage, storage, volume, null);
            // COP-17240: For VMAX3, we will derive the target volumes from the source volumes SRP Pool
            CIMObjectPath poolPath = _helper.getVolumeStoragePoolPath(storage, volume);
            targetDeviceIds = createTargetDevices(storage, poolPath, volumeGroupPath, null, "SingleSnapshot", snapLabelToUse, createInactive, 1, volume.getCapacity(), taskCompleter);
            CIMInstance replicaSettingData = _helper.getReplicationSettingData(storage, targetDeviceIds.get(0), false);
            inArgs = _helper.getCreateElementReplicaSnapInputArgumentsWithTargetAndSetting(storage, volume, targetDeviceIds.get(0), replicaSettingData, createInactive, snapLabelToUse);
        } else {
            if (volume.getThinlyProvisioned()) {
                CIMInstance replicationSetting = ReplicationUtils.getVPSnapReplicationSetting(storage, _helper, _cimPath);
                inArgs = _helper.getCreateElementReplicaVPSnapInputArguments(storage, volume, createInactive, snapLabelToUse, replicationSetting);
            } else {
                inArgs = _helper.getCreateElementReplicaSnapInputArguments(storage, volume, createInactive, snapLabelToUse);
            }
        }
        _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 SmisBlockCreateSnapshotJob(job, storage.getId(), !createInactive, taskCompleter)));
        }
    } catch (Exception e) {
        _log.info("Problem making SMI-S call: ", e);
        ServiceError error = DeviceControllerErrors.smis.unableToCallStorageProvider(e.getMessage());
        taskCompleter.error(_dbClient, error);
        setInactive(snapshot, true);
        // Roll back changes
        if (storage.checkIfVmax3()) {
            rollbackCreateSnapshot(storage, null, targetDeviceIds, taskCompleter);
        }
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) SmisBlockCreateSnapshotJob(com.emc.storageos.volumecontroller.impl.smis.job.SmisBlockCreateSnapshotJob) BlockSnapshot(com.emc.storageos.db.client.model.BlockSnapshot) CIMObjectPath(javax.cim.CIMObjectPath) CIMInstance(javax.cim.CIMInstance) SmisException(com.emc.storageos.volumecontroller.impl.smis.SmisException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) WBEMException(javax.wbem.WBEMException) 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)

Example 2 with SmisBlockCreateSnapshotJob

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

the class AbstractSnapshotOperations method createSingleVolumeSnapshot.

/**
 * Should implement creation of a single volume snapshot. That is a volume that
 * is not in any consistency group.
 *
 * @param storage [required] - StorageSystem object representing the array
 * @param snapshot [required] - BlockSnapshot URI representing the previously created
 *            snap for the volume
 * @param createInactive - Indicates if the snapshots should be created but not
 *            activated
 * @param readOnly - Indicates if the snapshot should be read only.
 * @param taskCompleter - TaskCompleter object used for the updating operation status.
 */
@Override
public void createSingleVolumeSnapshot(StorageSystem storage, URI snapshot, Boolean createInactive, Boolean readOnly, TaskCompleter taskCompleter) throws DeviceControllerException {
    try {
        BlockSnapshot snapshotObj = _dbClient.queryObject(BlockSnapshot.class, snapshot);
        _log.info("createSingleVolumeSnapshot operation START");
        Volume volume = _dbClient.queryObject(Volume.class, snapshotObj.getParent());
        TenantOrg tenant = _dbClient.queryObject(TenantOrg.class, volume.getTenant().getURI());
        String tenantName = tenant.getLabel();
        String snapLabelToUse = _nameGenerator.generate(tenantName, snapshotObj.getLabel(), snapshot.toString(), '-', SmisConstants.MAX_SNAPSHOT_NAME_LENGTH);
        CIMObjectPath replicationSvcPath = _cimPath.getControllerReplicationSvcPath(storage);
        CIMArgument[] inArgs = _helper.getCreateElementReplicaSnapInputArguments(storage, volume, createInactive, snapLabelToUse);
        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 SmisBlockCreateSnapshotJob(job, storage.getId(), !createInactive, taskCompleter)));
        }
    } catch (Exception e) {
        _log.info("Problem making SMI-S call: ", e);
        ServiceError error = DeviceControllerErrors.smis.unableToCallStorageProvider(e.getMessage());
        taskCompleter.error(_dbClient, error);
        setInactive(snapshot, true);
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) Volume(com.emc.storageos.db.client.model.Volume) SmisBlockCreateSnapshotJob(com.emc.storageos.volumecontroller.impl.smis.job.SmisBlockCreateSnapshotJob) BlockSnapshot(com.emc.storageos.db.client.model.BlockSnapshot) TenantOrg(com.emc.storageos.db.client.model.TenantOrg) CIMObjectPath(javax.cim.CIMObjectPath) QueueJob(com.emc.storageos.volumecontroller.impl.job.QueueJob) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) CIMArgument(javax.cim.CIMArgument)

Aggregations

BlockSnapshot (com.emc.storageos.db.client.model.BlockSnapshot)2 TenantOrg (com.emc.storageos.db.client.model.TenantOrg)2 Volume (com.emc.storageos.db.client.model.Volume)2 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)2 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)2 QueueJob (com.emc.storageos.volumecontroller.impl.job.QueueJob)2 SmisBlockCreateSnapshotJob (com.emc.storageos.volumecontroller.impl.smis.job.SmisBlockCreateSnapshotJob)2 CIMArgument (javax.cim.CIMArgument)2 CIMObjectPath (javax.cim.CIMObjectPath)2 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)1 SmisException (com.emc.storageos.volumecontroller.impl.smis.SmisException)1 CIMInstance (javax.cim.CIMInstance)1 WBEMException (javax.wbem.WBEMException)1