Search in sources :

Example 11 with StorageArray

use of com.vmware.vim.vasa._1_0.data.xsd.StorageArray in project coprhd-controller by CoprHD.

the class SOSManager method queryAssociatedPortsForProcessor.

/**
 * Makes a call to Bourne to get the associated ports for the given storage
 * processor Ids
 *
 * @param spUniqueIds
 * @return array of <code>VasaAssociationObject</code> objects
 * @throws InvalidArgument
 * @throws InvalidSession
 * @throws StorageFault
 * @throws NotImplemented
 */
public synchronized VasaAssociationObject[] queryAssociatedPortsForProcessor(String[] spUniqueIds) throws InvalidArgument, InvalidSession, StorageFault, NotImplemented {
    final String methodName = "queryAssociatedPortsForProcessor(): ";
    log.debug(methodName + "Entry");
    List<VasaAssociationObject> returnList = null;
    try {
        Boolean supportsBlock = new Boolean(_config.getConfigValue("config/service/storageTopology/storageArray/support-block-profile"));
        if (!supportsBlock) {
            log.error(methodName + " This function is not implemented");
            throw FaultUtil.NotImplemented("This function is not implemented");
        }
        String bourneProcessorId = this.getProcessorId();
        List<String> bourneStoragePortList = this.getStoragePortIds();
        returnList = new ArrayList<VasaAssociationObject>();
        if (!Util.isEmpty(spUniqueIds)) {
            List<String> inputPortIdList = Arrays.asList(spUniqueIds);
            log.debug(methodName + "input processor ids: " + inputPortIdList);
            for (String storageProcessorId : spUniqueIds) {
                if (!Util.isEmpty(storageProcessorId) && !storageProcessorId.startsWith(STORAGEPROCESSOR_IDENTIFIER_PREFIX)) {
                    throw FaultUtil.InvalidArgument("Given processor Id is invalid:[" + storageProcessorId + "]");
                }
                if (!Util.isEmpty(storageProcessorId) && bourneProcessorId.equals(storageProcessorId)) {
                    log.debug(methodName + "Input processor Id is matching with valid processor Id:[" + storageProcessorId + "]");
                    VasaAssociationObject associationObject = new VasaAssociationObject();
                    BaseStorageEntity entityObject = new BaseStorageEntity();
                    entityObject.setUniqueIdentifier(storageProcessorId);
                    associationObject.addEntityId(entityObject);
                    List<BaseStorageEntity> associatedPortList = new ArrayList<BaseStorageEntity>();
                    for (String bourneStoragePortId : bourneStoragePortList) {
                        BaseStorageEntity associatedPort = new BaseStorageEntity();
                        log.debug(methodName + "Associating storage port ID [" + bourneStoragePortId + "] to processor ID[" + storageProcessorId + "]");
                        associatedPort.setUniqueIdentifier(bourneStoragePortId);
                        associatedPortList.add(associatedPort);
                    }
                    associationObject.setAssociatedId(associatedPortList.toArray(new BaseStorageEntity[0]));
                    returnList.add(associationObject);
                }
            }
            log.debug(methodName + "Exit returning vasa association objects of size[" + returnList.size() + "]");
            return returnList.toArray(new VasaAssociationObject[0]);
        } else if (spUniqueIds != null && spUniqueIds.length == 0) {
            log.debug(methodName + "Exit returning vasa association objects of size[" + returnList.size() + "]");
            return returnList.toArray(new VasaAssociationObject[0]);
        }
        VasaAssociationObject associationObject = new VasaAssociationObject();
        BaseStorageEntity entityObject = new BaseStorageEntity();
        entityObject.setUniqueIdentifier(bourneProcessorId);
        associationObject.addEntityId(entityObject);
        List<BaseStorageEntity> associatedPortList = new ArrayList<BaseStorageEntity>();
        for (String bourneStoragePortId : bourneStoragePortList) {
            BaseStorageEntity associatedPort = new BaseStorageEntity();
            log.debug(methodName + "Associating storage port ID [" + bourneStoragePortId + "] to processor ID[" + bourneProcessorId + "]");
            associatedPort.setUniqueIdentifier(bourneStoragePortId);
            associatedPortList.add(associatedPort);
        }
        associationObject.setAssociatedId(associatedPortList.toArray(new BaseStorageEntity[0]));
        returnList.add(associationObject);
    } catch (InvalidArgument e) {
        log.error(methodName + "InvalidArgument occured ", e);
        throw e;
    } catch (NotImplemented e) {
        log.error(methodName + "NotImplemented occured ", e);
        throw e;
    } catch (StorageFault e) {
        log.error(methodName + "StorageFault occured ", e);
        throw e;
    }
    log.debug(methodName + "Exit returning vasa association objects of size[" + returnList.size() + "]");
    return returnList.toArray(new VasaAssociationObject[0]);
}
Also used : VasaAssociationObject(com.vmware.vim.vasa._1_0.data.xsd.VasaAssociationObject) BaseStorageEntity(com.vmware.vim.vasa._1_0.data.xsd.BaseStorageEntity) InvalidArgument(com.vmware.vim.vasa._1_0.InvalidArgument) StorageFault(com.vmware.vim.vasa._1_0.StorageFault) ArrayList(java.util.ArrayList) NotImplemented(com.vmware.vim.vasa._1_0.NotImplemented)

