Search in sources :

Example 1 with AssociatedResource

use of com.emc.storageos.vasa.data.internal.FileShare.AssociatedResource 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

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