use of com.emc.storageos.computesystemcontroller.hostmountadapters.LinuxMountUtils 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