Search in sources :

Example 11 with SOSFailure

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

the class SyncManager method fetchDetailsOfAllBlockCos.

/**
 * Returns list of all active Block related CoSes with their details
 *
 * @return list of all active Block related CoSes with their details
 * @throws SOSFailure
 */
private List<CoS> fetchDetailsOfAllBlockCos() throws SOSFailure {
    final String methodName = "fetchDetailsOfAllBlockCos(): ";
    log.trace(methodName + "Entry");
    final String BLOCK_COS_DETAIL_URI = "/block/vpools/%s";
    List<CoS> blockCosIdList = new ArrayList<CoS>();
    try {
        for (String cosId : _blockCosIdList) {
            CoS.BlockCoS cos = _client.queryObject(String.format(BLOCK_COS_DETAIL_URI, cosId), CoS.BlockCoS.class);
            if (cos.isInactive() == false && cos.getId() != null) {
                blockCosIdList.add(cos);
                log.trace(methodName + cos);
            }
        }
        log.trace(methodName + "Exit returning cos list of size[" + blockCosIdList.size() + "]");
        return blockCosIdList;
    } 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) CoS(com.emc.storageos.vasa.data.internal.CoS) SOSFailure(com.emc.storageos.vasa.fault.SOSFailure) ArrayList(java.util.ArrayList) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException)

Example 12 with SOSFailure

use of com.emc.storageos.vasa.fault.SOSFailure 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 13 with SOSFailure

use of com.emc.storageos.vasa.fault.SOSFailure 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)

Example 14 with SOSFailure

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

the class SyncManager method fetchDetailsOfAllFileCos.

/**
 * Returns list of all active Block related CoSes with their details
 *
 * @return list of all active Block related CoSes with their details
 * @throws SOSFailure
 */
private List<CoS> fetchDetailsOfAllFileCos() throws SOSFailure {
    final String methodName = "fetchDetailsOfAllFileCos(): ";
    log.trace(methodName + "Entry");
    final String FILE_COS_DETAIL_URI = "/file/vpools/%s";
    List<CoS> fileCosIdList = new ArrayList<CoS>();
    try {
        for (String cosId : _fileCosIdList) {
            CoS.FileCoS cos = _client.queryObject(String.format(FILE_COS_DETAIL_URI, cosId), CoS.FileCoS.class);
            if (cos.isInactive() == false && cos.getId() != null) {
                fileCosIdList.add(cos);
                log.trace(methodName + cos);
            }
        }
        log.trace(methodName + "Exit returning cos list of size[" + fileCosIdList.size() + "]");
        return fileCosIdList;
    } 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) CoS(com.emc.storageos.vasa.data.internal.CoS) SOSFailure(com.emc.storageos.vasa.fault.SOSFailure) ArrayList(java.util.ArrayList) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException)

Example 15 with SOSFailure

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

the class SyncManager method fetchAssociatedPoolOfVolume.

public synchronized AssociatedPool fetchAssociatedPoolOfVolume(String volumeID) throws SOSFailure {
    final String methodName = "fetchAssociatedPoolForVolume(): ";
    log.trace(methodName + "Entry with volumeID[" + volumeID + "]");
    final String ASSOCIATED_POOL_OF_VOLUME_URI = "/block/volumes/%s/storage-pool";
    AssociatedPool associatedPool = null;
    try {
        associatedPool = _client.queryObject(String.format(ASSOCIATED_POOL_OF_VOLUME_URI, volumeID), Volume.AssociatedPool.class);
        associatedPool = associatedPool.getStoragepool() == null ? null : associatedPool;
    } 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 associated storage pool[" + associatedPool + "]");
    return associatedPool;
}
Also used : AssociatedPool(com.emc.storageos.vasa.data.internal.Volume.AssociatedPool) UniformInterfaceException(com.sun.jersey.api.client.UniformInterfaceException) SOSFailure(com.emc.storageos.vasa.fault.SOSFailure) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException)

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