Search in sources :

Example 1 with SmisCreateMaskingViewJob

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

the class VmaxExportOperations method createMaskingView.

private void createMaskingView(StorageSystem storage, URI exportMaskURI, String maskingViewName, CIMObjectPath volumeGroupPath, VolumeURIHLU[] volumeURIHLUs, CIMObjectPath targetPortGroupPath, CIMObjectPath initiatorGroupPath, TaskCompleter taskCompleter) throws Exception {
    _log.info("{} createMaskingView START...", storage.getSerialNumber());
    // 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;
    List<String> deviceNumbers = new ArrayList<String>();
    for (VolumeURIHLU volURIHlu : volumeURIHLUs) {
        String hlu = volURIHlu.getHLU();
        // LUN_UNASSIGNED value (as a hex string).
        if (hlu != null && !hlu.equalsIgnoreCase(ExportGroup.LUN_UNASSIGNED_STR)) {
            deviceNumbers.add(hlu);
        }
        // The force flag only needs to be set once
        if (!forceFlag) {
            forceFlag = ExportUtils.useEMCForceFlag(_dbClient, volURIHlu.getVolumeURI());
        }
    }
    String[] deviceNumbersStr = {};
    CIMArgument[] inMVArgs = _helper.getCreateMaskingViewInputArguments(volumeGroupPath, targetPortGroupPath, initiatorGroupPath, deviceNumbers.toArray(deviceNumbersStr), maskingViewName, forceFlag);
    CIMArgument[] outMVArgs = new CIMArgument[5];
    try {
        _helper.invokeMethod(storage, _cimPath.getControllerConfigSvcPath(storage), "CreateMaskingView", inMVArgs, outMVArgs);
        CIMObjectPath cimJobPath = _cimPath.getCimObjectPathFromOutputArgs(outMVArgs, "Job");
        if (cimJobPath != null) {
            ControllerServiceImpl.enqueueJob(new QueueJob(new SmisCreateMaskingViewJob(cimJobPath, storage.getId(), exportMaskURI, volumeURIHLUs, volumeGroupPath, taskCompleter)));
        } else {
            // simulated environments
            throw new WBEMException("No output argument was returned from CreateMaskingView operation");
        }
    // Rollback context is set in the job upon completion.
    } catch (WBEMException we) {
        _log.info("{} Problem when trying to create masking view ... going to look up masking view.", storage.getSerialNumber(), we);
        boolean handleException = false;
        try {
            handleException = handleCreateMaskingViewException(storage, maskingViewName);
        } catch (Exception e) {
            _log.error("Issue trying to handle Export Mask exception", e);
        }
        if (handleException) {
            _log.info("{} Found masking view: {}", storage.getSerialNumber(), maskingViewName);
            taskCompleter.ready(_dbClient);
        } else {
            _log.debug("{} Problem when looking up masking view: {}", storage.getSerialNumber(), maskingViewName);
            throw we;
        }
    }
    _log.info("{} createMaskingView END...", storage.getSerialNumber());
}
Also used : ArrayList(java.util.ArrayList) CIMObjectPath(javax.cim.CIMObjectPath) SmisCreateMaskingViewJob(com.emc.storageos.volumecontroller.impl.smis.job.SmisCreateMaskingViewJob) WBEMException(javax.wbem.WBEMException) SmisException(com.emc.storageos.volumecontroller.impl.smis.SmisException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) WBEMException(javax.wbem.WBEMException) QueueJob(com.emc.storageos.volumecontroller.impl.job.QueueJob) VolumeURIHLU(com.emc.storageos.volumecontroller.impl.VolumeURIHLU) CIMArgument(javax.cim.CIMArgument)

Aggregations

DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)1 VolumeURIHLU (com.emc.storageos.volumecontroller.impl.VolumeURIHLU)1 QueueJob (com.emc.storageos.volumecontroller.impl.job.QueueJob)1 SmisException (com.emc.storageos.volumecontroller.impl.smis.SmisException)1 SmisCreateMaskingViewJob (com.emc.storageos.volumecontroller.impl.smis.job.SmisCreateMaskingViewJob)1 ArrayList (java.util.ArrayList)1 CIMArgument (javax.cim.CIMArgument)1 CIMObjectPath (javax.cim.CIMObjectPath)1 WBEMException (javax.wbem.WBEMException)1