Search in sources :

Example 1 with NewMount

use of com.emc.nas.vnxfile.xmlapi.NewMount in project coprhd-controller by CoprHD.

the class VNXFileArgsCreator method mountFileSystem.

public InputStream mountFileSystem(final Argument argument, final Map<String, Object> keyMap, int index) throws VNXFilePluginException {
    _logger.info("Mounting VNX File System");
    InputStream iStream = null;
    try {
        Task task = new Task();
        NewMount mount = new NewMount();
        String path = (String) keyMap.get(VNXFileConstants.MOUNT_PATH);
        String id = (String) keyMap.get(VNXFileConstants.FILESYSTEM_ID);
        String isVirtual = (String) keyMap.get(VNXFileConstants.ISVDM);
        Set<String> moverIds = (Set<String>) keyMap.get(VNXFileConstants.MOVERLIST);
        if (isInValid(path) || isInValid(id) || null == moverIds || (moverIds.isEmpty())) {
            throw new VNXFilePluginException("Prior command did not execute successfully", VNXFilePluginException.ERRORCODE_ILLEGALARGUMENTEXCEPTION);
        }
        if (moverIds.isEmpty()) {
            throw new VNXFilePluginException("No movers found to mount", new Exception());
        }
        String[] movers = moverIds.toArray(new String[0]);
        _logger.info("Mount file system id: {} and isVirtual {}", id, isVirtual);
        _logger.info("Mount file system path: {}, Mover: {} ", path, movers[0]);
        Boolean moverType = new Boolean(isVirtual);
        MoverOrVdmRef mov = new MoverOrVdmRef();
        mov.setMover(movers[0]);
        mov.setMoverIdIsVdm(moverType);
        NfsOptions nfs = new NfsOptions();
        nfs.setPrefetch(false);
        nfs.setRo(false);
        nfs.setUncached(true);
        nfs.setVirusScan(false);
        CifsOptions cif = new CifsOptions();
        cif.setAccessPolicy(AccessPolicy.NATIVE);
        cif.setCifsSyncwrite(true);
        cif.setLockingPolicy(LockingPolicy.NOLOCK);
        cif.setNotify(true);
        cif.setNotifyOnAccess(true);
        cif.setOplock(true);
        cif.setTriggerLevel(128);
        cif.setNotifyOnWrite(true);
        mount.setMoverOrVdm(mov);
        mount.setPath(path);
        mount.setFileSystem(id);
        mount.setNfsOptions(nfs);
        mount.setCifsOptions(cif);
        task.setNewMount(mount);
        iStream = _vnxFileInputRequestBuilder.getTaskParamPacket(task);
    } catch (JAXBException jaxbException) {
        throw new VNXFilePluginException("Exception occurred while generating input xml for unmount file system", jaxbException.getCause());
    }
    return iStream;
}
Also used : Task(com.emc.nas.vnxfile.xmlapi.Task) FileSystemUsageSet(com.emc.nas.vnxfile.xmlapi.FileSystemUsageSet) Set(java.util.Set) InputStream(java.io.InputStream) JAXBException(javax.xml.bind.JAXBException) NfsOptions(com.emc.nas.vnxfile.xmlapi.NfsOptions) NewMount(com.emc.nas.vnxfile.xmlapi.NewMount) JAXBException(javax.xml.bind.JAXBException) CifsOptions(com.emc.nas.vnxfile.xmlapi.CifsOptions) MoverOrVdmRef(com.emc.nas.vnxfile.xmlapi.MoverOrVdmRef)

Aggregations

CifsOptions (com.emc.nas.vnxfile.xmlapi.CifsOptions)1 FileSystemUsageSet (com.emc.nas.vnxfile.xmlapi.FileSystemUsageSet)1 MoverOrVdmRef (com.emc.nas.vnxfile.xmlapi.MoverOrVdmRef)1 NewMount (com.emc.nas.vnxfile.xmlapi.NewMount)1 NfsOptions (com.emc.nas.vnxfile.xmlapi.NfsOptions)1 Task (com.emc.nas.vnxfile.xmlapi.Task)1 InputStream (java.io.InputStream)1 Set (java.util.Set)1 JAXBException (javax.xml.bind.JAXBException)1