Search in sources :

Example 1 with PortController

use of com.emc.storageos.hds.model.PortController 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)

Aggregations

StorageHADomain (com.emc.storageos.db.client.model.StorageHADomain)1 PortController (com.emc.storageos.hds.model.PortController)1 ArrayList (java.util.ArrayList)1