Search in sources :

Example 1 with FileSystemExports

use of com.emc.storageos.vasa.data.internal.FileShare.FileSystemExports in project coprhd-controller by CoprHD.

the class SyncManager method fetchFileSystemExports.

private synchronized FileSystemExports fetchFileSystemExports(String fileSystemID) throws SOSFailure {
    final String methodName = "fetchFileSystemExports(): ";
    log.trace(methodName + "Entry with fileSystemID[" + fileSystemID + "]");
    final String FS_EXPORT_DETAIL_URI = "/file/filesystems/%s/exports";
    FileSystemExports exports = null;
    try {
        exports = _client.queryObject(String.format(FS_EXPORT_DETAIL_URI, fileSystemID), FileSystemExports.class);
    } 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: " + exports);
    return exports;
}
Also used : UniformInterfaceException(com.sun.jersey.api.client.UniformInterfaceException) SOSFailure(com.emc.storageos.vasa.fault.SOSFailure) FileSystemExports(com.emc.storageos.vasa.data.internal.FileShare.FileSystemExports) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException)

Example 2 with FileSystemExports

use of com.emc.storageos.vasa.data.internal.FileShare.FileSystemExports in project coprhd-controller by CoprHD.

the class SyncManager method fetchFileSystemIdByMountPath.

private String fetchFileSystemIdByMountPath(String mountPath) throws SOSFailure {
    final String methodName = "fetchFileSystemIdByMountPath(): ";
    final String FILESYSTEM_SEARCH_BY_MOUNTPATH = "/file/filesystems/search?mountPath=%s";
    log.trace(methodName + "Entry with input: mountPath[" + mountPath + "]");
    String filesystemId = null;
    try {
        SearchResults results = _client.queryObject(String.format(FILESYSTEM_SEARCH_BY_MOUNTPATH, mountPath), FileShare.SearchResults.class);
        if (results != null) {
            AssociatedResource resouce = results.getResource();
            if (resouce != null) {
                String tempFilesystemId = resouce.getId();
                FileSystemExports exports = fetchFileSystemExports(tempFilesystemId);
                if (exports != null && exports.getFsExportList() != null && !exports.getFsExportList().isEmpty()) {
                    filesystemId = tempFilesystemId;
                }
            }
        }
    } 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 filesystem ID[" + filesystemId + "]");
    return filesystemId;
}
Also used : UniformInterfaceException(com.sun.jersey.api.client.UniformInterfaceException) AssociatedResource(com.emc.storageos.vasa.data.internal.FileShare.AssociatedResource) SOSFailure(com.emc.storageos.vasa.fault.SOSFailure) FileSystemExports(com.emc.storageos.vasa.data.internal.FileShare.FileSystemExports) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) SearchResults(com.emc.storageos.vasa.data.internal.FileShare.SearchResults) FileShare(com.emc.storageos.vasa.data.internal.FileShare)

Aggregations

FileSystemExports (com.emc.storageos.vasa.data.internal.FileShare.FileSystemExports)2 SOSFailure (com.emc.storageos.vasa.fault.SOSFailure)2 UniformInterfaceException (com.sun.jersey.api.client.UniformInterfaceException)2 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)2 FileShare (com.emc.storageos.vasa.data.internal.FileShare)1 AssociatedResource (com.emc.storageos.vasa.data.internal.FileShare.AssociatedResource)1 SearchResults (com.emc.storageos.vasa.data.internal.FileShare.SearchResults)1