Search in sources :

Example 16 with SOSFailure

use of com.emc.storageos.vasa.fault.SOSFailure in project coprhd-controller by CoprHD.

the class SyncManager method fetchFileShareDetailById.

private List<FileShare> fetchFileShareDetailById(List<String> fileSystemIdList) throws SOSFailure {
    final String methodName = "fetchFileShareDetailById(): ";
    log.trace(methodName + "Entry with input: " + fileSystemIdList);
    List<FileShare> fileshareDetailList = new ArrayList<FileShare>();
    final String FILESYSTEM_DETAIL_URI = "/file/filesystems/%s";
    try {
        if (fileSystemIdList != null) {
            for (String fileSystemId : fileSystemIdList) {
                FileShare fileshare = _client.queryObject(String.format(FILESYSTEM_DETAIL_URI, fileSystemId), FileShare.class);
                if (fileshare != null) {
                    if (!fileshare.isInactive() && fileshare.getId() != null) {
                        fileshareDetailList.add(fileshare);
                        log.trace(methodName + fileshare);
                    }
                }
            }
        }
    } catch (NoSuchAlgorithmException e) {
        log.error(methodName + "NoSuchAlgorithmException occured", e);
        throw new SOSFailure(e);
    } catch (UniformInterfaceException e) {
        log.error(methodName + "UniformInterfaceException occured", e);
        throw new SOSFailure(e);
    }
    log.trace(methodName + "Exit returning file system list of size[" + fileshareDetailList.size() + "]");
    return fileshareDetailList;
}
Also used : UniformInterfaceException(com.sun.jersey.api.client.UniformInterfaceException) SOSFailure(com.emc.storageos.vasa.fault.SOSFailure) ArrayList(java.util.ArrayList) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) FileShare(com.emc.storageos.vasa.data.internal.FileShare)

Example 17 with SOSFailure

use of com.emc.storageos.vasa.fault.SOSFailure in project coprhd-controller by CoprHD.

the class SyncManager method fetchBlockCosIdList.

/**
 * Returns list of file Cos Ids
 *
 * @return list of file Cos Ids
 * @throws SOSFailure
 */
private List<String> fetchBlockCosIdList() throws SOSFailure {
    final String methodName = "fetchBlockCosIdList(): ";
    log.trace(methodName + "Entry");
    final String BLOCK_COS_URI = "/block/vpools";
    List<String> blockCosIdList = new ArrayList<String>();
    try {
        CoSList cosElemList = _client.queryObject(BLOCK_COS_URI, CoSList.class);
        if (cosElemList != null && cosElemList.getCosElements() != null) {
            for (CoSElement elem : cosElemList.getCosElements()) {
                if (elem != null) {
                    blockCosIdList.add(elem.getId());
                }
            }
        }
        log.trace(methodName + "Block CoS Ids: " + blockCosIdList);
        if (cosElemList != null && blockCosIdList != null) {
            log.trace(methodName + "Exit returning cos list of size[" + blockCosIdList.size() + "]");
            return blockCosIdList;
        }
        log.trace(methodName + "Exit returning cos list of size[0]");
        return new ArrayList<String>();
    } catch (NoSuchAlgorithmException e) {
        log.error(methodName + "NoSuchAlgorithmException occured", e);
        throw new SOSFailure(e);
    } catch (UniformInterfaceException e) {
        log.error(methodName + "UniformInterfaceException occured", e);
        throw new SOSFailure(e);
    }
}
Also used : UniformInterfaceException(com.sun.jersey.api.client.UniformInterfaceException) CoSList(com.emc.storageos.vasa.data.internal.CoS.CoSList) CoSElement(com.emc.storageos.vasa.data.internal.CoS.CoSElement) SOSFailure(com.emc.storageos.vasa.fault.SOSFailure) ArrayList(java.util.ArrayList) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException)

Example 18 with SOSFailure

use of com.emc.storageos.vasa.fault.SOSFailure in project coprhd-controller by CoprHD.

the class SOSAlarmManager method getThinlyProvisionStatusOfHAVolumes.

