Search in sources :

Example 36 with VNXException

use of com.emc.storageos.vnx.xmlapi.VNXException in project coprhd-controller by CoprHD.

the class VNXFileCommunicationInterface method getCifServers.

private List<VNXCifsServer> getCifServers(final StorageSystem system) throws VNXException {
    List<VNXCifsServer> cifsServers;
    try {
        Map<String, Object> reqAttributeMap = getRequestParamsMap(system);
        _discExecutor.setKeyMap(reqAttributeMap);
        _discExecutor.execute((Namespace) _discNamespaces.getNsList().get(VNXFileConstants.VNX_FILE_CIFS_CONFIG));
        cifsServers = (List<VNXCifsServer>) _discExecutor.getKeyMap().get(VNXFileConstants.CIFS_SERVERS);
    } catch (BaseCollectionException e) {
        throw new VNXException("Get CifServers op failed", e);
    }
    return cifsServers;
}
Also used : VNXCifsServer(com.emc.storageos.vnx.xmlapi.VNXCifsServer) VNXException(com.emc.storageos.vnx.xmlapi.VNXException) DiscoveredDataObject(com.emc.storageos.db.client.model.DiscoveredDataObject) UnManagedDiscoveredObject(com.emc.storageos.db.client.model.UnManagedDiscoveredObject) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException)

Example 37 with VNXException

use of com.emc.storageos.vnx.xmlapi.VNXException in project coprhd-controller by CoprHD.

the class VNXFileCommunicationInterface method getStoragePools.

private List<VNXStoragePool> getStoragePools(final StorageSystem system) throws VNXException {
    List<VNXStoragePool> storagePools = null;
    try {
        Map<String, Object> reqAttributeMap = getRequestParamsMap(system);
        _logger.info("{}", _discExecutor);
        _discExecutor.setKeyMap(reqAttributeMap);
        _logger.info("{}", _discNamespaces.getNsList().get("vnxfileStoragePool"));
        _discExecutor.execute((Namespace) _discNamespaces.getNsList().get("vnxfileStoragePool"));
        storagePools = (ArrayList<VNXStoragePool>) _discExecutor.getKeyMap().get(VNXFileConstants.STORAGEPOOLS);
    } catch (BaseCollectionException e) {
        throw new VNXException("Get control station op failed", e);
    }
    return storagePools;
}
Also used : VNXException(com.emc.storageos.vnx.xmlapi.VNXException) VNXStoragePool(com.emc.storageos.vnx.xmlapi.VNXStoragePool) DiscoveredDataObject(com.emc.storageos.db.client.model.DiscoveredDataObject) UnManagedDiscoveredObject(com.emc.storageos.db.client.model.UnManagedDiscoveredObject) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException)

Example 38 with VNXException

use of com.emc.storageos.vnx.xmlapi.VNXException in project coprhd-controller by CoprHD.

the class VNXFileCommunicationInterface method getControlStation.

private VNXControlStation getControlStation(final StorageSystem system) throws VNXException {
    VNXControlStation station = null;
    try {
        Map<String, Object> reqAttributeMap = getRequestParamsMap(system);
        _discExecutor.setKeyMap(reqAttributeMap);
        _discExecutor.execute((Namespace) _discNamespaces.getNsList().get("vnxfileControlStation"));
        station = (VNXControlStation) _discExecutor.getKeyMap().get(VNXFileConstants.CONTROL_STATION_INFO);
    } catch (BaseCollectionException e) {
        throw new VNXException("Get control station op failed", e);
    }
    return station;
}
Also used : VNXControlStation(com.emc.storageos.vnx.xmlapi.VNXControlStation) VNXException(com.emc.storageos.vnx.xmlapi.VNXException) DiscoveredDataObject(com.emc.storageos.db.client.model.DiscoveredDataObject) UnManagedDiscoveredObject(com.emc.storageos.db.client.model.UnManagedDiscoveredObject) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException)

Example 39 with VNXException

use of com.emc.storageos.vnx.xmlapi.VNXException in project coprhd-controller by CoprHD.

the class VNXFileCommApi method createQuotaDirectory.

