Search in sources :

Example 41 with TenantOrg

use of com.emc.storageos.db.client.model.TenantOrg in project coprhd-controller by CoprHD.

the class VmaxSnapshotOperations method createGroupSnapshots.

/**
 * Should implement create of a snapshot from a source volume that is part of a
 * consistency group.
 *
 * Implementation note: In this method we will kick of the asynchronous creation
 * of the target devices required for the CG snaps. Upon the successful
 * device creation, the post operations will take place, which will include the
 * creation of the target group and the group snapshot operation.
 *
 * @param storage [required] - StorageSystem object representing the array
 * @param snapshotList [required] - BlockSnapshot URI list 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.
 * @throws DeviceControllerException
 */
@Override
public void createGroupSnapshots(StorageSystem storage, List<URI> snapshotList, Boolean createInactive, Boolean readOnly, TaskCompleter taskCompleter) throws DeviceControllerException {
    _log.info("START createGroupSnapshots");
    // Target group CIM Path
    CIMObjectPath targetGroupPath = null;
    // List of target device ids
    List<String> targetDeviceIds = null;
    // The source consistency group name
    String sourceGroupName = null;
    try {
        final BlockSnapshot first = _dbClient.queryObject(BlockSnapshot.class, snapshotList.get(0));
        sourceGroupName = ConsistencyGroupUtils.getSourceConsistencyGroupName(first, _dbClient);
        Volume snapVolume = _dbClient.queryObject(Volume.class, first.getParent());
        boolean thinProvisioning = snapVolume.getThinlyProvisioned() != null && snapVolume.getThinlyProvisioned();
        TenantOrg tenant = _dbClient.queryObject(TenantOrg.class, snapVolume.getTenant().getURI());
        String tenantName = tenant.getLabel();
        final String snapLabelToUse = _nameGenerator.generate(tenantName, first.getLabel(), snapshotList.get(0).toString(), '-', storage.getUsingSmis80() ? SmisConstants.MAX_SMI80_SNAPSHOT_NAME_LENGTH : SmisConstants.MAX_SNAPSHOT_NAME_LENGTH);
        // CTRL-5640: ReplicationGroup may not be accessible after provider fail-over.
        ReplicationUtils.checkReplicationGroupAccessibleOrFail(storage, first, _dbClient, _helper, _cimPath);
        final Map<String, List<Volume>> volumesBySizeMap = new HashMap<String, List<Volume>>();
        // Group volumes by pool and size
        for (URI uri : snapshotList) {
            final BlockSnapshot snapshot = _dbClient.queryObject(BlockSnapshot.class, uri);
            final Volume volume = _dbClient.queryObject(Volume.class, snapshot.getParent().getURI());
            final String key = volume.getPool() + "-" + volume.getCapacity();
            final List<Volume> currentVolumes = volumesBySizeMap.containsKey(key) ? volumesBySizeMap.get(key) : new ArrayList<Volume>();
            currentVolumes.add(volume);
            volumesBySizeMap.put(key, currentVolumes);
        }
        // For VMAX3, we need the target group to tag the setting instance
        if (storage.checkIfVmax3() || !storage.getUsingSmis80()) {
            targetDeviceIds = new ArrayList<String>();
            for (Entry<String, List<Volume>> entry : volumesBySizeMap.entrySet()) {
                final List<Volume> volumes = entry.getValue();
                final Volume volume = volumes.get(0);
                final URI poolId = volume.getPool();
                CIMObjectPath volumeGroupPath = _helper.getVolumeGroupPath(storage, storage, volume, null);
                // Create target devices based on the array model
                final List<String> newDeviceIds = kickOffTargetDevicesCreation(storage, volumeGroupPath, sourceGroupName, snapLabelToUse, createInactive, thinProvisioning, volumes.size(), poolId, volume.getCapacity(), taskCompleter);
                targetDeviceIds.addAll(newDeviceIds);
            }
            // Create target device group
            targetGroupPath = ReplicationUtils.createTargetDeviceGroup(storage, sourceGroupName, targetDeviceIds, taskCompleter, _dbClient, _helper, _cimPath, SYNC_TYPE.SNAPSHOT);
        }
        // Create CG snapshot
        CIMObjectPath job = VmaxGroupOperationsUtils.internalCreateGroupReplica(storage, sourceGroupName, snapLabelToUse, targetGroupPath, createInactive, thinProvisioning, taskCompleter, SYNC_TYPE.SNAPSHOT, _dbClient, _helper, _cimPath);
        if (job != null) {
            ControllerServiceImpl.enqueueJob(new QueueJob(new SmisBlockCreateCGSnapshotJob(job, storage.getId(), !createInactive, sourceGroupName, taskCompleter)));
        }
    } catch (Exception e) {
        final String errMsg = format("An exception occurred when trying to create snapshots for consistency group {0} on storage system {1}", sourceGroupName, storage.getId());
        _log.error(errMsg, e);
        ServiceError error = DeviceControllerErrors.smis.methodFailed("createGroupSnapshots", e.getMessage());
        taskCompleter.error(_dbClient, error);
        // Roll back changes
        rollbackCreateSnapshot(storage, targetGroupPath, targetDeviceIds, taskCompleter);
        throw new SmisException(errMsg, e);
    }
}
Also used : SmisException(com.emc.storageos.volumecontroller.impl.smis.SmisException) ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) HashMap(java.util.HashMap) CIMObjectPath(javax.cim.CIMObjectPath) BlockSnapshot(com.emc.storageos.db.client.model.BlockSnapshot) URI(java.net.URI) 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) Lists.newArrayList(com.google.common.collect.Lists.newArrayList) NamedElementQueryResultList(com.emc.storageos.db.client.constraint.NamedElementQueryResultList) ArrayList(java.util.ArrayList) List(java.util.List) SmisBlockCreateCGSnapshotJob(com.emc.storageos.volumecontroller.impl.smis.job.SmisBlockCreateCGSnapshotJob) QueueJob(com.emc.storageos.volumecontroller.impl.job.QueueJob)

