Search in sources :

Example 86 with WBEMException

use of javax.wbem.WBEMException 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 87 with WBEMException

use of javax.wbem.WBEMException in project coprhd-controller by CoprHD.

the class SmisMetaVolumeOperations method createMetaVolumes.

/**
 * Create meta volumes.
 *
 * @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
 */
/**
 * Create meta volumes
 *
 * @param storageSystem
 * @param storagePool
 * @param volumes
 * @param capabilities
 * @param taskCompleter
 * @throws Exception
 */
@Override
public void createMetaVolumes(StorageSystem storageSystem, StoragePool storagePool, List<Volume> volumes, VirtualPoolCapabilityValuesWrapper capabilities, TaskCompleter taskCompleter) throws Exception {
    String label = null;
    Volume volume = volumes.get(0);
    // We don't need a label when we are to create more than
    // one volume. In fact we can't set the label in this
    // case for VMAX, else the request will fail.
    // TODO there is a bug in smis --- the request to element composition service fails when name is set even for a single volume.
    // todo: the opt 450103 was opened on 05/30
    Long capacity = volume.getTotalMetaMemberCapacity();
    Integer metaMemberCount = volume.getMetaMemberCount();
    String metaVolumeType = volume.getCompositionType();
    boolean opCreationFailed = false;
    try {
        CIMObjectPath elementCompositionServicePath = _cimPath.getElementCompositionSvcPath(storageSystem);
        boolean isThinlyProvisioned = volume.getThinlyProvisioned();
        _log.info(String.format("Create Meta Volumes Start - Array: %s, Count: %s, MetaType: %s", storageSystem.getSerialNumber(), volumes.size(), metaVolumeType));
        CIMArgument[] inArgs;
        CIMInstance poolSetting = null;
        // set preallocate size if needed
        if (isThinlyProvisioned && volume.getThinVolumePreAllocationSize() > 0) {
            poolSetting = _smisStorageDevicePreProcessor.createStoragePoolSetting(storageSystem, storagePool, volume.getThinVolumePreAllocationSize());
        }
        inArgs = _helper.getCreateMetaVolumesInputArguments(storageSystem, storagePool, label, capacity, volumes.size(), isThinlyProvisioned, metaVolumeType, metaMemberCount, poolSetting);
        CIMArgument[] outArgs = new CIMArgument[5];
        StorageSystem forProvider = _helper.getStorageSystemForProvider(storageSystem, volume);
        _log.info("Selected Provider : {}", forProvider.getNativeGuid());
        // can not invoke async --- cimPath is not serializable
        // todo: before opt 450103 is fixed always use multi-volume job
        SmisAbstractCreateVolumeJob smisJobCompleter = new SmisCreateMultiVolumeJob(null, forProvider.getId(), storagePool.getId(), volumes.size(), taskCompleter);
        // SmisAbstractCreateVolumeJob smisJobCompleter = volumes.size() > 1 ? new SmisCreateMultiVolumeJob(null,
        // forProvider.getId(), storagePool.getId(), volumes.size(), taskCompleter)
        // : new SmisCreateVolumeJob(null, forProvider.getId(), storagePool.getId(),
        // taskCompleter);
        smisJobCompleter.setCimPath(_cimPath);
        _helper.invokeMethodSynchronously(forProvider, elementCompositionServicePath, SmisConstants.CREATE_OR_MODIFY_COMPOSITE_ELEMENT, inArgs, outArgs, smisJobCompleter);
    } 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 createMetaVolumes: ", e);
        opCreationFailed = true;
        ServiceError serviceError = DeviceControllerErrors.smis.methodFailed("createMetaVolumes", e.getMessage());
        taskCompleter.error(_dbClient, serviceError);
    }
    if (opCreationFailed) {
        for (Volume vol : volumes) {
            vol.setInactive(true);
            _dbClient.persistObject(vol);
        }
    }
    StringBuilder logMsgBuilder = new StringBuilder(String.format("Create meta volumes End - Array:%s, Pool:%s", storageSystem.getSerialNumber(), storagePool.getNativeGuid()));
    for (Volume vol : volumes) {
        logMsgBuilder.append(String.format("%nVolume:%s", vol.getLabel()));
    }
    _log.info(logMsgBuilder.toString());
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) CIMObjectPath(javax.cim.CIMObjectPath) 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) Volume(com.emc.storageos.db.client.model.Volume) SmisCreateMultiVolumeJob(com.emc.storageos.volumecontroller.impl.smis.job.SmisCreateMultiVolumeJob) SmisAbstractCreateVolumeJob(com.emc.storageos.volumecontroller.impl.smis.job.SmisAbstractCreateVolumeJob) CIMArgument(javax.cim.CIMArgument) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 88 with WBEMException