public XMLApiResult createQuotaDirectory(final StorageSystem system, final String fsName, final String quotaDirName, final String securityStyle, final Long size, final Boolean oplocks, Boolean isMountRequired) throws VNXException {
    _log.info("Create VNX File System Quota dir: {} on file system {}", quotaDirName, fsName);
    XMLApiResult result = new XMLApiResult();
    Map<String, Object> reqAttributeMap = new ConcurrentHashMap<String, Object>();
    try {
        if (isMountRequired) {
            // means there is no fs export in Vipr and mount is needed.
            // just cross check with array fs have mount.
            isMountRequired = !isMountPresentOnArray(fsName, system);
        }
        updateAttributes(reqAttributeMap, system);
        reqAttributeMap.put(VNXFileConstants.FILESYSTEM_NAME, fsName);
        reqAttributeMap.put(VNXFileConstants.QUOTA_DIR_NAME, quotaDirName);
        reqAttributeMap.put(VNXFileConstants.HARD_QUOTA, size);
        reqAttributeMap.put(VNXFileConstants.SECURITY_STYLE, securityStyle);
        reqAttributeMap.put(VNXFileConstants.OPLOCKS, oplocks);
        reqAttributeMap.put(VNXFileConstants.MOUNT_PATH, "/" + fsName);
        _provExecutor.setKeyMap(reqAttributeMap);
        if (isMountRequired) {
            _provExecutor.execute((Namespace) _provNamespaces.getNsList().get(PROV_FILE_QUOTA_DIR_CREATE_MOUNT));
        } else {
            _provExecutor.execute((Namespace) _provNamespaces.getNsList().get(PROV_FILE_QUOTA_DIR_CREATE));
        }
        String cmdResult = (String) _provExecutor.getKeyMap().get(VNXFileConstants.CMD_RESULT);
        if (cmdResult != null && cmdResult.equals(VNXFileConstants.CMD_SUCCESS)) {
            String quotaDirId = (String) _provExecutor.getKeyMap().get(VNXFileConstants.QUOTA_DIR_ID);
            String fsysId = (String) _provExecutor.getKeyMap().get(VNXFileConstants.FILESYSTEM_ID);
            if (quotaDirId != null) {
                int fsId = Integer.parseInt(fsysId);
                int qdId = Integer.parseInt(quotaDirId);
                VNXQuotaTree vnxQuotaTree = new VNXQuotaTree(quotaDirName, -1, fsId);
                vnxQuotaTree.setId(qdId);
                result.setObject(vnxQuotaTree);
                result.setCommandSuccess();
            } else {
                result.setCommandFailed();
                result.setMessage((String) _provExecutor.getKeyMap().get(VNXFileConstants.FAULT_DESC));
            }
        } else {
            String errMsg = (String) _provExecutor.getKeyMap().get(VNXFileConstants.FAULT_DESC);
            result.setCommandFailed();
            result.setMessage(errMsg);
        }
    } catch (Exception e) {
        throw new VNXException("Failure", e);
    }
    return result;
}
Also used : VNXException(com.emc.storageos.vnx.xmlapi.VNXException) VNXQuotaTree(com.emc.storageos.vnx.xmlapi.VNXQuotaTree) FileObject(com.emc.storageos.db.client.model.FileObject) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) XMLApiResult(com.emc.storageos.vnx.xmlapi.XMLApiResult) ContainmentConstraint(com.emc.storageos.db.client.constraint.ContainmentConstraint) Checkpoint(com.emc.nas.vnxfile.xmlapi.Checkpoint) AlternateIdConstraint(com.emc.storageos.db.client.constraint.AlternateIdConstraint) URISyntaxException(java.net.URISyntaxException) VNXException(com.emc.storageos.vnx.xmlapi.VNXException)

Example 40 with VNXException

use of com.emc.storageos.vnx.xmlapi.VNXException in project coprhd-controller by CoprHD.

the class VNXFileCommApi method createSnapshot.