Example 42 with TenantOrg

use of com.emc.storageos.db.client.model.TenantOrg 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 43 with TenantOrg

use of com.emc.storageos.db.client.model.TenantOrg in project coprhd-controller by CoprHD.

the class VnxSnapshotOperations method createGroupSnapshots.

/**
 * Should implement create of a snapshot from a source volume that is part of a
 * 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.
 * @throws DeviceControllerException
 */
@Override
public void createGroupSnapshots(StorageSystem storage, List<URI> snapshotList, Boolean createInactive, Boolean readOnly, TaskCompleter taskCompleter) throws DeviceControllerException {
    try {
        URI snapshot = snapshotList.get(0);
        BlockSnapshot snapshotObj = _dbClient.queryObject(BlockSnapshot.class, snapshot);
        Volume volume = _dbClient.queryObject(Volume.class, snapshotObj.getParent());
        if (ControllerUtils.isNotInRealVNXRG(volume, _dbClient)) {
            throw DeviceControllerException.exceptions.groupSnapshotNotSupported(volume.getReplicationGroupInstance());
        }
        // CTRL-5640: ReplicationGroup may not be accessible after provider fail-over.
        ReplicationUtils.checkReplicationGroupAccessibleOrFail(storage, snapshotObj, _dbClient, _helper, _cimPath);
        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);
        String groupName = ConsistencyGroupUtils.getSourceConsistencyGroupName(snapshotObj, _dbClient);
        CIMObjectPath cgPath = _cimPath.getReplicationGroupPath(storage, groupName);
        CIMObjectPath replicationSvc = _cimPath.getControllerReplicationSvcPath(storage);
        CIMArgument[] inArgs = _helper.getCreateGroupReplicaInputArgumentsForVNX(storage, cgPath, createInactive, snapLabelToUse, SYNC_TYPE.SNAPSHOT.getValue());
        CIMArgument[] outArgs = new CIMArgument[5];
        _helper.invokeMethod(storage, replicationSvc, SmisConstants.CREATE_GROUP_REPLICA, inArgs, outArgs);
        CIMObjectPath job = _cimPath.getCimObjectPathFromOutputArgs(outArgs, SmisConstants.JOB);
        if (job != null) {
            ControllerServiceImpl.enqueueJob(new QueueJob(new SmisBlockCreateCGSnapshotJob(job, storage.getId(), !createInactive, null, taskCompleter)));
        }
    } catch (Exception e) {
        _log.info("Problem making SMI-S call: ", e);
        ServiceError error = DeviceControllerErrors.smis.unableToCallStorageProvider(e.getMessage());
        taskCompleter.error(_dbClient, error);
        setInactive(((BlockSnapshotCreateCompleter) taskCompleter).getSnapshotURIs(), true);
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) BlockSnapshot(com.emc.storageos.db.client.model.BlockSnapshot) CIMObjectPath(javax.cim.CIMObjectPath) URI(java.net.URI) BlockSnapshotCreateCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockSnapshotCreateCompleter) WBEMException(javax.wbem.WBEMException) WorkflowException(com.emc.storageos.workflow.WorkflowException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) Volume(com.emc.storageos.db.client.model.Volume) TenantOrg(com.emc.storageos.db.client.model.TenantOrg) SmisBlockCreateCGSnapshotJob(com.emc.storageos.volumecontroller.impl.smis.job.SmisBlockCreateCGSnapshotJob) QueueJob(com.emc.storageos.volumecontroller.impl.job.QueueJob) CIMArgument(javax.cim.CIMArgument)

