use of com.emc.storageos.db.client.model.FileMountInfo 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.model.FileMountInfo in project coprhd-controller by CoprHD.
the class ComputeSystemControllerImpl method removeFromFSTabRollBack.
public void removeFromFSTabRollBack(URI hostId, String mountPath, URI resId, String stepId) {
try {
HostMountAdapter adapter = getMountAdapters().get(_dbClient.queryObject(Host.class, hostId).getType());
WorkflowStepCompleter.stepExecuting(stepId);
FileMountInfo fsMount = getMountInfo(hostId, mountPath, resId);
List<String> lockKeys = new ArrayList<String>();
lockKeys.add(ControllerLockingUtil.getMountHostKey(_dbClient, hostId));
_workflowService.acquireWorkflowStepLocks(stepId, lockKeys, LockTimeoutValue.get(LockType.FILE_MOUNT_OPERATIONS));
adapter.addToFSTab(hostId, mountPath, resId, fsMount.getSubDirectory(), fsMount.getSecurityType(), "auto");
WorkflowStepCompleter.stepSucceded(stepId);
} catch (ControllerException e) {
WorkflowStepCompleter.stepFailed(stepId, e);
throw e;
} catch (Exception ex) {
WorkflowStepCompleter.stepFailed(stepId, APIException.badRequests.commandFailedToComplete(ex.getMessage()));
throw ex;
}
}
use of com.emc.storageos.db.client.model.FileMountInfo in project coprhd-controller by CoprHD.
the class FileOperationUtils method queryDBFSMounts.
public static List<MountInfo> queryDBFSMounts(URI fsId, DbClient dbClient) {
_log.info("Querying File System mounts using FsId {}", fsId);
List<MountInfo> fsMounts = new ArrayList<MountInfo>();
try {
ContainmentConstraint containmentConstraint = ContainmentConstraint.Factory.getFileMountsConstraint(fsId);
List<FileMountInfo> fsDBMounts = CustomQueryUtility.queryActiveResourcesByConstraint(dbClient, FileMountInfo.class, containmentConstraint);
if (fsDBMounts != null && !fsDBMounts.isEmpty()) {
for (FileMountInfo dbMount : fsDBMounts) {
MountInfo mountInfo = new MountInfo();
getMountInfo(dbMount, mountInfo);
fsMounts.add(mountInfo);
}
}
return fsMounts;
} catch (Exception e) {
_log.error("Error while querying {}", e);
}
return fsMounts;
}
use of com.emc.storageos.db.client.model.FileMountInfo in project coprhd-controller by CoprHD.
the class FileOperationUtils method queryDBHostMounts.
/**
* Method to get the list file system mounts which are mount on a host
*
* @param host
* host system URI
* @return List<MountInfo> List of mount infos
*/
public static List<MountInfo> queryDBHostMounts(URI host, DbClient dbClient) {
_log.info("Querying NFS mounts for host {}", host);
List<MountInfo> hostMounts = new ArrayList<MountInfo>();
try {
ContainmentConstraint containmentConstraint = ContainmentConstraint.Factory.getHostFileMountsConstraint(host);
List<FileMountInfo> fileMounts = CustomQueryUtility.queryActiveResourcesByConstraint(dbClient, FileMountInfo.class, containmentConstraint);
if (fileMounts != null && !fileMounts.isEmpty()) {
for (FileMountInfo dbMount : fileMounts) {
MountInfo mountInfo = new MountInfo();
getMountInfo(dbMount, mountInfo);
hostMounts.add(mountInfo);
}
}
return hostMounts;
} catch (Exception e) {
_log.error("Error while querying {}", e);
}
return hostMounts;
}
use of com.emc.storageos.db.client.model.FileMountInfo 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;
}
Aggregations