use of com.emc.storageos.db.client.model.FileMountInfo in project coprhd-controller by CoprHD.
the class ComputeSystemControllerImpl method addStepsForUnmountDevice.
public String addStepsForUnmountDevice(Workflow workflow, HostDeviceInputOutput args) {
// the wait for key returned by previous call
String waitFor = null;
FileMountInfo fsMount = getMountInfo(args.getHostId(), args.getMountPath(), args.getResId());
args.setFsType(fsMount.getFsType());
args.setSecurity(fsMount.getSecurityType());
args.setSubDirectory(fsMount.getSubDirectory());
_log.info("Generating steps for mounting device");
// create a step
String hostname = _dbClient.queryObject(Host.class, args.getHostId()).getHostName();
String hostType = getHostType(args.getHostId());
waitFor = workflow.createStep(null, String.format("Unmounting device: %s for host: %s", args.getMountPath(), hostname), null, args.getHostId(), hostType, this.getClass(), unmountDeviceMethod(args), unmountRollBackMethod(args), null);
waitFor = workflow.createStep(null, String.format("removing from etc/fstab:%n%s for host: %s", args.getMountPath(), hostname), waitFor, args.getHostId(), hostType, this.getClass(), removeFromFSTabMethod(args), removeFromFSTabRollBackMethod(args), null);
waitFor = workflow.createStep(null, String.format("Delete Directory:%n%s for host: %s", args.getMountPath(), hostname), waitFor, args.getHostId(), hostType, this.getClass(), deleteDirectoryMethod(args), createDirectoryMethod(args), null);
return waitFor;
}
use of com.emc.storageos.db.client.model.FileMountInfo in project coprhd-controller by CoprHD.
the class ComputeSystemControllerImpl method createMountDBEntry.
private void createMountDBEntry(URI resId, URI hostId, String mountPath, String subDir, String security, String fsType) {
FileMountInfo fsMount = new FileMountInfo();
fsMount.setId(URIUtil.createId(FileMountInfo.class));
fsMount.setFsId(resId);
fsMount.setFsType(fsType);
fsMount.setHostId(hostId);
fsMount.setMountPath(mountPath);
fsMount.setSecurityType(security);
fsMount.setSubDirectory(subDir);
_log.debug("Storing New DB Mount Info {}" + fsMount);
_dbClient.createObject(fsMount);
}
use of com.emc.storageos.db.client.model.FileMountInfo in project coprhd-controller by CoprHD.
the class FileDeviceController method checkIfMountExistsOnHost.
public void checkIfMountExistsOnHost(URI fsId, String opId) {
try {
WorkflowStepCompleter.stepExecuting(opId);
ContainmentConstraint containmentConstraint = ContainmentConstraint.Factory.getFileMountsConstraint(fsId);
List<FileMountInfo> fsDBMounts = CustomQueryUtility.queryActiveResourcesByConstraint(_dbClient, FileMountInfo.class, containmentConstraint);
FileShare fs = _dbClient.queryObject(FileShare.class, fsId);
for (FileMountInfo fsMount : fsDBMounts) {
LinuxMountUtils mountUtils = new LinuxMountUtils(_dbClient.queryObject(Host.class, fsMount.getHostId()));
ExportRule export = FileOperationUtils.findExport(fs, fsMount.getSubDirectory(), fsMount.getSecurityType(), _dbClient);
if (mountUtils.verifyMountPoints(export.getMountPoint(), fsMount.getMountPath())) {
String errMsg = new String("delete file system from ViPR database failed because mounts exist for file system " + fs.getLabel() + " and once deleted the mounts cannot be ingested into ViPR");
final ServiceCoded serviceCoded = DeviceControllerException.errors.jobFailedOpMsg(OperationTypeEnum.DELETE_FILE_SYSTEM.toString(), errMsg);
WorkflowStepCompleter.stepFailed(opId, serviceCoded);
}
}
for (FileMountInfo fsMount : fsDBMounts) {
fsMount.setInactive(true);
}
_dbClient.updateObject(fsDBMounts);
WorkflowStepCompleter.stepSucceded(opId);
} catch (ControllerException ex) {
WorkflowStepCompleter.stepFailed(opId, ex);
_log.error("Couldn't verify dependencies: ", fsId);
throw ex;
}
}
Aggregations