Search in sources :

Example 1 with MoverOrVdmRef

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

the class VNXFileSystemInfoProcessor method processFilesystemList.

/**
 * Process the fileSystemList which are received from XMLAPI server.
 *
 * @param filesystemList : List of FileSystem objects.
 * @param keyMap : keyMap.
 */
private void processFilesystemList(List<Object> filesystemList, Map<String, Object> keyMap) throws VNXFilePluginException {
    Iterator<Object> iterator = filesystemList.iterator();
    Map<String, String> volFilesystemMap = new HashMap<String, String>();
    Set<String> moverIds = new HashSet<String>();
    if (iterator.hasNext()) {
        Status status = (Status) iterator.next();
        if (status.getMaxSeverity() == Severity.OK) {
            while (iterator.hasNext()) {
                FileSystem fileSystem = (FileSystem) iterator.next();
                volFilesystemMap.put(fileSystem.getVolume(), fileSystem.getFileSystem());
                List<MoverOrVdmRef> roFileSysHosts = fileSystem.getRoFileSystemHosts();
                Iterator<MoverOrVdmRef> roFileSysHostItr = roFileSysHosts.iterator();
                while (roFileSysHostItr.hasNext()) {
                    MoverOrVdmRef mover = roFileSysHostItr.next();
                    moverIds.add(mover.getMover());
                }
            }
        } else {
            throw new VNXFilePluginException("Fault response received from XMLAPI Server.", VNXFilePluginException.ERRORCODE_INVALID_RESPONSE);
        }
    }
    keyMap.put(VNXFileConstants.MOVERLIST, moverIds);
    keyMap.put(VNXFileConstants.VOLFILESHAREMAP, volFilesystemMap);
}
Also used : Status(com.emc.nas.vnxfile.xmlapi.Status) HashMap(java.util.HashMap) VNXFilePluginException(com.emc.storageos.plugins.metering.vnxfile.VNXFilePluginException) FileSystem(com.emc.nas.vnxfile.xmlapi.FileSystem) MoverOrVdmRef(com.emc.nas.vnxfile.xmlapi.MoverOrVdmRef) HashSet(java.util.HashSet)

Example 2 with MoverOrVdmRef

use of com.emc.nas.vnxfile.xmlapi.MoverOrVdmRef 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)

Example 3 with MoverOrVdmRef

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

the class VNXFileArgsCreator method fetchCifsServerInfo.

/**
 * Create CIFS Config XML request and return stream after marhalling.
 *
 * @param argument
 * @param keyMap
 * @param index
 * @throws com.emc.storageos.plugins.metering.vnxfile.VNXFilePluginException
 */
public InputStream fetchCifsServerInfo(final Argument argument, final Map<String, Object> keyMap, // final Boolean moverOrVdm,
int index) throws VNXFilePluginException {
    _logger.info("Creating CIFS Server info Query");
    InputStream iStream = null;
    try {
        _logger.info("Creating CIFS Server info Query for Mover {} {} isVDM? {}", (String) keyMap.get(VNXFileConstants.MOVER_ID) + ":" + (String) keyMap.get(VNXFileConstants.DATAMOVER_NAME), keyMap.get(VNXFileConstants.ISVDM));
        MoverOrVdmRef mover = new MoverOrVdmRef();
        mover.setMover((String) keyMap.get(VNXFileConstants.MOVER_ID));
        mover.setMoverIdIsVdm(Boolean.valueOf((String) keyMap.get(VNXFileConstants.ISVDM)));
        CifsServerQueryParams cifsQuery = new CifsServerQueryParams();
        cifsQuery.setMoverOrVdm(mover);
        Query query = new Query();
        query.getQueryRequestChoice().add(cifsQuery);
        iStream = _vnxFileInputRequestBuilder.getQueryParamPacket(cifsQuery, false);
    } catch (JAXBException jaxbException) {
        throw new VNXFilePluginException("Exception occurred while generating input xml for file export info", jaxbException.getCause());
    }
    return iStream;
}
Also used : Query(com.emc.nas.vnxfile.xmlapi.Query) InputStream(java.io.InputStream) JAXBException(javax.xml.bind.JAXBException) MoverOrVdmRef(com.emc.nas.vnxfile.xmlapi.MoverOrVdmRef) CifsServerQueryParams(com.emc.nas.vnxfile.xmlapi.CifsServerQueryParams)

Example 4 with MoverOrVdmRef

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

the class VNXFileArgsCreator method fetchCifsServerParams.

/**
 * Create CIFS Config XML request and return stream after marhalling.
 *
 * @param argument
 * @param keyMap
 * @param index
 * @throws com.emc.storageos.plugins.metering.vnxfile.VNXFilePluginException
 */
