Search in sources :

Example 1 with NotImplemented

use of com.vmware.vim.vasa._1_0.NotImplemented 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 NotImplemented

use of com.vmware.vim.vasa._1_0.NotImplemented in project coprhd-controller by CoprHD.

the class SOSManager method queryStorageProcessors.

/**
 * Makes a call to Bourne to get the details of given storage processor Ids
 *
 * @param processorId
 * @return array of <code>StorageProcessor</code> objects
 * @throws InvalidArgument
 * @throws InvalidSession
 * @throws StorageFault
 * @throws NotImplemented
 */
public synchronized StorageProcessor[] queryStorageProcessors(String[] processorId) throws InvalidArgument, InvalidSession, StorageFault, NotImplemented {
    final String methodName = "queryStorageProcessors(): ";
    log.debug(methodName + "Entry");
    List<StorageProcessor> processorList = 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");
        }
        if (processorId != null) {
            log.debug(methodName + "input processor Ids " + Arrays.asList(processorId));
        } else {
            log.debug(methodName + "input processor Ids " + processorId);
        }
        String storageProcessorId = this.getProcessorId();
        if (!Util.isEmpty(processorId)) {
            for (String inputProcessorId : processorId) {
                if (Util.isEmpty(inputProcessorId) == true || inputProcessorId.startsWith(STORAGEPROCESSOR_IDENTIFIER_PREFIX) == false) {
                    throw FaultUtil.InvalidArgument("Given processor Id(s) are invalid");
                }
            }
        }
        processorList = new ArrayList<StorageProcessor>();
        if (Util.isEmpty(processorId)) {
            StorageProcessor processor = new StorageProcessor();
            log.debug(methodName + " adding storage processor id[" + storageProcessorId + "]");
            processor.setUniqueIdentifier(storageProcessorId);
            processor.addSpIdentifier(storageProcessorId);
            processorList.add(processor);
        } else {
            for (String inputProcessorId : processorId) {
                if (inputProcessorId != null && storageProcessorId.equals(inputProcessorId)) {
                    StorageProcessor processor = new StorageProcessor();
                    log.debug(methodName + " adding storage processor id[" + storageProcessorId + "]");
                    processor.addSpIdentifier(storageProcessorId);
                    processor.setUniqueIdentifier(storageProcessorId);
                    processorList.add(processor);
                }
            }
        }
    } catch (InvalidArgument e) {
        log.error(methodName + "InvalidArgument occured", e);
        throw (e);
    } catch (NotImplemented e) {
        log.error(methodName + "NotImplemented occured", e);
        throw FaultUtil.StorageFault(e);
    } catch (Exception e) {
        log.error(methodName + "Unexpected exception occured", e);
        throw FaultUtil.StorageFault(e);
    }
    log.debug(methodName + "Exit returning processors of size[" + processorList.size() + "]");
    return processorList.toArray(new StorageProcessor[0]);
}
Also used : InvalidArgument(com.vmware.vim.vasa._1_0.InvalidArgument) NotImplemented(com.vmware.vim.vasa._1_0.NotImplemented) StorageProcessor(com.vmware.vim.vasa._1_0.data.xsd.StorageProcessor)

Example 3 with NotImplemented

use of com.vmware.vim.vasa._1_0.NotImplemented in project coprhd-controller by CoprHD.

the class SOSManager method queryStorageLuns.

/**
 * Makes a call to Bourne to get the details of given storage lun Ids
 *
 * @param lunUniqueIds
 * @return array of <code>StorageLun</code> objects
 * @throws InvalidArgument
 * @throws InvalidSession
 * @throws StorageFault
 * @throws NotImplemented
 */
public synchronized StorageLun[] queryStorageLuns(String[] lunUniqueIds) throws InvalidArgument, StorageFault, NotImplemented, InvalidSession {
    final String methodName = "queryStorageLuns(): ";
    log.debug(methodName + "Entry");
    List<StorageLun> storageLunList = 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");
        }
        if (Util.isEmpty(lunUniqueIds)) {
            throw FaultUtil.InvalidArgument("Given LUN Ids are invalid");
        }
        for (String inputLunId : lunUniqueIds) {
            if (!Util.isEmpty(inputLunId)) {
                if (!inputLunId.startsWith(VOLUME_IDENTIFIER_PREFIX)) {
                    throw FaultUtil.InvalidArgument("Given LUN Id is invalid: " + inputLunId);
                }
            } else {
                throw FaultUtil.InvalidArgument("Given LUN Id is invalid: " + inputLunId);
            }
        }
        // List<String> inputLunIdList = Arrays.asList(lunUniqueIds);
        List<String> existingVolIds = new ArrayList<String>();
        this.setVolumeIds();
        for (String inputLunId : lunUniqueIds) {
            if (_reportedVolumeIdList.contains(inputLunId)) {
                existingVolIds.add(inputLunId);
            }
        }
        storageLunList = new ArrayList<StorageLun>();
        List<Volume> volumeList = null;
        volumeList = _syncManager.getVolumeDetailList(existingVolIds);
        for (Volume volume : volumeList) {
            StorageLun lun = new StorageLun();
            lun.setUniqueIdentifier(volume.getId());
            Long volumeCapacityInMB = (long) (volume.getRequestedCapacityInGB() * 1024);
            Long volumeUsedCapacityInMB = (long) (volume.getAllocatedCapacityInGB() * 1024);
            lun.setCapacityInMB(volumeCapacityInMB);
            lun.setDisplayName(volume.getName());
            lun.setDrsManagementPermitted(true);
            String esxLunId = "naa.";
            if (volume.getWWN() != null) {
                esxLunId += volume.getWWN().toLowerCase();
            }
            lun.setEsxLunIdentifier(esxLunId);
            lun.setThinProvisioned(volume.isThinlyProvisioned());
            String alarmStatus = _alarmManager.getThinlyProvisionedStatus(_syncManager, volume);
            lun.setThinProvisioningStatus(alarmStatus);
            lun.setUsedSpaceInMB(volumeUsedCapacityInMB);
            if (log.isDebugEnabled()) {
                log.debug(methodName + " Lun detail: id[" + lun.getUniqueIdentifier() + "] ESXLunIdentifier[" + lun.getEsxLunIdentifier() + "] capacityInMB[" + lun.getCapacityInMB() + "] name[" + lun.getDisplayName() + "] DRSManagementPermitted[" + lun.getDrsManagementPermitted() + "] thinProvisioned[" + lun.getThinProvisioned() + "] thinProvisioningStatus[" + lun.getThinProvisioningStatus() + "] usedSpaceInMB[" + lun.getUsedSpaceInMB() + "]");
            }
            storageLunList.add(lun);
        }
    } 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 LUN list of size[" + storageLunList.size() + "]");
    return storageLunList.toArray(new StorageLun[0]);
}
Also used : ArrayList(java.util.ArrayList) NotImplemented(com.vmware.vim.vasa._1_0.NotImplemented) StorageLun(com.vmware.vim.vasa._1_0.data.xsd.StorageLun) Volume(com.emc.storageos.vasa.data.internal.Volume) InvalidArgument(com.vmware.vim.vasa._1_0.InvalidArgument) SOSFailure(com.emc.storageos.vasa.fault.SOSFailure)