private String getThinlyProvisionStatusOfHAVolumes(SyncManager manager, List<HighAvailabilityVolume> haVolList) throws StorageFault {
    final String methodName = "getThinlyProvisionStatusOfHAVolumes(): ";
    log.debug(methodName + "Entry with input: haVolList" + haVolList);
    String alarmStatus = null;
    StoragePool storagePool = null;
    Set<String> alarmSet = new HashSet<String>();
    for (HighAvailabilityVolume haVol : haVolList) {
        try {
            AssociatedPool associatedPool = manager.fetchAssociatedPoolOfVolume(haVol.getId());
            if (log.isTraceEnabled()) {
                log.trace(methodName + haVol.getId() + " is associated with " + associatedPool);
            }
            storagePool = manager.fetchStoragePoolByHref(associatedPool.getStoragepool().getLink().getHref());
            alarmStatus = this.getThinlyProvisionStatusOfStoragePool(storagePool);
            alarmSet.add(alarmStatus);
        } catch (SOSFailure e) {
            log.error(methodName + "SOSFailure failure occured", e);
            throw FaultUtil.StorageFault(e);
        }
    }
    if (alarmSet.contains(AlarmStatusEnum.Red.getValue())) {
        log.debug(methodName + "Exit returning [RED]");
        return AlarmStatusEnum.Red.getValue();
    }
    if (alarmSet.contains(AlarmStatusEnum.Yellow.getValue())) {
        log.debug(methodName + "Exit returning [YELLOW]");
        return AlarmStatusEnum.Yellow.getValue();
    }
    log.debug(methodName + "Exit returning [GREEN]");
    return AlarmStatusEnum.Green.getValue();
}
Also used : HighAvailabilityVolume(com.emc.storageos.vasa.data.internal.Volume.HighAvailabilityVolume) AssociatedPool(com.emc.storageos.vasa.data.internal.Volume.AssociatedPool) StoragePool(com.emc.storageos.vasa.data.internal.StoragePool) SOSFailure(com.emc.storageos.vasa.fault.SOSFailure) HashSet(java.util.HashSet)

Example 19 with SOSFailure

use of com.emc.storageos.vasa.fault.SOSFailure in project coprhd-controller by CoprHD.

the class SOSManager method queryStorageFileSystems.

/**
 * Makes a call to Bourne to get the details of given file system Ids
 *
 * @param filesystemIds
 * @return array of <code>StorageFileSystem</code> objects
 * @throws InvalidArgument
 * @throws InvalidSession
 * @throws StorageFault
 * @throws NotImplemented
 * @throws NotFound
 */
public synchronized StorageFileSystem[] queryStorageFileSystems(String[] fsUniqueIds) throws InvalidArgument, StorageFault, NotImplemented, InvalidSession {
    final String methodName = "queryStorageFileSystems(): ";
    log.debug(methodName + "Entry");
    List<StorageFileSystem> list = null;
    try {
        Boolean supportsFile = new Boolean(_config.getConfigValue("config/service/storageTopology/storageArray/support-file-profile"));
        if (!supportsFile) {
            log.error(methodName + " This function is not implemented");
            throw FaultUtil.NotImplemented("This function is not implemented");
        }
        if (Util.isEmpty(fsUniqueIds)) {
            throw FaultUtil.InvalidArgument("Given file system Ids are invalid");
        }
        for (String fsId : fsUniqueIds) {
            if (!Util.isEmpty(fsId)) {
                if (!fsId.startsWith(FILESYSTEM_IDENTIFIER_PREFIX)) {
                    throw FaultUtil.InvalidArgument("Given filesytem Id is invalid: " + fsId);
                }
            } else {
                throw FaultUtil.InvalidArgument("Given filesytem Id is invalid: " + fsId);
            }
        }
        this.setFileSystemIds();
        List<String> existingFsIdList = new ArrayList<String>();
        for (String inputFSId : fsUniqueIds) {
            if (_reportedFileSystemIdList.contains(inputFSId)) {
                existingFsIdList.add(inputFSId);
            }
        }
        list = new ArrayList<StorageFileSystem>();
        List<FileShare> fsList = _syncManager.getFileSystemDetailList(existingFsIdList);
        for (FileShare fileshare : fsList) {
            StorageFileSystem fileSystem = new StorageFileSystem();
            fileSystem.setUniqueIdentifier(fileshare.getId());
            if (fileshare.getProtocols().getProtocol().contains("NFS")) {
                fileSystem.setFileSystem(FileSystemEnum.NFS.getValue());
            } else if (fileshare.getProtocols().getProtocol().contains("NFSv4")) {
                fileSystem.setFileSystem(FileSystemEnum.NFS.getValue());
            } else {
                fileSystem.setFileSystem(FileSystemEnum.Other.getValue());
            }
            fileSystem.setFileSystemVersion(FileSystemVersionEnum.NFSV3_0.getValue());
            FileSystemInfo fsDetail = new FileSystemInfo();
            String fsNetworkId = "";
            if (fileshare.getStoragePort() != null && fileshare.getStorageController() != null) {
                String storageSystemId = fileshare.getStorageController().getId();
                String storagePortId = fileshare.getStoragePort().getId();
                com.emc.storageos.vasa.data.internal.StoragePort storagePort = _syncManager.getStoragePort(storageSystemId, storagePortId);
                fsNetworkId = storagePort.getPortNetworkId();
            }
            fsDetail.setIpAddress(fsNetworkId);
            fsDetail.setFileServerName(fsNetworkId);
            fsDetail.setFileSystemPath(fileshare.getMountPath());
            fileSystem.addFileSystemInfo(fsDetail);
            fileSystem.setNativeSnapshotSupported(true);
            fileSystem.setThinProvisioningStatus(AlarmStatusEnum.Green.getValue());
            if (log.isDebugEnabled()) {
                log.debug(methodName + "filesystem: id[" + fileSystem.getUniqueIdentifier() + "] type[" + fileSystem.getFileSystem() + "] version[" + fileSystem.getFileSystemVersion() + "] thinProvisioningStatus[" + fileSystem.getThinProvisioningStatus() + "] snapShotsupported[" + fileSystem.getNativeSnapshotSupported() + "] IpAddress[" + fileSystem.getFileSystemInfo()[0].getFileServerName() + "] serverName[" + fileSystem.getFileSystemInfo()[0].getFileServerName() + "] fileSystemPath[" + fileSystem.getFileSystemInfo()[0].getFileSystemPath() + "]");
            }
            list.add(fileSystem);
        }
    } 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 list of file systems of size[" + list.size() + "]");
    return list.toArray(new StorageFileSystem[0]);
}
Also used : ArrayList(java.util.ArrayList) NotImplemented(com.vmware.vim.vasa._1_0.NotImplemented) FileShare(com.emc.storageos.vasa.data.internal.FileShare) StorageFileSystem(com.vmware.vim.vasa._1_0.data.xsd.StorageFileSystem) FileSystemInfo(com.vmware.vim.vasa._1_0.data.xsd.FileSystemInfo) InvalidArgument(com.vmware.vim.vasa._1_0.InvalidArgument) SOSFailure(com.emc.storageos.vasa.fault.SOSFailure)