public InputStream fetchCifsServerParams(final Argument argument, final Map<String, Object> keyMap, int index) throws VNXFilePluginException {
    _logger.info("Creating CIFS Server Params Query");
    InputStream iStream = null;
    try {
        String moverId = (String) keyMap.get(VNXFileConstants.MOVER_ID);
        String isVDM = (String) keyMap.get(VNXFileConstants.ISVDM);
        CifsServerQueryParams cifsQuery = new CifsServerQueryParams();
        MoverOrVdmRef mover = new MoverOrVdmRef();
        Boolean moverIsVdm = new Boolean(false);
        if (moverId != null) {
            mover.setMover(moverId);
            if (isVDM != null) {
                if (isVDM.equalsIgnoreCase("true")) {
                    moverIsVdm = new Boolean(true);
                }
            }
            mover.setMoverIdIsVdm(moverIsVdm);
            cifsQuery.setMoverOrVdm(mover);
        }
        Query query = new Query();
        query.getQueryRequestChoice().add(cifsQuery);
        iStream = _vnxFileInputRequestBuilder.getQueryParamPacket(cifsQuery, false);
    } catch (JAXBException jaxbException) {
        throw new VNXFilePluginException("Exception occurred while generating input xml for  Cifs server info", jaxbException.getCause());
    }
    return iStream;
}
Also used : Query(com.emc.nas.vnxfile.xmlapi.Query) InputStream(java.io.InputStream) JAXBException(javax.xml.bind.JAXBException) MoverOrVdmRef(com.emc.nas.vnxfile.xmlapi.MoverOrVdmRef) CifsServerQueryParams(com.emc.nas.vnxfile.xmlapi.CifsServerQueryParams)

Example 5 with MoverOrVdmRef

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

the class VNXFileSystemMoverInfoProcessor method processFilesystemList.

/**
 * Process the fileSystemList which are received from XMLAPI server.
 *
 * @param filesystemList : List of FileSystem objects.
 * @param keyMap : keyMap.
 */
private void processFilesystemList(List<Object> filesystemList, Map<String, Object> keyMap) throws VNXFilePluginException {
    Iterator<Object> iterator = filesystemList.iterator();
    Set<String> moverIds = new HashSet<String>();
    if (iterator.hasNext()) {
        Status status = (Status) iterator.next();
        if (status.getMaxSeverity() == Severity.OK) {
            keyMap.put(VNXFileConstants.CMD_RESULT, VNXFileConstants.CMD_SUCCESS);
            while (iterator.hasNext()) {
                FileSystem fileSystem = (FileSystem) iterator.next();
                _logger.info("Processing result for file system {}", fileSystem.getName());
                List<MoverOrVdmRef> roFileSysHosts = fileSystem.getRoFileSystemHosts();
                if (null != roFileSysHosts) {
                    Iterator<MoverOrVdmRef> roFileSysHostItr = roFileSysHosts.iterator();
                    while (roFileSysHostItr.hasNext()) {
                        MoverOrVdmRef mover = roFileSysHostItr.next();
                        moverIds.add(mover.getMover());
                        _logger.debug("Mover id for read only host is {}", mover.getMover());
                    }
                }
                List<MoverOrVdmRef> rwFileSysHosts = fileSystem.getRwFileSystemHosts();
                if (null != rwFileSysHosts) {
                    Iterator<MoverOrVdmRef> rwFileSysHostItr = rwFileSysHosts.iterator();
                    while (rwFileSysHostItr.hasNext()) {
                        MoverOrVdmRef mover = rwFileSysHostItr.next();
                        moverIds.add(mover.getMover());
                        _logger.debug("Mover id for read write host is {}", mover.getMover());
                    }
                }
            }
        } else {
            keyMap.put(VNXFileConstants.CMD_RESULT, VNXFileConstants.CMD_FAILURE);
            throw new VNXFilePluginException("Fault response received from XMLAPI Server.", VNXFilePluginException.ERRORCODE_INVALID_RESPONSE);
        }
    }
    keyMap.put(VNXFileConstants.MOVERLIST, moverIds);
}
Also used : Status(com.emc.nas.vnxfile.xmlapi.Status) FileSystem(com.emc.nas.vnxfile.xmlapi.FileSystem) VNXFilePluginException(com.emc.storageos.plugins.metering.vnxfile.VNXFilePluginException) MoverOrVdmRef(com.emc.nas.vnxfile.xmlapi.MoverOrVdmRef) HashSet(java.util.HashSet)

Aggregations

MoverOrVdmRef (com.emc.nas.vnxfile.xmlapi.MoverOrVdmRef)5 InputStream (java.io.InputStream)3 JAXBException (javax.xml.bind.JAXBException)3 CifsServerQueryParams (com.emc.nas.vnxfile.xmlapi.CifsServerQueryParams)2 FileSystem (com.emc.nas.vnxfile.xmlapi.FileSystem)2 Query (com.emc.nas.vnxfile.xmlapi.Query)2 Status (com.emc.nas.vnxfile.xmlapi.Status)2 VNXFilePluginException (com.emc.storageos.plugins.metering.vnxfile.VNXFilePluginException)2 HashSet (java.util.HashSet)2 CifsOptions (com.emc.nas.vnxfile.xmlapi.CifsOptions)1 FileSystemUsageSet (com.emc.nas.vnxfile.xmlapi.FileSystemUsageSet)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 HashMap (java.util.HashMap)1 Set (java.util.Set)1