Search in sources :

Example 1 with BaseStorageEntity

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

the class SOSManager method queryAssociatedCapabilityForLun.

/**
 * Makes a call to Bourne to get the details of associated capability for
 * the given lun Ids
 *
 * @param lunId
 * @return array of <code>VasaAssociationObject</code> objects
 * @throws InvalidArgument
 * @throws InvalidSession
 * @throws StorageFault
 * @throws NotImplemented
 */
public synchronized VasaAssociationObject[] queryAssociatedCapabilityForLun(String[] lunIds) throws InvalidArgument, InvalidSession, StorageFault, NotImplemented {
    final String methodName = "queryAssociatedCapabilityForLun(): ";
    log.debug(methodName + "Entry");
    List<Volume> volumeList = null;
    List<VasaAssociationObject> returnList = null;
    try {
        Boolean supportsBlock = new Boolean(_config.getConfigValue("config/service/storageTopology/storageArray/support-block-profile"));
        Boolean supportsCapability = new Boolean(_config.getConfigValue("config/service/storageTopology/storageArray/support-capability-profile"));
        if (supportsBlock == false || supportsCapability == false) {
            log.error(methodName + " This function is not implemented");
            throw FaultUtil.NotImplemented("This function is not implemented");
        }
        this.setVolumeIds();
        if (Util.isEmpty(lunIds)) {
            volumeList = _syncManager.getVolumeDetailList(this._reportedVolumeIdList);
        } else {
            List<String> inputLunIds = new ArrayList<String>();
            this.setVolumeIds();
            for (String inputLunId : lunIds) {
                if (!Util.isEmpty(inputLunId)) {
                    if (!inputLunId.startsWith(VOLUME_IDENTIFIER_PREFIX)) {
                        throw FaultUtil.InvalidArgument("Given StorageLun Id is invalid: " + inputLunId);
                    }
                    if (_reportedVolumeIdList.contains(inputLunId)) {
                        inputLunIds.add(inputLunId);
                    }
                } else {
                    throw FaultUtil.InvalidArgument("Given StorageLun Id is invalid: " + inputLunId);
                }
            }
            // log.debug(methodName + "input LUN ids: " + inputLunIds);
            volumeList = _syncManager.getVolumeDetailList(inputLunIds);
        }
        returnList = new ArrayList<VasaAssociationObject>();
        for (Volume volume : volumeList) {
            VasaAssociationObject associationObject = new VasaAssociationObject();
            BaseStorageEntity assoc = new BaseStorageEntity();
            assoc.setUniqueIdentifier(volume.getCos().getId());
            associationObject.addAssociatedId(assoc);
            BaseStorageEntity entity = new BaseStorageEntity();
            entity.setUniqueIdentifier(volume.getId());
            associationObject.addEntityId(entity);
            log.debug(methodName + "LUN id[" + entity.getUniqueIdentifier() + "] is associated to capability[" + assoc.getUniqueIdentifier() + "]");
            returnList.add(associationObject);
        }
    } catch (SOSFailure e) {
        log.error(methodName + "StorageOSFailure occured ", e);
        throw FaultUtil.StorageFault(e);
    } catch (InvalidArgument e) {
        log.error(methodName + "InvalidArgument occured ", e);
        throw e;
    } catch (NotImplemented e) {
        log.error(methodName + "NotImplemented 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) ArrayList(java.util.ArrayList) NotImplemented(com.vmware.vim.vasa._1_0.NotImplemented) Volume(com.emc.storageos.vasa.data.internal.Volume) BaseStorageEntity(com.vmware.vim.vasa._1_0.data.xsd.BaseStorageEntity) InvalidArgument(com.vmware.vim.vasa._1_0.InvalidArgument) SOSFailure(com.emc.storageos.vasa.fault.SOSFailure)

Example 2 with BaseStorageEntity

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

the class SOSManager method queryAssociatedCapabilityForFileSystem.

/**
 * Makes a call to Bourne to get the details of associated capability for
 * the given file system Ids
 *
 * @param fsId
 * @return array of <code>VasaAssociationObject</code> objects
 * @throws InvalidArgument
 * @throws InvalidSession
 * @throws StorageFault
 * @throws NotImplemented
 */
public synchronized VasaAssociationObject[] queryAssociatedCapabilityForFileSystem(String[] fsIds) throws InvalidArgument, InvalidSession, StorageFault, NotImplemented {
    final String methodName = "queryAssociatedCapabilityForFileSystem(): ";
    log.debug(methodName + "Entry");
    List<FileShare> fsList = null;
    List<VasaAssociationObject> returnList = null;
    Boolean supportsFile = new Boolean(_config.getConfigValue("config/service/storageTopology/storageArray/support-file-profile"));
    Boolean supportsCapability = new Boolean(_config.getConfigValue("config/service/storageTopology/storageArray/support-capability-profile"));
    try {
        if (supportsFile == false || supportsCapability == false) {
            log.error(methodName + " This function is not implemented");
            throw FaultUtil.NotImplemented("This function is not implemented");
        }
        this.setFileSystemIds();
        if (Util.isEmpty(fsIds)) {
            fsList = _syncManager.getFileSystemDetailList(this._reportedFileSystemIdList);
        } else {
            List<String> inputIdList = new ArrayList<String>();
            for (String inputFsId : fsIds) {
                if (!Util.isEmpty(inputFsId)) {
                    if (!inputFsId.startsWith(FILESYSTEM_IDENTIFIER_PREFIX)) {
                        throw FaultUtil.InvalidArgument("Given FileSystem Id is invalid: " + inputFsId);
                    }
                    if (_reportedFileSystemIdList.contains(inputFsId)) {
                        inputIdList.add(inputFsId);
                    }
                } else {
                    throw FaultUtil.InvalidArgument("Given FileSystem Id is invalid: " + inputFsId);
                }
            }
            log.debug(methodName + "input file system ids: " + inputIdList);
            fsList = _syncManager.getFileSystemDetailList(inputIdList);
        }
        returnList = new ArrayList<VasaAssociationObject>();
        for (FileShare fileShare : fsList) {
            VasaAssociationObject associationObject = new VasaAssociationObject();
            BaseStorageEntity assoc = new BaseStorageEntity();
            assoc.setUniqueIdentifier(fileShare.getCos().getId());
            BaseStorageEntity entity = new BaseStorageEntity();
            entity.setUniqueIdentifier(fileShare.getId());
            associationObject.addAssociatedId(assoc);
            associationObject.addEntityId(entity);
            log.debug(methodName + "File system id[" + entity.getUniqueIdentifier() + "] is associated to capability[" + assoc.getUniqueIdentifier() + "]");
            returnList.add(associationObject);
        }
    } catch (SOSFailure e1) {
        log.error(methodName + "StorageOSFailure occured ", e1);
        throw FaultUtil.StorageFault(e1);
    } catch (InvalidArgument e) {
        log.error(methodName + "InvalidArgument occured ", e);
        throw e;
    } catch (NotImplemented e) {
        log.error(methodName + "NotImplemented 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) ArrayList(java.util.ArrayList) NotImplemented(com.vmware.vim.vasa._1_0.NotImplemented) FileShare(com.emc.storageos.vasa.data.internal.FileShare) BaseStorageEntity(com.vmware.vim.vasa._1_0.data.xsd.BaseStorageEntity) InvalidArgument(com.vmware.vim.vasa._1_0.InvalidArgument) SOSFailure(com.emc.storageos.vasa.fault.SOSFailure)

Example 3 with BaseStorageEntity

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

the class SOSManager method queryAssociatedProcessorsForArray.

/**
 * Makes a call to Bourne to get the associated processors for the given
 * storage array Ids
 *
 * @param arrayUniqueIds
 * @return array of <code>VasaAssociationObject</code> objects
 * @throws InvalidArgument
 * @throws InvalidSession
 * @throws StorageFault
 * @throws NotImplemented
 */
public synchronized VasaAssociationObject[] queryAssociatedProcessorsForArray(String[] arrayUniqueIds) throws InvalidArgument, StorageFault, NotImplemented, InvalidSession {
    final String methodName = "queryAssociatedProcessorsForArray(): ";
    List<VasaAssociationObject> returnList = null;
    String bourneArrayId = this.getArrayId();
    log.debug(methodName + "Entry");
    Boolean supportsBlock = new Boolean(_config.getConfigValue("config/service/storageTopology/storageArray/support-block-profile"));
    try {
        if (!supportsBlock) {
            log.error(methodName + " This function is not implemented");
            throw FaultUtil.NotImplemented("This function is not implemented");
        }
        if (!Util.isEmpty(arrayUniqueIds)) {
            List<String> inputArrayIdList = Arrays.asList(arrayUniqueIds);
            log.debug(methodName + "input array ids: " + inputArrayIdList);
            for (String inputArrayId : inputArrayIdList) {
                if (!Util.isEmpty(inputArrayId) && !inputArrayId.startsWith(STORAGEARRAY_IDENTIFIER_PREFIX)) {
                    throw FaultUtil.InvalidArgument("Given array Id is invalid:[" + inputArrayId + "]");
                }
            }
        }
        returnList = new ArrayList<VasaAssociationObject>();
        VasaAssociationObject associationObject = new VasaAssociationObject();
        BaseStorageEntity entity = new BaseStorageEntity();
        entity.setUniqueIdentifier(bourneArrayId);
        BaseStorageEntity associatedEntity = new BaseStorageEntity();
        associatedEntity.setUniqueIdentifier(this.getProcessorId());
        associationObject.addEntityId(entity);
        associationObject.addAssociatedId(associatedEntity);
        if (Util.isEmpty(arrayUniqueIds)) {
            log.debug(methodName + "Exit returning vasa association objects of size[" + returnList.size() + "]");
            returnList.add(associationObject);
        // return returnList.toArray(new VasaAssociationObject[0]);
        } else {
            /*
                 * StorageProcessor[] processorList = this
                 * .queryStorageProcessors(null);
                 */
            for (String arrayID : arrayUniqueIds) {
                if (bourneArrayId.equals(arrayID)) {
                    /*
                         * VasaAssociationObject associationObject = new
                         * VasaAssociationObject(); BaseStorageEntity entityObj
                         * = new BaseStorageEntity();
                         * entityObj.setUniqueIdentifier(arrayID);
                         * associationObject.addEntityId(entityObj);
                         */
                    // for (StorageProcessor proc : processorList) {
                    log.debug(methodName + "array[" + entity.getUniqueIdentifier() + "] is associated to processor[" + associatedEntity.getUniqueIdentifier() + "]");
                    returnList.add(associationObject);
                }
            // 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) NotImplemented(com.vmware.vim.vasa._1_0.NotImplemented)

Example 4 with BaseStorageEntity

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

the class SOSManager method queryAssociatedLUNsForPort.

/**
 * Makes a call to Bourne to get the associated Luns for the given storage
 * port Ids
 *
 * @param portUniqueIds
 * @return array of <code>VasaAssociationObject</code> objects
 * @throws InvalidArgument
 * @throws InvalidSession
 * @throws StorageFault
 * @throws NotImplemented
 */
public synchronized VasaAssociationObject[] queryAssociatedLUNsForPort(String[] portUniqueIds) throws InvalidArgument, InvalidSession, StorageFault, NotImplemented {
    final String methodName = "queryAssociatedLUNsForPort(): ";
    log.debug(methodName + "Entry");
    List<VasaAssociationObject> returnList = null;
    List<String> inputPortIdList = null;
    log.info(methodName + "Input:[" + portUniqueIds + "]");
    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 csvSeparatedInitiatorList = this.getCSVListOfInitiatorsFromUsageContext();
        Hashtable<String, List<String>> portToVolumeTable = _syncManager.getStoragePortToVolumeTable(csvSeparatedInitiatorList);
        returnList = new ArrayList<VasaAssociationObject>();
        if (Util.isEmpty(portUniqueIds)) {
            // Return all port associated to LUNs
            for (String portId : portToVolumeTable.keySet()) {
                VasaAssociationObject associationObject = new VasaAssociationObject();
                BaseStorageEntity storagePort = new BaseStorageEntity();
                storagePort.setUniqueIdentifier(portId);
                associationObject.addEntityId(storagePort);
                for (String volumeId : portToVolumeTable.get(portId)) {
                    BaseStorageEntity associatedVolume = new BaseStorageEntity();
                    associatedVolume.setUniqueIdentifier(volumeId);
                    associationObject.addAssociatedId(associatedVolume);
                }
                returnList.add(associationObject);
            }
        } else {
            inputPortIdList = Arrays.asList(portUniqueIds);
            log.debug(methodName + "Input port ids: " + inputPortIdList);
            for (String inputPortId : inputPortIdList) {
                if (!Util.isEmpty(inputPortId)) {
                    if (!inputPortId.startsWith(STORAGEPORT_IDENTIFIER_PREFIX)) {
                        throw FaultUtil.InvalidArgument("Given port Id is invalid[" + inputPortId + "]");
                    } else {
                        List<String> volumeIdList = portToVolumeTable.get(inputPortId);
                        if (volumeIdList != null && !volumeIdList.isEmpty()) {
                            VasaAssociationObject associationObject = new VasaAssociationObject();
                            BaseStorageEntity storagePort = new BaseStorageEntity();
                            storagePort.setUniqueIdentifier(inputPortId);
                            associationObject.addEntityId(storagePort);
                            for (String volumeId : volumeIdList) {
                                BaseStorageEntity associatedVolume = new BaseStorageEntity();
                                associatedVolume.setUniqueIdentifier(volumeId);
                                associationObject.addAssociatedId(associatedVolume);
                            }
                            returnList.add(associationObject);
                        }
                    }
                }
            // }
            }
        }
        return returnList.toArray(new VasaAssociationObject[0]);
    } catch (SOSFailure e) {
        log.error("StorageOSFailure occured", e);
        throw FaultUtil.StorageFault("StorageOSFailure occured", e);
    } catch (InvalidArgument e) {
        log.error(methodName + "InvalidArgument occured ", e);
        throw e;
    } catch (NotImplemented e) {
        log.error(methodName + "NotImplemented occured ", e);
        throw e;
    }
}
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) SOSFailure(com.emc.storageos.vasa.fault.SOSFailure) NotImplemented(com.vmware.vim.vasa._1_0.NotImplemented) List(java.util.List) ArrayList(java.util.ArrayList) EventList(com.emc.storageos.vasa.data.internal.Event.EventList)

Example 5 with BaseStorageEntity

use of com.vmware.vim.vasa._1_0.data.xsd.BaseStorageEntity 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)

Aggregations

InvalidArgument (com.vmware.vim.vasa._1_0.InvalidArgument)5 NotImplemented (com.vmware.vim.vasa._1_0.NotImplemented)5 BaseStorageEntity (com.vmware.vim.vasa._1_0.data.xsd.BaseStorageEntity)5 VasaAssociationObject (com.vmware.vim.vasa._1_0.data.xsd.VasaAssociationObject)5 ArrayList (java.util.ArrayList)4 SOSFailure (com.emc.storageos.vasa.fault.SOSFailure)3 StorageFault (com.vmware.vim.vasa._1_0.StorageFault)2 EventList (com.emc.storageos.vasa.data.internal.Event.EventList)1 FileShare (com.emc.storageos.vasa.data.internal.FileShare)1 Volume (com.emc.storageos.vasa.data.internal.Volume)1 List (java.util.List)1