use of com.emc.storageos.db.client.constraint.ContainmentConstraint in project coprhd-controller by CoprHD.
the class FileQuotaDirectoryService 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;
}
use of com.emc.storageos.db.client.constraint.ContainmentConstraint in project coprhd-controller by CoprHD.
the class ComputeSystemControllerImpl method removeMountDBEntry.
private void removeMountDBEntry(URI resId, URI hostId, String mountPath) {
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);
// Deactivate the entry!!
dbMount.setInactive(true);
_dbClient.updateObject(dbMount);
}
}
}
}
use of com.emc.storageos.db.client.constraint.ContainmentConstraint in project coprhd-controller by CoprHD.
the class UnManagedFilesystemService method queryDBCifsShares.
private List<UnManagedCifsShareACL> queryDBCifsShares(UnManagedFileSystem fs) {
_logger.info("Querying All Cifs Share ACLs Using FsId {}", fs.getId());
try {
ContainmentConstraint containmentConstraint = ContainmentConstraint.Factory.getUnManagedCifsShareAclsConstraint(fs.getId());
List<UnManagedCifsShareACL> cifsShareACLList = CustomQueryUtility.queryActiveResourcesByConstraint(_dbClient, UnManagedCifsShareACL.class, containmentConstraint);
return cifsShareACLList;
} catch (Exception e) {
_logger.error("Error while querying {}", e);
}
return new ArrayList<UnManagedCifsShareACL>();
}
use of com.emc.storageos.db.client.constraint.ContainmentConstraint in project coprhd-controller by CoprHD.
the class BucketACLUtility method queryDbBucketACL.
private List<ObjectBucketACL> queryDbBucketACL() {
try {
ContainmentConstraint containmentConstraint = null;
_log.info("Querying DB for ACL of bucket {} ", this.bucketName);
containmentConstraint = ContainmentConstraint.Factory.getBucketAclsConstraint(this.bucketId);
List<ObjectBucketACL> dbBucketBucketAcl = CustomQueryUtility.queryActiveResourcesByConstraint(this.dbClient, ObjectBucketACL.class, containmentConstraint);
return dbBucketBucketAcl;
} catch (Exception e) {
_log.error("Error while querying DB for ACL of a bucket {}", e);
}
return null;
}
use of com.emc.storageos.db.client.constraint.ContainmentConstraint in project coprhd-controller by CoprHD.
the class ExportUtils method getBlockObjectExportMasks.
/**
* Fetches all the export masks in which a block object is member
*
* @param blockObject the block object
* @param dbClient an instance of {@link DbClient}
* @return a map of export masks in which a block object is member
*/
private static Map<ExportMask, List<ExportGroup>> getBlockObjectExportMasks(BlockObject blockObject, DbClient dbClient) {
Map<ExportMask, List<ExportGroup>> exportMasks = new HashMap<ExportMask, List<ExportGroup>>();
ContainmentConstraint constraint = ContainmentConstraint.Factory.getBlockObjectExportGroupConstraint(blockObject.getId());
// permission are checked by the API service - no need to check again
List<ExportGroup> exportGroups = getExportGroupsByConstraint(constraint, dbClient, null, null);
List<ExportMask> masks = getMasksForExportGroups(exportGroups, dbClient);
// Get the actual export block object associated with the snapshot (if applicable)
BlockObject bo = Volume.fetchExportMaskBlockObject(dbClient, blockObject.getId());
if (bo != null) {
for (ExportMask exportMask : masks) {
if (exportMask != null && !exportMask.getInactive() && exportMask.hasVolume(bo.getId()) && (exportMask.getInitiators() != null || exportMask.getExistingInitiators() != null)) {
List<ExportGroup> maskGroups = new ArrayList<ExportGroup>();
exportMasks.put(exportMask, maskGroups);
for (ExportGroup group : exportGroups) {
if (group.getExportMasks() != null && group.getExportMasks().contains(exportMask.getId().toString())) {
maskGroups.add(group);
}
}
}
}
_log.debug("Found {} export masks for block object {}", exportMasks.size(), bo.getLabel());
}
return exportMasks;
}
Aggregations