Search in sources :

Example 31 with VNXException

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

the class VNXFileStorageDeviceXML method doCreateFS.

@Override
public BiosCommandResult doCreateFS(StorageSystem storage, FileDeviceInputOutput args) throws ControllerException {
    Map<String, String> autoExtendAtts = getAutoExtendAttrs(args);
    Long fsSize = args.getFsCapacity() / BYTESPERMB;
    if (fsSize < 1) {
        // Invalid size throw an error
        String errMsg = "doCreateFS failed : FileSystem size in bytes is not valid " + args.getFsCapacity();
        _log.error(errMsg);
        return BiosCommandResult.createErrorResult(DeviceControllerErrors.vnx.unableToCreateFileSystem(errMsg));
    }
    _log.info("FileSystem size translation : {} : {} ", args.getFsCapacity(), fsSize);
    XMLApiResult result = null;
    ApplicationContext context = null;
    try {
        context = loadContext();
        VNXFileCommApi vnxComm = loadVNXFileCommunicationAPIs(context);
        if (null == vnxComm) {
            throw VNXException.exceptions.communicationFailed(VNXCOMM_ERR_MSG);
        }
        result = vnxComm.createFileSystem(storage, args.getFsName(), // This will be used for CLI create FS
        args.getPoolName(), "1", fsSize, args.getThinProvision(), args.getNativeDeviceFsId(), autoExtendAtts);
        if (result.isCommandSuccess()) {
            VNXFileSystem vnxFS = (VNXFileSystem) result.getObject();
            args.setFsNativeId(String.valueOf(vnxFS.getFsId()));
            String path = "/" + args.getFsName();
            // Set path & mountpath
            args.setFsMountPath(path);
            args.setFsPath(path);
        }
    } catch (VNXException e) {
        throw DeviceControllerException.exceptions.unableToCreateFileSystem(e.getMessage(Locale.getDefault()));
    } finally {
        clearContext(context);
    }
    BiosCommandResult cmdResult = null;
    if (result.isCommandSuccess()) {
        cmdResult = BiosCommandResult.createSuccessfulResult();
    } else {
        cmdResult = BiosCommandResult.createErrorResult(DeviceControllerErrors.vnx.unableToCreateFileSystem(result.getMessage()));
    }
    return cmdResult;
}
Also used : ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) ApplicationContext(org.springframework.context.ApplicationContext) VNXException(com.emc.storageos.vnx.xmlapi.VNXException) VNXFileSystem(com.emc.storageos.vnx.xmlapi.VNXFileSystem) BiosCommandResult(com.emc.storageos.volumecontroller.impl.BiosCommandResult) VNXFileCommApi(com.emc.storageos.volumecontroller.impl.plugins.provisioning.VNXFileCommApi) XMLApiResult(com.emc.storageos.vnx.xmlapi.XMLApiResult)

Example 32 with VNXException

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

the class VNXFileCommunicationInterface method getPorts.

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

Example 33 with VNXException

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

the class VNXFileCommunicationInterface method getAllQuotaTrees.

private List<TreeQuota> getAllQuotaTrees(final StorageSystem system) throws VNXException {
    List<TreeQuota> quotaTrees = new ArrayList<TreeQuota>();
    List<TreeQuota> tempQuotaTrees = null;
    try {
        _discExecutor.execute((Namespace) _discNamespaces.getNsList().get("vnxallquotas"));
        tempQuotaTrees = (ArrayList<TreeQuota>) _discExecutor.getKeyMap().get(VNXFileConstants.QUOTA_DIR_LIST);
        if (null != tempQuotaTrees && !tempQuotaTrees.isEmpty()) {
            quotaTrees.addAll(tempQuotaTrees);
            _logger.info("Found {} Quota directories ", tempQuotaTrees.size());
        } else {
            _logger.info("No Quota directories found ");
        }
    } catch (BaseCollectionException e) {
        throw new VNXException("Get QuotaTrees op failed", e);
    }
    return quotaTrees;
}
Also used : VNXException(com.emc.storageos.vnx.xmlapi.VNXException) ArrayList(java.util.ArrayList) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) TreeQuota(com.emc.nas.vnxfile.xmlapi.TreeQuota)

Example 34 with VNXException

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

the class VNXFileCommunicationInterface method getVdmPorts.

private List<VNXDataMoverIntf> getVdmPorts(final StorageSystem system, final List<VNXVdm> vdms) throws VNXException {
    List<VNXDataMoverIntf> dataMoverInterfaces = null;
    List<VNXDataMoverIntf> vdmInterfaces = new ArrayList<VNXDataMoverIntf>();
    Map<String, VNXDataMoverIntf> dmIntMap = new HashMap();
    try {
        Map<String, Object> reqAttributeMap = getRequestParamsMap(system);
        _discExecutor.setKeyMap(reqAttributeMap);
        _discExecutor.execute((Namespace) _discNamespaces.getNsList().get("vnxfileStoragePort"));
        dataMoverInterfaces = (ArrayList<VNXDataMoverIntf>) _discExecutor.getKeyMap().get(VNXFileConstants.STORAGE_PORTS);
        // Make map
        for (VNXDataMoverIntf intf : dataMoverInterfaces) {
            dmIntMap.put(intf.getName(), intf);
        }
        VNXFileSshApi sshDmApi = new VNXFileSshApi();
        sshDmApi.setConnParams(system.getIpAddress(), system.getUsername(), system.getPassword());
        // collect VDM interfaces
        for (VNXVdm vdm : vdms) {
            for (String vdmIF : vdm.getInterfaces()) {
                VNXDataMoverIntf vdmInterface = dmIntMap.get(vdmIF);
                vdmInterfaces.add(vdmInterface);
                _logger.info("Use this VDM interface {}", vdmIF);
            }
            // Collect NFS/CIFS interfaces from nas_server -info command. This will return
            // Interfaces assigned to VDM and not thru CIFS servers
            Map<String, String> vdmIntfs = sshDmApi.getVDMInterfaces(vdm.getVdmName());
            for (String vdmNFSIf : vdmIntfs.keySet()) {
                VNXDataMoverIntf vdmInterface = dmIntMap.get(vdmNFSIf);
                if (vdmInterface != null) {
                    _logger.info("Use this NFS VDM interface {} for {}", vdmInterface, vdmNFSIf);
                    vdmInterfaces.add(vdmInterface);
                    // Check if the interface is already on the VDM, if not, add it.
                    if (!vdm.getInterfaces().contains(vdmInterface.getName())) {
                        vdm.getInterfaces().add(vdmInterface.getName());
                    }
                } else {
                    _logger.info("No interface found for {}", vdmNFSIf);
                }
            }
        }
    } catch (BaseCollectionException e) {
        throw new VNXException("Get VDM Port op failed", e);
    }
    return vdmInterfaces;
}
Also used : ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) VNXDataMoverIntf(com.emc.storageos.vnx.xmlapi.VNXDataMoverIntf) VNXVdm(com.emc.storageos.vnx.xmlapi.VNXVdm) VNXFileSshApi(com.emc.storageos.vnx.xmlapi.VNXFileSshApi) 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 35 with VNXException

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

the class VNXFileCommunicationInterface method getAllFileSystem.

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

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