public XMLApiResult createSnapshot(final StorageSystem system, final String fsName, final String snapshotName, final FileShare fileShare) throws VNXException {
    _log.info("Create Snap for file sys : {} snap name : {}", fsName, snapshotName);
    XMLApiResult result = new XMLApiResult();
    Map<String, Object> reqAttributeMap = new ConcurrentHashMap<String, Object>();
    try {
        // get the data mover
        StorageHADomain dataMover = this.getDataMover(fileShare);
        if (null != dataMover) {
            sshApi.setConnParams(system.getIpAddress(), system.getUsername(), system.getPassword());
            Map<String, String> existingMounts = sshApi.getFsMountpathMap(dataMover.getAdapterName());
            if (existingMounts.get(fileShare.getName()) == null) {
                String mountCmdArgs = sshApi.formatMountCmd(dataMover.getAdapterName(), fileShare.getName(), fileShare.getMountPath());
                result = sshApi.executeSshRetry(VNXFileSshApi.SERVER_MOUNT_CMD, mountCmdArgs);
                _log.info("filesystem mount is successful for filesystem: {} mount path: {}", fileShare.getName(), fileShare.getMountPath());
            }
        } else {
            Exception e = new Exception("VNX File snapshot creation failed because suitable Data mover to mount the File System not found");
            throw VNXException.exceptions.createExportFailed("VNX File Snapshot create is Failed", e);
        }
        updateAttributes(reqAttributeMap, system);
        reqAttributeMap.put(VNXFileConstants.FILESYSTEM_NAME, fsName);
        reqAttributeMap.put(VNXFileConstants.SNAPSHOT_NAME, snapshotName);
        _provExecutor.setKeyMap(reqAttributeMap);
        _provExecutor.execute((Namespace) _provNamespaces.getNsList().get(PROV_CREATE_SNAP));
        String cmdResult = (String) _provExecutor.getKeyMap().get(VNXFileConstants.CMD_RESULT);
        if (cmdResult != null && cmdResult.equals(VNXFileConstants.CMD_SUCCESS)) {
            String snapId = (String) _provExecutor.getKeyMap().get(VNXFileConstants.SNAPSHOT_ID);
            String fsysId = (String) _provExecutor.getKeyMap().get(VNXFileConstants.FILESYSTEM_ID);
            if (snapId != null) {
                int fsId = Integer.parseInt(fsysId);
                int snId = Integer.parseInt(snapId);
                VNXSnapshot vnxSnap = new VNXSnapshot(snapshotName, -1, fsId);
                vnxSnap.setId(snId);
                result.setObject(vnxSnap);
                result.setCommandSuccess();
            } else {
                result.setCommandFailed();
                result.setMessage((String) _provExecutor.getKeyMap().get(VNXFileConstants.FAULT_MSG));
            }
        } else {
            String errMsg = (String) _provExecutor.getKeyMap().get(VNXFileConstants.FAULT_MSG);
            result.setCommandFailed();
            result.setMessage(errMsg);
        }
    } catch (Exception e) {
        throw new VNXException("Failure", e);
    }
    return result;
}
Also used : VNXException(com.emc.storageos.vnx.xmlapi.VNXException) FileObject(com.emc.storageos.db.client.model.FileObject) VNXSnapshot(com.emc.storageos.vnx.xmlapi.VNXSnapshot) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) StorageHADomain(com.emc.storageos.db.client.model.StorageHADomain) XMLApiResult(com.emc.storageos.vnx.xmlapi.XMLApiResult) URISyntaxException(java.net.URISyntaxException) VNXException(com.emc.storageos.vnx.xmlapi.VNXException) ContainmentConstraint(com.emc.storageos.db.client.constraint.ContainmentConstraint) Checkpoint(com.emc.nas.vnxfile.xmlapi.Checkpoint) AlternateIdConstraint(com.emc.storageos.db.client.constraint.AlternateIdConstraint)

Aggregations

VNXException (com.emc.storageos.vnx.xmlapi.VNXException)43 XMLApiResult (com.emc.storageos.vnx.xmlapi.XMLApiResult)29 VNXFileCommApi (com.emc.storageos.volumecontroller.impl.plugins.provisioning.VNXFileCommApi)16 ApplicationContext (org.springframework.context.ApplicationContext)16 ClassPathXmlApplicationContext (org.springframework.context.support.ClassPathXmlApplicationContext)16 BiosCommandResult (com.emc.storageos.volumecontroller.impl.BiosCommandResult)15 URISyntaxException (java.net.URISyntaxException)15 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)15 FileObject (com.emc.storageos.db.client.model.FileObject)14 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)14 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)11 ArrayList (java.util.ArrayList)11 DiscoveredDataObject (com.emc.storageos.db.client.model.DiscoveredDataObject)10 UnManagedDiscoveredObject (com.emc.storageos.db.client.model.UnManagedDiscoveredObject)10 Checkpoint (com.emc.nas.vnxfile.xmlapi.Checkpoint)8 StorageHADomain (com.emc.storageos.db.client.model.StorageHADomain)8 VNXSnapshot (com.emc.storageos.vnx.xmlapi.VNXSnapshot)7 FileShare (com.emc.storageos.db.client.model.FileShare)6 SMBFileShare (com.emc.storageos.db.client.model.SMBFileShare)6 VNXFileExport (com.emc.storageos.vnx.xmlapi.VNXFileExport)6