Example 12 with StorageArray

use of com.vmware.vim.vasa._1_0.data.xsd.StorageArray in project coprhd-controller by CoprHD.

the class SOSManager method getSOSStorageArray.

private StorageArray getSOSStorageArray() throws StorageFault {
    final String methodName = "getSOSStorageArray(): ";
    StorageArray sa = new StorageArray();
    String arrayName = _config.getConfigValue("config/service/storageTopology/storageArray/name");
    Boolean supportsFile = new Boolean(_config.getConfigValue("config/service/storageTopology/storageArray/support-file-profile"));
    Boolean supportsBlock = new Boolean(_config.getConfigValue("config/service/storageTopology/storageArray/support-block-profile"));
    Boolean supportsCapabilty = new Boolean(_config.getConfigValue("config/service/storageTopology/storageArray/support-capability-profile"));
    sa.setArrayName(arrayName);
    String sosArrayId = this.getArrayId();
    sa.setUniqueIdentifier(sosArrayId);
    sa.setFirmware("1.0");
    if (supportsFile) {
        sa.addSupportedProfile(ProfileEnum.FileSystemProfile.getValue());
        sa.addSupportedFileSystem(FileSystemEnum.NFS.getValue());
    }
    if (supportsBlock) {
        sa.addSupportedProfile(ProfileEnum.BlockDeviceProfile.getValue());
        sa.addSupportedBlock(BlockEnum.FC.getValue());
        sa.addSupportedBlock(BlockEnum.ISCSI.getValue());
    }
    if (supportsCapabilty) {
        sa.addSupportedProfile(ProfileEnum.CapabilityProfile.getValue());
    }
    sa.setAlternateName(new String[] { arrayName });
    sa.setModelId(com.emc.storageos.vasa.Constants.VASA_BOURNE_PROVIDER_VENDOR_MODEL);
    sa.setVendorId(com.emc.storageos.vasa.Constants.VASA_BOURNE_PROVIDER_VENDOR_NAME);
    log.debug(methodName + "array detail: id[" + sa.getUniqueIdentifier() + "] name[" + sa.getArrayName() + "] modelId[" + sa.getModelId() + "] vendorId[" + sa.getVendorId() + "] profile(s) supported" + Arrays.asList(sa.getSupportedProfile()) + "] firmware[" + sa.getFirmware() + "]");
    log.debug(methodName + "Exting returning SOS storage array");
    return sa;
}
Also used : StorageArray(com.vmware.vim.vasa._1_0.data.xsd.StorageArray)

Example 13 with StorageArray

use of com.vmware.vim.vasa._1_0.data.xsd.StorageArray in project coprhd-controller by CoprHD.

the class SOSManager method queryArrays.

/**
 * Returns the storage array details for the given storage array Ids
 *
 * @param arrayId
 * @return array of <code>StorageArray</code> objects. Each having details
 *         of profiles the storage array supports
 * @throws InvalidArgument
 * @throws InvalidSession
 * @throws StorageFault
 */