Example 4 with NotImplemented

use of com.vmware.vim.vasa._1_0.NotImplemented in project coprhd-controller by CoprHD.

the class SOSManager method queryStoragePorts.

/**
 * Makes a call to Bourne to get the details of given storage ports
 *
 * @param portIds
 * @return array of <code>StoragePort</code> objects
 * @throws InvalidArgument
 * @throws InvalidSession
 * @throws StorageFault
 * @throws NotImplemented
 */
public synchronized StoragePort[] queryStoragePorts(String[] portIds) throws InvalidArgument, InvalidSession, StorageFault, NotImplemented {
    final String methodName = "queryStoragePorts(): ";
    log.debug(methodName + "Entry");
    List<StoragePort> retStoragePorts = 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");
        }
        List<com.emc.storageos.vasa.data.internal.StoragePort> portList = null;
        // try {
        if (Util.isEmpty(portIds)) {
            portList = this.getStoragePorts();
        } else {
            for (String inputPortId : portIds) {
                if (!inputPortId.startsWith(STORAGEPORT_IDENTIFIER_PREFIX)) {
                    throw FaultUtil.InvalidArgument("Given portId is invalid: " + inputPortId);
                }
            }
            List<String> portIdList = Arrays.asList(portIds);
            portList = this.getStoragePorts(portIdList);
        }
        retStoragePorts = new ArrayList<StoragePort>();
        for (com.emc.storageos.vasa.data.internal.StoragePort storagePortDetail : portList) {
            String portType = storagePortDetail.getTransportType();
            String portNetworkId = storagePortDetail.getPortNetworkId();
            log.trace(methodName + "port type is [" + portType + "]");
            log.trace(methodName + "port nework Id is [" + portNetworkId + "]");
            StoragePort returnStoragePort = new StoragePort();
            returnStoragePort.setUniqueIdentifier(storagePortDetail.getId());
            returnStoragePort.addAlternateName(storagePortDetail.getPortName());
            if ("FC".equalsIgnoreCase(portType)) {
                log.trace(methodName + "setting port WWN as port network ID ");
                returnStoragePort.setPortWwn(portNetworkId);
                returnStoragePort.setPortType(BlockEnum.FC.getValue());
            } else if ("ISCSI".equalsIgnoreCase(portType)) {
                log.trace(methodName + "setting iSCSI identifier as port network ID ");
                returnStoragePort.setIscsiIdentifier(portNetworkId);
                returnStoragePort.setPortType(BlockEnum.ISCSI.getValue());
            } else if ("IP".equalsIgnoreCase(portType)) {
                log.trace(methodName + "setting node WWN as port network ID ");
                returnStoragePort.setNodeWwn(portNetworkId);
                returnStoragePort.setPortType(BlockEnum.Other.getValue());
            }
            retStoragePorts.add(returnStoragePort);
        }
    } 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 storage ports of size[" + retStoragePorts.size() + "]");
    return retStoragePorts.toArray(new StoragePort[0]);
}
Also used : StoragePort(com.vmware.vim.vasa._1_0.data.xsd.StoragePort) NotImplemented(com.vmware.vim.vasa._1_0.NotImplemented) InvalidArgument(com.vmware.vim.vasa._1_0.InvalidArgument)

Example 5 with NotImplemented

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

Aggregations

InvalidArgument (com.vmware.vim.vasa._1_0.InvalidArgument)10 NotImplemented (com.vmware.vim.vasa._1_0.NotImplemented)10 SOSFailure (com.emc.storageos.vasa.fault.SOSFailure)6 ArrayList (java.util.ArrayList)6 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)2 Volume (com.emc.storageos.vasa.data.internal.Volume)2 StorageFault (com.vmware.vim.vasa._1_0.StorageFault)2 CoS (com.emc.storageos.vasa.data.internal.CoS)1 EventList (com.emc.storageos.vasa.data.internal.Event.EventList)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 StorageProcessor (com.vmware.vim.vasa._1_0.data.xsd.StorageProcessor)1 List (java.util.List)1