Example 44 with TenantOrg

use of com.emc.storageos.db.client.model.TenantOrg in project coprhd-controller by CoprHD.

the class SmisStorageDevice method doCreateVolumes.

@Override
public void doCreateVolumes(final StorageSystem storageSystem, final StoragePool storagePool, final String opId, final List<Volume> volumes, final VirtualPoolCapabilityValuesWrapper capabilities, final TaskCompleter taskCompleter) throws DeviceControllerException {
    String label = null;
    Long capacity = null;
    Long thinVolumePreAllocationSize = null;
    CIMInstance poolSetting = null;
    boolean opCreationFailed = false;
    StringBuilder logMsgBuilder = new StringBuilder(String.format("Create Volume Start - Array:%s, Pool:%s", storageSystem.getSerialNumber(), storagePool.getNativeGuid()));
    StorageSystem forProvider = _helper.getStorageSystemForProvider(storageSystem, volumes.get(0));
    // volumeGroupObjectPath is required for VMAX3
    CIMObjectPath volumeGroupObjectPath = _helper.getVolumeGroupPath(forProvider, storageSystem, volumes.get(0), storagePool);
    List<String> volumeLabels = new ArrayList<>();
    for (Volume volume : volumes) {
        logMsgBuilder.append(String.format("%nVolume:%s , IsThinlyProvisioned: %s", volume.getLabel(), volume.getThinlyProvisioned()));
        String tenantName = "";
        try {
            TenantOrg tenant = _dbClient.queryObject(TenantOrg.class, volume.getTenant().getURI());
            tenantName = tenant.getLabel();
        } catch (DatabaseException e) {
            _log.error("Error lookup TenantOrb object", e);
        }
        label = _nameGenerator.generate(tenantName, volume.getLabel(), volume.getId().toString(), '-', SmisConstants.MAX_VOLUME_NAME_LENGTH);
        volumeLabels.add(label);
        if (capacity == null) {
            capacity = volume.getCapacity();
        }
        if (thinVolumePreAllocationSize == null && volume.getThinVolumePreAllocationSize() > 0) {
            thinVolumePreAllocationSize = volume.getThinVolumePreAllocationSize();
        }
    }
    _log.info(logMsgBuilder.toString());
    boolean isThinlyProvisioned = volumes.get(0).getThinlyProvisioned();
    try {
        CIMObjectPath configSvcPath = _cimPath.getConfigSvcPath(storageSystem);
        CIMArgument[] inArgs = null;
        // I didn't find any ways to add this branching logic based on device Types.
        if (DiscoveredDataObject.Type.vnxblock.toString().equalsIgnoreCase(storageSystem.getSystemType())) {
            String autoTierPolicyName = ControllerUtils.getAutoTieringPolicyName(volumes.get(0).getId(), _dbClient);
            if (autoTierPolicyName.equals(Constants.NONE)) {
                autoTierPolicyName = null;
            }
            inArgs = _helper.getCreateVolumesInputArgumentsOnFastEnabledPool(storageSystem, storagePool, volumeLabels, capacity, volumes.size(), isThinlyProvisioned, autoTierPolicyName);
        } else {
            if (!storageSystem.checkIfVmax3() && isThinlyProvisioned && null != thinVolumePreAllocationSize) {
                poolSetting = _smisStorageDevicePreProcessor.createStoragePoolSetting(storageSystem, storagePool, thinVolumePreAllocationSize);
            }
            if (storageSystem.checkIfVmax3()) {
                inArgs = _helper.getCreateVolumesInputArguments(storageSystem, storagePool, volumeLabels, capacity, volumes.size(), isThinlyProvisioned, true, volumeGroupObjectPath, (null != thinVolumePreAllocationSize));
            } else {
                inArgs = _helper.getCreateVolumesInputArguments(storageSystem, storagePool, volumeLabels, capacity, volumes.size(), isThinlyProvisioned, poolSetting, true);
            }
        }
        CIMArgument[] outArgs = new CIMArgument[5];
        _helper.invokeMethod(forProvider, configSvcPath, _helper.createVolumesMethodName(forProvider), inArgs, outArgs);
        CIMObjectPath job = _cimPath.getCimObjectPathFromOutputArgs(outArgs, SmisConstants.JOB);
        if (job != null) {
            SmisJob createSmisJob = volumes.size() > 1 ? new SmisCreateMultiVolumeJob(job, forProvider.getId(), storagePool.getId(), volumes.size(), taskCompleter) : new SmisCreateVolumeJob(job, forProvider.getId(), storagePool.getId(), taskCompleter);
            ControllerServiceImpl.enqueueJob(new QueueJob(createSmisJob));
        }
    } catch (final InternalException e) {
        _log.error("Problem in doCreateVolumes: ", e);
        opCreationFailed = true;
        taskCompleter.error(_dbClient, e);
    } catch (WBEMException e) {
        _log.error("Problem making SMI-S call: ", e);
        opCreationFailed = true;
        ServiceError serviceError = DeviceControllerErrors.smis.unableToCallStorageProvider(e.getMessage());
        taskCompleter.error(_dbClient, serviceError);
    } catch (Exception e) {
        _log.error("Problem in doCreateVolumes: ", e);
        opCreationFailed = true;
        ServiceError serviceError = DeviceControllerErrors.smis.methodFailed("doCreateVolumes", e.getMessage());
        taskCompleter.error(_dbClient, serviceError);
    }
    if (opCreationFailed) {
        for (Volume vol : volumes) {
            vol.setInactive(true);
            _dbClient.updateObject(vol);
        }
    }
    logMsgBuilder = new StringBuilder(String.format("Create Volumes End - Array:%s, Pool:%s", storageSystem.getSerialNumber(), storagePool.getNativeGuid()));
    for (Volume volume : volumes) {
        logMsgBuilder.append(String.format("%nVolume:%s", volume.getLabel()));
    }
    _log.info(logMsgBuilder.toString());
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) CIMObjectPath(javax.cim.CIMObjectPath) ArrayList(java.util.ArrayList) WBEMException(javax.wbem.WBEMException) CIMInstance(javax.cim.CIMInstance) 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) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) SmisCreateVolumeJob(com.emc.storageos.volumecontroller.impl.smis.job.SmisCreateVolumeJob) Volume(com.emc.storageos.db.client.model.Volume) SmisCreateMultiVolumeJob(com.emc.storageos.volumecontroller.impl.smis.job.SmisCreateMultiVolumeJob) TenantOrg(com.emc.storageos.db.client.model.TenantOrg) SmisJob(com.emc.storageos.volumecontroller.impl.smis.job.SmisJob) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) QueueJob(com.emc.storageos.volumecontroller.impl.job.QueueJob) StorageSystem(com.emc.storageos.db.client.model.StorageSystem) CIMArgument(javax.cim.CIMArgument)