public synchronized StorageArray[] queryArrays(String[] arrayId) throws InvalidArgument, InvalidSession, StorageFault {
    // Mandatory function
    final String methodName = "queryArrays(): ";
    log.debug(methodName + "Entry");
    List<StorageArray> storageArrayList = null;
    StorageArray[] arrays = null;
    if (!Util.isEmpty(arrayId)) {
        log.debug(methodName + "input array ids: " + Arrays.asList(arrayId));
    } else {
        log.debug(methodName + "input array ids: " + arrayId);
    }
    try {
        String sosArrayId = this.getArrayId();
        if (!Util.isEmpty(arrayId)) {
            storageArrayList = new ArrayList<StorageArray>();
            for (String inputArrayId : arrayId) {
                if (!inputArrayId.startsWith(STORAGEARRAY_IDENTIFIER_PREFIX)) {
                    throw FaultUtil.InvalidArgument("Given array Id is invalid:[" + arrayId + "]");
                }
                if (sosArrayId.equals(inputArrayId)) {
                    StorageArray storageArray = this.getSOSStorageArray();
                    storageArray.setUniqueIdentifier(inputArrayId);
                    storageArrayList.add(storageArray);
                }
            }
            return storageArrayList.toArray(new StorageArray[0]);
        }
        arrays = new StorageArray[1];
        StorageArray array = this.getSOSStorageArray();
        arrays[0] = array;
    } catch (StorageFault e) {
        log.error("StorageFault occured", e);
        throw e;
    } catch (InvalidArgument e) {
        log.error(methodName + "InvalidArgument occured ", e);
        throw e;
    }
    log.debug(methodName + "Exit returning arrays of size[" + arrays.length + "]");
    return arrays;
}
Also used : InvalidArgument(com.vmware.vim.vasa._1_0.InvalidArgument) StorageFault(com.vmware.vim.vasa._1_0.StorageFault) StorageArray(com.vmware.vim.vasa._1_0.data.xsd.StorageArray)

Example 14 with StorageArray

use of com.vmware.vim.vasa._1_0.data.xsd.StorageArray in project coprhd-controller by CoprHD.

the class ServiceImpl method queryArrays.

/**
 * Returns array details of the requested arrayIds
 *
 * @param arrayId
 *            array of arrayIds
 * @return array of StorageArray objects having storage array details
 *         respectively
 * @throws InvalidArgument
 *             if usage context is incorrect
 * @throws InvalidSession
 *             if session Id is invalid
 * @throws StorageFault
 *             if there is a failure in the underlying storage
 */
public StorageArray[] queryArrays(String[] arrayId) throws InvalidArgument, InvalidSession, StorageFault {
    // Mandatory function
    final String methodName = "queryArrays(): ";
    log.info(methodName + "Entry");
    if (arrayId != null) {
        log.info(methodName + "input array Ids: " + Arrays.asList(arrayId));
    }
    // verify valid SSL and VASA Sessions.
    sslUtil.checkHttpRequest(true, true);
    UsageContext uc = contextManager.getUsageContext();
    if (Util.isEmpty(uc.getHostInitiator())) {
        StorageArray[] arrays = new StorageArray[0];
        log.info(methodName + "Exit returning storage arrays of size[" + (arrays != null ? arrays.length : 0) + "]");
        return arrays;
    }
    SOSManager sosManager = contextManager.getSOSManager();
    StorageArray[] arrays = sosManager.queryArrays(arrayId);
    log.info(methodName + "Exit returning storage arrays of size[" + (arrays != null ? arrays.length : 0) + "]");
    return arrays;
}
Also used : UsageContext(com.vmware.vim.vasa._1_0.data.xsd.UsageContext) StorageArray(com.vmware.vim.vasa._1_0.data.xsd.StorageArray)

Aggregations

InvalidArgument (com.vmware.vim.vasa._1_0.InvalidArgument)12 NotImplemented (com.vmware.vim.vasa._1_0.NotImplemented)10 SOSFailure (com.emc.storageos.vasa.fault.SOSFailure)7 ArrayList (java.util.ArrayList)7 BaseStorageEntity (com.vmware.vim.vasa._1_0.data.xsd.BaseStorageEntity)5 VasaAssociationObject (com.vmware.vim.vasa._1_0.data.xsd.VasaAssociationObject)5 FileShare (com.emc.storageos.vasa.data.internal.FileShare)3 Volume (com.emc.storageos.vasa.data.internal.Volume)3 StorageFault (com.vmware.vim.vasa._1_0.StorageFault)3 StorageArray (com.vmware.vim.vasa._1_0.data.xsd.StorageArray)3 CoS (com.emc.storageos.vasa.data.internal.CoS)1 EventList (com.emc.storageos.vasa.data.internal.Event.EventList)1 AssociatedPool (com.emc.storageos.vasa.data.internal.Volume.AssociatedPool)1 HighAvailabilityVolumes (com.emc.storageos.vasa.data.internal.Volume.HighAvailabilityVolumes)1 NotFound (com.vmware.vim.vasa._1_0.NotFound)1 FileSystemInfo (com.vmware.vim.vasa._1_0.data.xsd.FileSystemInfo)1 StorageCapability (com.vmware.vim.vasa._1_0.data.xsd.StorageCapability)1 StorageFileSystem (com.vmware.vim.vasa._1_0.data.xsd.StorageFileSystem)1 StorageLun (com.vmware.vim.vasa._1_0.data.xsd.StorageLun)1 StoragePort (com.vmware.vim.vasa._1_0.data.xsd.StoragePort)1