Example 20 with SOSFailure

use of com.emc.storageos.vasa.fault.SOSFailure in project coprhd-controller by CoprHD.

the class SOSManager method getCosIds.

/**
 * Makes a call to Bourne and returns list of storage capability Ids
 *
 * @return list of storage capability Ids
 * @throws StorageFault
 */
public List<String> getCosIds() throws StorageFault {
    final String methodName = "getCosIds(): ";
    log.debug(methodName + "Entry");
    List<String> idList = new ArrayList<String>();
    try {
        for (CoS cos : _syncManager.getCosDetailList()) {
            idList.add(cos.getId());
        }
    } catch (SOSFailure e) {
        log.error(methodName + "StorageOSFailure occured", e);
        throw FaultUtil.StorageFault(e);
    }
    log.debug(methodName + "Exit returning capability Ids of size[" + idList.size() + "]");
    return idList;
}
Also used : CoS(com.emc.storageos.vasa.data.internal.CoS) SOSFailure(com.emc.storageos.vasa.fault.SOSFailure) ArrayList(java.util.ArrayList)

Aggregations

SOSFailure (com.emc.storageos.vasa.fault.SOSFailure)29 UniformInterfaceException (com.sun.jersey.api.client.UniformInterfaceException)18 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)18 ArrayList (java.util.ArrayList)15 InvalidArgument (com.vmware.vim.vasa._1_0.InvalidArgument)7 NotImplemented (com.vmware.vim.vasa._1_0.NotImplemented)6 FileShare (com.emc.storageos.vasa.data.internal.FileShare)5 CoS (com.emc.storageos.vasa.data.internal.CoS)4 StoragePool (com.emc.storageos.vasa.data.internal.StoragePool)4 Volume (com.emc.storageos.vasa.data.internal.Volume)4 AssociatedPool (com.emc.storageos.vasa.data.internal.Volume.AssociatedPool)4 EventList (com.emc.storageos.vasa.data.internal.Event.EventList)3 BaseStorageEntity (com.vmware.vim.vasa._1_0.data.xsd.BaseStorageEntity)3 VasaAssociationObject (com.vmware.vim.vasa._1_0.data.xsd.VasaAssociationObject)3 CoSElement (com.emc.storageos.vasa.data.internal.CoS.CoSElement)2 CoSList (com.emc.storageos.vasa.data.internal.CoS.CoSList)2 FileSystemExports (com.emc.storageos.vasa.data.internal.FileShare.FileSystemExports)2 List (java.util.List)2 Event (com.emc.storageos.vasa.data.internal.Event)1 AssociatedResource (com.emc.storageos.vasa.data.internal.FileShare.AssociatedResource)1