Search in sources :

Example 31 with ContainmentConstraint

use of com.emc.storageos.db.client.constraint.ContainmentConstraint in project coprhd-controller by CoprHD.

the class ComputeSystemControllerImpl method getMountInfo.

public FileMountInfo getMountInfo(URI hostId, String mountPath, URI resId) {
    ContainmentConstraint containmentConstraint = ContainmentConstraint.Factory.getFileMountsConstraint(resId);
    List<FileMountInfo> fsDBMounts = CustomQueryUtility.queryActiveResourcesByConstraint(_dbClient, FileMountInfo.class, containmentConstraint);
    if (fsDBMounts != null && !fsDBMounts.isEmpty()) {
        for (FileMountInfo dbMount : fsDBMounts) {
            if (dbMount.getHostId().toString().equalsIgnoreCase(hostId.toString()) && dbMount.getMountPath().equalsIgnoreCase(mountPath)) {
                _log.debug("Found DB entry with mountpath {} " + mountPath);
                return dbMount;
            }
        }
    }
    return null;
}
Also used : ContainmentConstraint(com.emc.storageos.db.client.constraint.ContainmentConstraint) FileMountInfo(com.emc.storageos.db.client.model.FileMountInfo)

Example 32 with ContainmentConstraint

use of com.emc.storageos.db.client.constraint.ContainmentConstraint in project coprhd-controller by CoprHD.

the class UnManagedFilesystemService method queryDBFSExports.

private List<UnManagedFileExportRule> queryDBFSExports(UnManagedFileSystem fs) {
    _logger.info("Querying all ExportRules Using FsId {}", fs.getId());
    try {
        ContainmentConstraint containmentConstraint = ContainmentConstraint.Factory.getUnManagedFileExportRulesConstraint(fs.getId());
        List<UnManagedFileExportRule> fileExportRules = CustomQueryUtility.queryActiveResourcesByConstraint(_dbClient, UnManagedFileExportRule.class, containmentConstraint);
        return fileExportRules;
    } catch (Exception e) {
        _logger.error("Error while querying {}", e);
    }
    return new ArrayList<UnManagedFileExportRule>();
}
Also used : ContainmentConstraint(com.emc.storageos.db.client.constraint.ContainmentConstraint) UnManagedFileExportRule(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedFileExportRule) ArrayList(java.util.ArrayList) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) IOException(java.io.IOException)

Example 33 with ContainmentConstraint

use of com.emc.storageos.db.client.constraint.ContainmentConstraint in project coprhd-controller by CoprHD.

the class UnManagedFilesystemService method queryDBNfsShares.

/**
 * Query DB for UnManaged FileSystem's NFS ACL
 *
 * @param fs
 * @return List<UnManagedNFSShareACLs
 */
private List<UnManagedNFSShareACL> queryDBNfsShares(UnManagedFileSystem fs) {
    _logger.info("Querying All Nfs Share ACLs Using FsId {}", fs.getId());
    try {
        ContainmentConstraint containmentConstraint = ContainmentConstraint.Factory.getUnManagedNfsShareAclsConstraint(fs.getId());
        List<UnManagedNFSShareACL> nfsShareACLList = CustomQueryUtility.queryActiveResourcesByConstraint(_dbClient, UnManagedNFSShareACL.class, containmentConstraint);
        return nfsShareACLList;
    } catch (Exception e) {
        _logger.error("Error while querying {}", e);
    }
    return new ArrayList<UnManagedNFSShareACL>();
}
Also used : ContainmentConstraint(com.emc.storageos.db.client.constraint.ContainmentConstraint) ArrayList(java.util.ArrayList) UnManagedNFSShareACL(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedNFSShareACL) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) IOException(java.io.IOException)

Example 34 with ContainmentConstraint

use of com.emc.storageos.db.client.constraint.ContainmentConstraint in project coprhd-controller by CoprHD.

the class FileService method queryDBQuotaDirectories.

private List<QuotaDirectory> queryDBQuotaDirectories(FileShare fs) {
    _log.info("Querying all quota directories Using FsId {}", fs.getId());
    try {
        ContainmentConstraint containmentConstraint = ContainmentConstraint.Factory.getQuotaDirectoryConstraint(fs.getId());
        List<QuotaDirectory> fsQuotaDirs = CustomQueryUtility.queryActiveResourcesByConstraint(_dbClient, QuotaDirectory.class, containmentConstraint);
        return fsQuotaDirs;
    } catch (Exception e) {
        _log.error("Error while querying {}", e);
    }
    return null;
}
Also used : ContainmentConstraint(com.emc.storageos.db.client.constraint.ContainmentConstraint) QuotaDirectory(com.emc.storageos.db.client.model.QuotaDirectory) FileShareQuotaDirectory(com.emc.storageos.volumecontroller.FileShareQuotaDirectory) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) URISyntaxException(java.net.URISyntaxException) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException) BadRequestException(com.emc.storageos.svcs.errorhandling.resources.BadRequestException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException)

Example 35 with ContainmentConstraint

use of com.emc.storageos.db.client.constraint.ContainmentConstraint in project coprhd-controller by CoprHD.

the class FileService method queryDBFSExports.

private List<FileExportRule> queryDBFSExports(FileShare fs) {
    _log.info("Querying all ExportRules Using FsId {}", fs.getId());
    try {
        ContainmentConstraint containmentConstraint = ContainmentConstraint.Factory.getFileExportRulesConstraint(fs.getId());
        List<FileExportRule> fileExportRules = CustomQueryUtility.queryActiveResourcesByConstraint(_dbClient, FileExportRule.class, containmentConstraint);
        return fileExportRules;
    } catch (Exception e) {
        _log.error("Error while querying {}", e);
    }
    return null;
}
Also used : ContainmentConstraint(com.emc.storageos.db.client.constraint.ContainmentConstraint) FileExportRule(com.emc.storageos.db.client.model.FileExportRule) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) URISyntaxException(java.net.URISyntaxException) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException) BadRequestException(com.emc.storageos.svcs.errorhandling.resources.BadRequestException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException)

Aggregations

ContainmentConstraint (com.emc.storageos.db.client.constraint.ContainmentConstraint)47 APIException (com.emc.storageos.svcs.errorhandling.resources.APIException)18 ArrayList (java.util.ArrayList)17 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)15 URI (java.net.URI)15 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)12 ControllerException (com.emc.storageos.volumecontroller.ControllerException)11 URISyntaxException (java.net.URISyntaxException)11 FileExportRule (com.emc.storageos.db.client.model.FileExportRule)10 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)9 FileShare (com.emc.storageos.db.client.model.FileShare)7 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)7 SMBFileShare (com.emc.storageos.db.client.model.SMBFileShare)6 WorkflowException (com.emc.storageos.workflow.WorkflowException)6 ContainmentConstraintImpl (com.emc.storageos.db.client.constraint.impl.ContainmentConstraintImpl)5 FileMountInfo (com.emc.storageos.db.client.model.FileMountInfo)5 CifsShareACL (com.emc.storageos.db.client.model.CifsShareACL)4 NFSShareACL (com.emc.storageos.db.client.model.NFSShareACL)4 ExportRule (com.emc.storageos.model.file.ExportRule)4 BadRequestException (com.emc.storageos.svcs.errorhandling.resources.BadRequestException)4