Search in sources :

Example 1 with LinuxMountUtils

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;
    }
}
Also used : LinuxMountUtils(com.emc.storageos.computesystemcontroller.hostmountadapters.LinuxMountUtils) ContainmentConstraint(com.emc.storageos.db.client.constraint.ContainmentConstraint) ControllerException(com.emc.storageos.volumecontroller.ControllerException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) ServiceCoded(com.emc.storageos.svcs.errorhandling.model.ServiceCoded) FileExportRule(com.emc.storageos.db.client.model.FileExportRule) ExportRule(com.emc.storageos.model.file.ExportRule) FileMountInfo(com.emc.storageos.db.client.model.FileMountInfo) Host(com.emc.storageos.db.client.model.Host) FileShare(com.emc.storageos.db.client.model.FileShare) SMBFileShare(com.emc.storageos.db.client.model.SMBFileShare)

Aggregations

LinuxMountUtils (com.emc.storageos.computesystemcontroller.hostmountadapters.LinuxMountUtils)1 ContainmentConstraint (com.emc.storageos.db.client.constraint.ContainmentConstraint)1 FileExportRule (com.emc.storageos.db.client.model.FileExportRule)1 FileMountInfo (com.emc.storageos.db.client.model.FileMountInfo)1 FileShare (com.emc.storageos.db.client.model.FileShare)1 Host (com.emc.storageos.db.client.model.Host)1 SMBFileShare (com.emc.storageos.db.client.model.SMBFileShare)1 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)1 ExportRule (com.emc.storageos.model.file.ExportRule)1 ServiceCoded (com.emc.storageos.svcs.errorhandling.model.ServiceCoded)1 ControllerException (com.emc.storageos.volumecontroller.ControllerException)1