Search in sources :

Example 11 with StorageHADomain

use of com.emc.storageos.db.client.model.StorageHADomain in project coprhd-controller by CoprHD.

the class StorageProcessor method getStorageAdapter.

protected StorageHADomain getStorageAdapter(DbClient dbClient, String adapterNativeGuid) {
    try {
        _logger.info("Adapter Native {}", adapterNativeGuid);
        @SuppressWarnings("deprecation") List<URI> adapterURIs = dbClient.queryByConstraint(AlternateIdConstraint.Factory.getStorageHADomainByNativeGuidConstraint(adapterNativeGuid));
        if (adapterURIs != null && !adapterURIs.isEmpty()) {
            for (URI adapterURI : adapterURIs) {
                StorageHADomain adapter = dbClient.queryObject(StorageHADomain.class, adapterURI);
                _logger.info("Adapter {}", adapter.getId());
                if (!adapter.getInactive()) {
                    return adapter;
                }
            }
        }
    } catch (Exception e) {
        _logger.error("Adapter {} not found", adapterNativeGuid, e);
    }
    return null;
}
Also used : StorageHADomain(com.emc.storageos.db.client.model.StorageHADomain) URI(java.net.URI) WBEMException(javax.wbem.WBEMException) IOException(java.io.IOException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException)

Example 12 with StorageHADomain

use of com.emc.storageos.db.client.model.StorageHADomain in project coprhd-controller by CoprHD.

the class HDSCommunicationInterface method processStorageAdapterResponse.

/**
 * Process the StorageAdapter response received from the server.
 *
 * @param system : storagesystem details.
 * @param portControllerList : List of portcontrollers info received from server.
 * @param accessProfile : accessProfile details.
 * @throws IOException
 */
private void processStorageAdapterResponse(StorageSystem system, List<PortController> portControllerList, AccessProfile accessProfile) throws IOException {
    List<StorageHADomain> newAdapters = new ArrayList<StorageHADomain>();
    List<StorageHADomain> updateAdapters = new ArrayList<StorageHADomain>();
    if (null != portControllerList && !portControllerList.isEmpty()) {
        for (PortController portControllerFromResponse : portControllerList) {
            boolean isNew = false;
            String nativeGuid = NativeGUIDGenerator.generateNativeGuid(system, portControllerFromResponse.getObjectID(), NativeGUIDGenerator.ADAPTER);
            StorageHADomain adapter = checkAdapterExistsInDB(nativeGuid);
            if (null == adapter) {
                isNew = true;
                adapter = new StorageHADomain();
                adapter.setStorageDeviceURI(system.getId());
                adapter.setId(URIUtil.createId(StorageHADomain.class));
                adapter.setAdapterName(portControllerFromResponse.getDisplayName());
                adapter.setLabel(portControllerFromResponse.getDisplayName());
                adapter.setNativeGuid(nativeGuid);
                newAdapters.add(adapter);
            }
            adapter.setAdapterName(portControllerFromResponse.getDisplayName());
            adapter.setLabel(portControllerFromResponse.getDisplayName());
            if (!HDSConstants.NO_CLUSTER_ID.equalsIgnoreCase(portControllerFromResponse.getCluster())) {
                adapter.setSlotNumber(portControllerFromResponse.getCluster());
            }
            adapter.setName(portControllerFromResponse.getDisplayName());
            if (!isNew) {
                updateAdapters.add(adapter);
            }
        }
        _dbClient.createObject(newAdapters);
        _dbClient.persistObject(updateAdapters);
    }
}
Also used : PortController(com.emc.storageos.hds.model.PortController) ArrayList(java.util.ArrayList) StorageHADomain(com.emc.storageos.db.client.model.StorageHADomain)

Example 13 with StorageHADomain

use of com.emc.storageos.db.client.model.StorageHADomain in project coprhd-controller by CoprHD.

the class HDSCommunicationInterface method checkAdapterExistsInDB.

/**
 * Check if Adapter exists in DB.
 *
 * @param poolInstance
 * @param _dbClient
 * @param profile
 * @return
 * @throws IOException
 */
protected StorageHADomain checkAdapterExistsInDB(String nativeGuid) throws IOException {
    StorageHADomain adapter = null;
    // use NativeGuid to lookup Pools in DB
    List<StorageHADomain> adapterInDB = CustomQueryUtility.getActiveStorageHADomainByNativeGuid(_dbClient, nativeGuid);
    if (adapterInDB != null && !adapterInDB.isEmpty()) {
        adapter = adapterInDB.get(0);
    }
    return adapter;
}
Also used : StorageHADomain(com.emc.storageos.db.client.model.StorageHADomain)