Example 45 with TenantOrg

use of com.emc.storageos.db.client.model.TenantOrg in project coprhd-controller by CoprHD.

the class XIVCloneOperations method createSingleClone.

@SuppressWarnings("rawtypes")
@Override
public void createSingleClone(StorageSystem storageSystem, URI sourceVolume, URI cloneVolume, Boolean createInactive, TaskCompleter taskCompleter) {
    _log.info("START createSingleClone operation");
    SmisException serviceCode = null;
    CIMArgument[] outArgs = new CIMArgument[5];
    try {
        BlockObject sourceObj = BlockObject.fetch(_dbClient, sourceVolume);
        URI tenantUri = null;
        if (sourceObj instanceof BlockSnapshot) {
            // In case of snapshot, get the tenant from its parent volume
            NamedURI parentVolUri = ((BlockSnapshot) sourceObj).getParent();
            Volume parentVolume = _dbClient.queryObject(Volume.class, parentVolUri);
            tenantUri = parentVolume.getTenant().getURI();
        } else {
            tenantUri = ((Volume) sourceObj).getTenant().getURI();
        }
        Volume cloneObj = _dbClient.queryObject(Volume.class, cloneVolume);
        StoragePool targetPool = _dbClient.queryObject(StoragePool.class, cloneObj.getPool());
        TenantOrg tenantOrg = _dbClient.queryObject(TenantOrg.class, tenantUri);
        String cloneLabel = _nameGenerator.generate(tenantOrg.getLabel(), cloneObj.getLabel(), cloneObj.getId().toString(), '-', SmisConstants.MAX_VOLUME_NAME_LENGTH);
        CIMObjectPath sourceVolumePath = _cimPath.getBlockObjectPath(storageSystem, sourceObj);
        CIMArgument[] inArgs = _helper.getCloneInputArguments(cloneLabel, sourceVolumePath, storageSystem, targetPool, createInactive);
        _helper.callReplicationSvc(storageSystem, SmisConstants.CREATE_ELEMENT_REPLICA, inArgs, outArgs);
    } catch (Exception e) {
        String errorMsg = String.format(CREATE_ERROR_MSG_FORMAT, sourceVolume, cloneVolume);
        _log.error(errorMsg, e);
        serviceCode = DeviceControllerExceptions.smis.createFullCopyFailure(errorMsg, e);
    } finally {
        try {
            // update clone and pool
            // clone will be set to inactive if no return from provider
            _smisStorageDevicePostProcessor.processCloneCreation(storageSystem, cloneVolume, outArgs, (CloneCreateCompleter) taskCompleter);
        } catch (Exception e) {
            String errorMsg = "Exception on creating clone of " + sourceVolume;
            _log.error(errorMsg, e);
            // set serviceCode only if no previous exception
            if (serviceCode == null) {
                serviceCode = DeviceControllerExceptions.smis.createFullCopyFailure(errorMsg, e);
            }
        }
        if (serviceCode != null) {
            taskCompleter.error(_dbClient, serviceCode);
            throw serviceCode;
        }
    }
}
Also used : SmisException(com.emc.storageos.volumecontroller.impl.smis.SmisException) StoragePool(com.emc.storageos.db.client.model.StoragePool) NamedURI(com.emc.storageos.db.client.model.NamedURI) BlockSnapshot(com.emc.storageos.db.client.model.BlockSnapshot) CIMObjectPath(javax.cim.CIMObjectPath) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) SmisException(com.emc.storageos.volumecontroller.impl.smis.SmisException) Volume(com.emc.storageos.db.client.model.Volume) TenantOrg(com.emc.storageos.db.client.model.TenantOrg) BlockObject(com.emc.storageos.db.client.model.BlockObject) CIMArgument(javax.cim.CIMArgument)

Aggregations

TenantOrg (com.emc.storageos.db.client.model.TenantOrg)138 URI (java.net.URI)64 NamedURI (com.emc.storageos.db.client.model.NamedURI)57 Project (com.emc.storageos.db.client.model.Project)54 Volume (com.emc.storageos.db.client.model.Volume)41 ArrayList (java.util.ArrayList)40 VirtualPool (com.emc.storageos.db.client.model.VirtualPool)37 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)34 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)33 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)29 StringSet (com.emc.storageos.db.client.model.StringSet)29 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)28 VirtualArray (com.emc.storageos.db.client.model.VirtualArray)26 Produces (javax.ws.rs.Produces)26 StoragePool (com.emc.storageos.db.client.model.StoragePool)25 List (java.util.List)23 Test (org.junit.Test)23 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)22 StringMap (com.emc.storageos.db.client.model.StringMap)21 Consumes (javax.ws.rs.Consumes)21