use of javax.wbem.WBEMException 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)

Example 89 with WBEMException

use of javax.wbem.WBEMException in project coprhd-controller by CoprHD.

the class SmisMetaVolumeOperations method defineExpansionType.

@Override
public String defineExpansionType(StorageSystem storageSystem, Volume volume, String recommendedMetaVolumeType, MetaVolumeTaskCompleter metaVolumeTaskCompleter) throws Exception {
    String expansionType = null;
    Boolean isBound = null;
    try {
        CIMInstance cimVolume = null;
        CIMObjectPath volumePath = _cimPath.getBlockObjectPath(storageSystem, volume);
        cimVolume = _helper.getInstance(storageSystem, volumePath, false, false, new String[] { EMC_IS_BOUND });
        String isBoundStr = cimVolume.getPropertyValue(EMC_IS_BOUND).toString();
        isBound = Boolean.parseBoolean(isBoundStr);
        String deviceType = storageSystem.getSystemType();
        // If a volume is composite volume, use its meta type,
        // otherwise for vmax bound regular volumes always use concatenated type for expansion.
        // The reason: not all microcode versions allows to form striped meta volumes with bound meta head.
        // See Notes in smis provider guide 4.6.1 p. 424
        expansionType = recommendedMetaVolumeType;
        if (volume.getIsComposite()) {
            expansionType = volume.getCompositionType();
        } else if (deviceType.equals(StorageSystem.Type.vmax.toString()) && isBound) {
            expansionType = Volume.CompositionType.CONCATENATED.toString();
        }
        return expansionType;
    } 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 defineExpansionType: " + volume.getLabel(), e);
        ServiceError error = DeviceControllerErrors.smis.methodFailed("defineExpansionType", e.getMessage());
        metaVolumeTaskCompleter.getVolumeTaskCompleter().error(_dbClient, error);
        throw e;
    } finally {
        _log.info(String.format("defineExpansionType End -  Volume: %s, IsMeta: %s, isBound: %s, " + "\n Array:%s, Array type: %s,  Meta type for expansion: %s", volume.getNativeId(), volume.getIsComposite(), isBound, storageSystem.getSerialNumber(), storageSystem.getSystemType(), expansionType));
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) CIMObjectPath(javax.cim.CIMObjectPath) 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)

Example 90 with WBEMException

use of javax.wbem.WBEMException in project coprhd-controller by CoprHD.

the class SmisStorageDevice method doDeleteVolumes.