Example 14 with StorageHADomain

use of com.emc.storageos.db.client.model.StorageHADomain in project coprhd-controller by CoprHD.

the class VNXFileCommApi method getCIFSExport.

/**
 * Get the CIFS export from the storage system based on the export path
 *
 * @param system storage system details
 * @param args FileDeviceInputOutput object with export path details
 * @return export map
 */
public Map<String, String> getCIFSExport(StorageSystem system, FileDeviceInputOutput args) {
    StoragePort storagePort = _dbClient.queryObject(StoragePort.class, args.getFs().getStoragePort());
    String moverId = null;
    String exportPath = args.getExportPath();
    StorageHADomain dataMover = null;
    URI dataMoverId = storagePort.getStorageHADomain();
    dataMover = _dbClient.queryObject(StorageHADomain.class, dataMoverId);
    moverId = dataMover.getName();
    _log.info("Getting Mover Id {} to list FS CIFS export at {}", moverId, exportPath);
    // get export from storage system.
    sshApi.setConnParams(system.getIpAddress(), system.getUsername(), system.getPassword());
    Map<String, Map<String, String>> allExportsForPathMap = sshApi.getCIFSExportsForPath(dataMover.getAdapterName());
    Map<String, String> exportMap = null;
    if (allExportsForPathMap != null) {
        exportMap = allExportsForPathMap.get(exportPath);
    }
    return exportMap;
}
Also used : StoragePort(com.emc.storageos.db.client.model.StoragePort) StorageHADomain(com.emc.storageos.db.client.model.StorageHADomain) URI(java.net.URI) FSExportMap(com.emc.storageos.db.client.model.FSExportMap) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) SMBShareMap(com.emc.storageos.db.client.model.SMBShareMap)

Example 15 with StorageHADomain

use of com.emc.storageos.db.client.model.StorageHADomain in project coprhd-controller by CoprHD.

the class VNXFileCommApi method getNFSExport.

/**
 * Get the export from the storage system based on the export path
 *
 * @param system storage system details
 * @param args FileDeviceInputOutput object with export path details
 * @return export map
 */
public Map<String, String> getNFSExport(StorageSystem system, FileDeviceInputOutput args) {
    sshApi.setConnParams(system.getIpAddress(), system.getUsername(), system.getPassword());
    StoragePort storagePort = _dbClient.queryObject(StoragePort.class, args.getFs().getStoragePort());
    String moverId;
    String exportPath = args.getExportPath();
    StorageHADomain dataMover = null;
    URI dataMoverId = storagePort.getStorageHADomain();
    dataMover = _dbClient.queryObject(StorageHADomain.class, dataMoverId);
    moverId = dataMover.getName();
    _log.info("Getting Mover Id {} to list FS export at {}", moverId, exportPath);
    // get export from storage system.
    sshApi.setConnParams(system.getIpAddress(), system.getUsername(), system.getPassword());
    Map<String, Map<String, String>> allExportsForPathMap = sshApi.getNFSExportsForPath(dataMover.getAdapterName(), exportPath);
    Map<String, String> exportMap = null;
    if (allExportsForPathMap != null) {
        exportMap = allExportsForPathMap.get(exportPath);
    }
    return exportMap;
}
Also used : StoragePort(com.emc.storageos.db.client.model.StoragePort) StorageHADomain(com.emc.storageos.db.client.model.StorageHADomain) URI(java.net.URI) FSExportMap(com.emc.storageos.db.client.model.FSExportMap) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) SMBShareMap(com.emc.storageos.db.client.model.SMBShareMap)

Aggregations

StorageHADomain (com.emc.storageos.db.client.model.StorageHADomain)80 URI (java.net.URI)41 StoragePort (com.emc.storageos.db.client.model.StoragePort)35 ArrayList (java.util.ArrayList)33 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)26 HashMap (java.util.HashMap)22 List (java.util.List)20 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)19 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)18 StringSet (com.emc.storageos.db.client.model.StringSet)17 VNXException (com.emc.storageos.vnx.xmlapi.VNXException)12 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)11 NamespaceList (com.emc.storageos.plugins.common.domainmodel.NamespaceList)11 URISyntaxException (java.net.URISyntaxException)11 LinkedList (java.util.LinkedList)10 IOException (java.io.IOException)9 AlternateIdConstraint (com.emc.storageos.db.client.constraint.AlternateIdConstraint)8 XMLApiResult (com.emc.storageos.vnx.xmlapi.XMLApiResult)8 HashSet (java.util.HashSet)8 Map (java.util.Map)7