@Override
public void doDeleteVolumes(final StorageSystem storageSystem, final String opId, final List<Volume> volumes, final TaskCompleter taskCompleter) throws DeviceControllerException {
    try {
        List<String> volumeNativeIds = new ArrayList<String>();
        StringBuilder logMsgBuilder = new StringBuilder(String.format("Delete Volume Start - Array:%s", storageSystem.getSerialNumber()));
        MultiVolumeTaskCompleter multiVolumeTaskCompleter = (MultiVolumeTaskCompleter) taskCompleter;
        Set<CIMInstance> parkingSLOStorageGroups = new HashSet<>();
        Set<Volume> cloneVolumes = new HashSet<Volume>();
        _helper.callRefreshSystem(storageSystem, null, false);
        Iterator<Volume> volumeItr = volumes.iterator();
        Set<String> nativeIdsForParkingSG = new HashSet<String>();
        // Flag to indicate whether or not we need to use the EMCForce flag on this operation.
        // We currently use this flag when dealing with RP Volumes as they are tagged for RP and the
        // operation on these volumes would fail otherwise.
        boolean forceFlag = false;
        while (volumeItr.hasNext()) {
            Volume volume = volumeItr.next();
            logMsgBuilder.append(String.format("%nVolume:%s", volume.getLabel()));
            // check if the volume is on array, if not, no operation on array side
            CIMInstance volumeInstance = _helper.checkExists(storageSystem, _cimPath.getBlockObjectPath(storageSystem, volume), false, false);
            if (volumeInstance == null) {
                // related volume state (if any) has been deleted. skip processing, if already
                // deleted from array.
                _log.info(String.format("Volume %s already deleted: ", volume.getNativeId()));
                volume.setInactive(true);
                _dbClient.updateObject(volume);
                // remove the volume from the processing list
                volumeItr.remove();
                VolumeTaskCompleter deleteTaskCompleter = multiVolumeTaskCompleter.skipTaskCompleter(volume.getId());
                deleteTaskCompleter.ready(_dbClient);
                continue;
            }
            nativeIdsForParkingSG.add(volume.getNativeId());
            if (!forceFlag) {
                forceFlag = ExportUtils.useEMCForceFlag(_dbClient, volume.getId());
            }
        }
        if (storageSystem.checkIfVmax3()) {
            parkingSLOStorageGroups = _helper.removeVolumeFromParkingSLOStorageGroup(storageSystem, nativeIdsForParkingSG.toArray(new String[] {}), forceFlag);
            _log.info("Done invoking remove volumes from parking SLO storage group");
            // delete operation.
            if (!parkingSLOStorageGroups.isEmpty()) {
                _helper.deleteParkingSLOStorageGroupsIfEmpty(storageSystem, parkingSLOStorageGroups);
            }
        }
        for (Volume volume : volumes) {
            if (volume.getConsistencyGroup() != null || NullColumnValueGetter.isNotNullValue(volume.getReplicationGroupInstance())) {
                _log.info(String.format("Volume [%s](%s) is a part of CG (%s), extra cleanup operations may be needed.", volume.getLabel(), volume.getId(), volume.getConsistencyGroup()));
                // Clean up any group backup snapshots (VNX only), if there are none this step will be skipped.
                if (storageSystem.deviceIsType(Type.vnxblock)) {
                    cleanupAnyGroupBackupSnapshots(storageSystem, volume);
                }
                // Remove the volume from the backend CG, if it's not actually in a backend CG this step will be skipped.
                removeVolumeFromConsistencyGroup(storageSystem, volume);
                // Clean up any volume backup snapshots, if there are none this step will be skipped.
                cleanupAnyBackupSnapshots(storageSystem, volume);
            } else {
                // for VMAX3, clean up unlinked snapshot session, which is possible for ingested volume
                if (storageSystem.deviceIsType(Type.vnxblock) || storageSystem.checkIfVmax3()) {
                    cleanupAnyBackupSnapshots(storageSystem, volume);
                }
            }
            if (storageSystem.deviceIsType(Type.vmax)) {
                // VMAX2 & VMAX3 - remove volume from Storage Groups if volume is not in any MaskingView
                // COP-16705, COP-21770 - Ingested non-exported Volume may be associated with SG outside of ViPR.
                _helper.removeVolumeFromStorageGroupsIfVolumeIsNotInAnyMV(storageSystem, volume);
            }
            _helper.doApplyRecoverPointTag(storageSystem, volume, false);
            // Compare the volume labels of the to-be-deleted and existing volumes
            /**
             * This will fail in the case when the user just changes the label of the
             * volume...until we subscribe to indications from the provider, we will live with
             * that.
             */
            String volToDeleteLabel = volume.getDeviceLabel();
            CIMInstance volumeInstance = _helper.checkExists(storageSystem, _cimPath.getBlockObjectPath(storageSystem, volume), false, false);
            String volInstanceLabel = CIMPropertyFactory.getPropertyValue(volumeInstance, SmisConstants.CP_ELEMENT_NAME);
            if (volToDeleteLabel != null && volInstanceLabel != null && !volToDeleteLabel.equals(volInstanceLabel)) {
                // related volume state (if any) has been deleted. skip processing, if already
                // deleted from array.
                _log.info("VolToDeleteLabel {} : volInstancelabel {}", volToDeleteLabel, volInstanceLabel);
                _log.info(String.format("Volume %s already deleted: ", volume.getNativeId()));
                volume.setInactive(true);
                // clear the associated consistency group from the volume
                volume.setConsistencyGroup(NullColumnValueGetter.getNullURI());
                _dbClient.updateObject(volume);
                VolumeTaskCompleter deleteTaskCompleter = multiVolumeTaskCompleter.skipTaskCompleter(volume.getId());
                deleteTaskCompleter.ready(_dbClient);
                continue;
            }
            // dangling meta members as a result of expansion failure (and rollback failure).
            if (!storageSystem.checkIfVmax3()) {
                boolean cleanupSuccess = cleanupDanglingMetaMembers(storageSystem, volume);
                if (!cleanupSuccess) {
                    // cannot delete volume
                    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("doDeleteVolume", errorMessage);
                    VolumeTaskCompleter deleteTaskCompleter = multiVolumeTaskCompleter.skipTaskCompleter(volume.getId());
                    deleteTaskCompleter.error(_dbClient, error);
                    _log.error(String.format(errorMessage));
                    continue;
                }
            }
            if (!NullColumnValueGetter.isNullURI(volume.getAssociatedSourceVolume())) {
                cloneVolumes.add(volume);
            }
            volumeNativeIds.add(volume.getNativeId());
        }
        _log.info(logMsgBuilder.toString());
        // execute SMI-S Call , only if any Volumes left for deletion.
        if (!multiVolumeTaskCompleter.isVolumeTaskCompletersEmpty()) {
            if (!cloneVolumes.isEmpty()) {
                processClonesBeforeDeletion(storageSystem, cloneVolumes);
            }
            CIMObjectPath configSvcPath = _cimPath.getConfigSvcPath(storageSystem);
            CIMArgument[] inArgs = _helper.getDeleteVolumesInputArguments(storageSystem, volumeNativeIds.toArray(new String[0]));
            CIMArgument[] outArgs = new CIMArgument[5];
            String returnElementsMethod;
            if (storageSystem.getUsingSmis80()) {
                returnElementsMethod = SmisConstants.RETURN_ELEMENTS_TO_STORAGE_POOL;
            } else {
                returnElementsMethod = SmisConstants.EMC_RETURN_TO_STORAGE_POOL;
            }
            _helper.invokeMethod(storageSystem, configSvcPath, returnElementsMethod, inArgs, outArgs);
            CIMObjectPath job = _cimPath.getCimObjectPathFromOutputArgs(outArgs, SmisConstants.JOB);
            if (job != null) {
                ControllerServiceImpl.enqueueJob(new QueueJob(new SmisDeleteVolumeJob(job, storageSystem.getId(), taskCompleter)));
            }
        } else {
            // If we are here, there are no volumes to delete, we have
            // invoked ready() for the VolumeDeleteCompleter, and told
            // the multiVolumeTaskCompleter to skip these completers.
            // In this case, the multiVolumeTaskCompleter complete()
            // method will not be invoked and the result is that the
            // workflow that initiated this delete request will never
            // be updated. So, here we just call complete() on the
            // multiVolumeTaskCompleter to ensure the workflow status is
            // updated.
            multiVolumeTaskCompleter.ready(_dbClient);
        }
    } 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 doDeleteVolume: ", e);
        // Check to see if an Asynchronous job will now handle the task status.
        if (!taskCompleter.isAsynchronous()) {
            ServiceError error = DeviceControllerErrors.smis.methodFailed("doDeleteVolume", e.getMessage());
            taskCompleter.error(_dbClient, error);
        }
    }
    StringBuilder logMsgBuilder = new StringBuilder(String.format("Delete Volume End - Array: %s", storageSystem.getSerialNumber()));
    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) ArrayList(java.util.ArrayList) CIMObjectPath(javax.cim.CIMObjectPath) WBEMException(javax.wbem.WBEMException) MultiVolumeTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.MultiVolumeTaskCompleter) 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) SmisDeleteVolumeJob(com.emc.storageos.volumecontroller.impl.smis.job.SmisDeleteVolumeJob) MetaVolumeTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.MetaVolumeTaskCompleter) VolumeTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.VolumeTaskCompleter) MultiVolumeTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.MultiVolumeTaskCompleter) Volume(com.emc.storageos.db.client.model.Volume) QueueJob(com.emc.storageos.volumecontroller.impl.job.QueueJob) HashSet(java.util.HashSet) CIMArgument(javax.cim.CIMArgument)

Aggregations

WBEMException (javax.wbem.WBEMException)122 CIMObjectPath (javax.cim.CIMObjectPath)90 CIMInstance (javax.cim.CIMInstance)63 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)60 CIMArgument (javax.cim.CIMArgument)52 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)38 ArrayList (java.util.ArrayList)29 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)27 Volume (com.emc.storageos.db.client.model.Volume)22 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)19 WBEMClient (javax.wbem.client.WBEMClient)19 SmisException (com.emc.storageos.volumecontroller.impl.smis.SmisException)16 HashSet (java.util.HashSet)15 URI (java.net.URI)13 HashMap (java.util.HashMap)13 BlockObject (com.emc.storageos.db.client.model.BlockObject)10 BlockSnapshot (com.emc.storageos.db.client.model.BlockSnapshot)10 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)10 QueueJob (com.emc.storageos.volumecontroller.impl.job.QueueJob)9 CimConnection (com.emc.storageos.cimadapter.connections.cim.CimConnection)8