Search in sources :

Example 31 with HostStorageDomain

use of com.emc.storageos.hds.model.HostStorageDomain in project coprhd-controller by CoprHD.

the class HDSExportOperations method executeBatchHSDAddVolumesCommand.

/**
 * This routine will take care of following items.
 * 1. Prepares a batch of Path objects with volumes & HSD's to add.
 * 2. Executes the batch operation.
 *
 * @param hdsApiClient
 * @param systemId
 * @param hsdsWithInitiators
 * @param volumeURIHLUs
 * @param model
 * @return
 * @throws Exception
 */
private List<Path> executeBatchHSDAddVolumesCommand(HDSApiClient hdsApiClient, String systemId, List<HostStorageDomain> hsdsWithInitiators, VolumeURIHLU[] volumeURIHLUs, String model) throws Exception {
    if (null == hsdsWithInitiators || hsdsWithInitiators.isEmpty()) {
        log.error("Batch HSD creation failed. Aborting operation...");
        throw HDSException.exceptions.notAbleToAddHSD(systemId);
    }
    List<Path> pathList = new ArrayList<Path>();
    for (HostStorageDomain hsd : hsdsWithInitiators) {
        Map<String, String> volumeLunMap = getVolumeLunMap(systemId, hsd.getObjectID(), volumeURIHLUs, hdsApiClient.getHDSApiExportManager());
        for (Map.Entry<String, String> entry : volumeLunMap.entrySet()) {
            Path path = new Path(hsd.getPortID(), hsd.getDomainID(), null, entry.getValue(), entry.getKey());
            pathList.add(path);
        }
    }
    return hdsApiClient.getHDSBatchApiExportManager().addLUNPathsToHSDs(systemId, pathList, model);
}
Also used : Path(com.emc.storageos.hds.model.Path) HostStorageDomain(com.emc.storageos.hds.model.HostStorageDomain) ArrayList(java.util.ArrayList) Map(java.util.Map) HashMap(java.util.HashMap) StringSetMap(com.emc.storageos.db.client.model.StringSetMap)

Example 32 with HostStorageDomain

use of com.emc.storageos.hds.model.HostStorageDomain in project coprhd-controller by CoprHD.

the class HDSExportOperations method deleteExportMask.

@Override
public void deleteExportMask(StorageSystem storage, URI exportMaskURI, List<URI> volumeURIList, List<URI> targetURIList, List<Initiator> initiatorList, TaskCompleter taskCompleter) throws DeviceControllerException {
    log.info("{} deleteExportMask START...", storage.getSerialNumber());
    List<HostStorageDomain> hsdToDeleteList = new ArrayList<HostStorageDomain>();
    try {
        log.info("deleteExportMask: Export mask id: {}", exportMaskURI);
        if (volumeURIList != null) {
            log.info("deleteExportMask: volumes:  {}", Joiner.on(',').join(volumeURIList));
        }
        if (targetURIList != null) {
            log.info("deleteExportMask: assignments: {}", Joiner.on(',').join(targetURIList));
        }
        if (initiatorList != null) {
            log.info("deleteExportMask: initiators: {}", Joiner.on(',').join(initiatorList));
        }
        // Get the context from the task completer, in case this is a rollback.
        boolean isRollback = WorkflowService.getInstance().isStepInRollbackState(taskCompleter.getOpId());
        ExportMask exportMask = dbClient.queryObject(ExportMask.class, exportMaskURI);
        ExportMaskValidationContext ctx = new ExportMaskValidationContext();
        ctx.setStorage(storage);
        ctx.setExportMask(exportMask);
        ctx.setBlockObjects(volumeURIList, dbClient);
        ctx.setInitiators(initiatorList);
        // Allow exceptions to be thrown when not rolling back
        ctx.setAllowExceptions(!isRollback);
        AbstractHDSValidator deleteMaskValidator = (AbstractHDSValidator) validator.exportMaskDelete(ctx);
        deleteMaskValidator.validate();
        HDSApiClient hdsApiClient = hdsApiFactory.getClient(HDSUtils.getHDSServerManagementServerInfo(storage), storage.getSmisUserName(), storage.getSmisPassword());
        HDSApiExportManager exportMgr = hdsApiClient.getHDSApiExportManager();
        String systemObjectId = HDSUtils.getSystemObjectID(storage);
        StringSetMap deviceDataMap = exportMask.getDeviceDataMap();
        if (null != deviceDataMap && !deviceDataMap.isEmpty()) {
            Set<String> hsdObjectIdList = deviceDataMap.keySet();
            for (String hsdObjectIdFromDb : hsdObjectIdList) {
                HostStorageDomain hsdObj = exportMgr.getHostStorageDomain(systemObjectId, hsdObjectIdFromDb);
                if (null != hsdObj) {
                    hsdToDeleteList.add(hsdObj);
                }
            }
            if (!hsdToDeleteList.isEmpty()) {
                hdsApiClient.getHDSBatchApiExportManager().deleteBatchHostStorageDomains(systemObjectId, hsdToDeleteList, storage.getModel());
            }
            // By this time, we have removed all HSD's created in this mask.
            taskCompleter.ready(dbClient);
        } else {
            String message = String.format("ExportMask %s does not have a configured HSD's, " + "indicating that this export may not have been created " + "successfully. Marking the delete operation ready.", exportMaskURI.toString());
            log.info(message);
            taskCompleter.ready(dbClient);
            return;
        }
    } catch (Exception e) {
        log.error("Unexpected error: deleteExportMask failed.", e);
        ServiceError error = DeviceControllerErrors.hds.methodFailed("deleteExportMask", e.getMessage());
        taskCompleter.error(dbClient, error);
    }
    log.info("{} deleteExportMask END...", storage.getSerialNumber());
}
Also used : HDSApiClient(com.emc.storageos.hds.api.HDSApiClient) StringSetMap(com.emc.storageos.db.client.model.StringSetMap) ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) AbstractHDSValidator(com.emc.storageos.volumecontroller.impl.validators.hds.AbstractHDSValidator) ExportMask(com.emc.storageos.db.client.model.ExportMask) ArrayList(java.util.ArrayList) HDSApiExportManager(com.emc.storageos.hds.api.HDSApiExportManager) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) HDSException(com.emc.storageos.hds.HDSException) ExportMaskValidationContext(com.emc.storageos.volumecontroller.impl.validators.contexts.ExportMaskValidationContext) HostStorageDomain(com.emc.storageos.hds.model.HostStorageDomain)

Example 33 with HostStorageDomain

use of com.emc.storageos.hds.model.HostStorageDomain in project coprhd-controller by CoprHD.

the class HDSExportOperations method addVolumes.

@Override
public void addVolumes(StorageSystem storage, URI exportMaskURI, VolumeURIHLU[] volumeURIHLUs, List<Initiator> initiatorList, TaskCompleter taskCompleter) throws DeviceControllerException {
    log.info("{} addVolumes START...", storage.getSerialNumber());
    HDSApiClient hdsApiClient = null;
    String systemObjectID = null;
    try {
        log.info("addVolumes: Export mask id: {}", exportMaskURI);
        log.info("addVolumes: volume-HLU pairs: {}", Joiner.on(',').join(volumeURIHLUs));
        if (initiatorList != null) {
            log.info("addVolumes: initiators impacted: {}", Joiner.on(',').join(initiatorList));
        }
        hdsApiClient = hdsApiFactory.getClient(HDSUtils.getHDSServerManagementServerInfo(storage), storage.getSmisUserName(), storage.getSmisPassword());
        HDSApiExportManager exportMgr = hdsApiClient.getHDSApiExportManager();
        systemObjectID = HDSUtils.getSystemObjectID(storage);
        ExportMask exportMask = dbClient.queryObject(ExportMask.class, exportMaskURI);
        StringSetMap deviceDataMap = exportMask.getDeviceDataMap();
        Set<String> hsdList = deviceDataMap.keySet();
        if (null == hsdList || hsdList.isEmpty()) {
            throw HDSException.exceptions.notAbleToFindHostStorageDomain(systemObjectID);
        }
        if (null != exportMask && !exportMask.getInactive() && !hsdList.isEmpty()) {
            List<Path> pathList = new ArrayList<Path>();
            for (String hsdObjectID : hsdList) {
                // Query the provider to see whether the HSD exists or not.
                HostStorageDomain hsd = exportMgr.getHostStorageDomain(systemObjectID, hsdObjectID);
                if (null != hsd) {
                    Map<String, String> volumeLunMap = getVolumeLunMap(systemObjectID, hsd.getObjectID(), volumeURIHLUs, exportMgr);
                    for (Map.Entry<String, String> entry : volumeLunMap.entrySet()) {
                        if (!checkIfVolumeAlreadyExistsOnHSD(entry.getKey(), hsd)) {
                            Path path = new Path(hsd.getPortID(), hsd.getDomainID(), null, entry.getValue(), entry.getKey());
                            pathList.add(path);
                        }
                    }
                }
            }
            if (!pathList.isEmpty()) {
                List<Path> pathResponseList = hdsApiClient.getHDSBatchApiExportManager().addLUNPathsToHSDs(systemObjectID, pathList, storage.getModel());
                if (null != pathResponseList && !pathResponseList.isEmpty()) {
                    // update volume-lun relationship to exportmask.
                    updateVolumeHLUInfo(volumeURIHLUs, pathResponseList, exportMask);
                    dbClient.updateObject(exportMask);
                } else {
                    log.error(String.format("addVolumes failed - maskURI: %s", exportMaskURI.toString()), new Exception("Not able to parse the response of addLUN from server"));
                    ServiceError serviceError = DeviceControllerException.errors.jobFailedOpMsg(ResourceOperationTypeEnum.ADD_EXPORT_VOLUME.getName(), "Not able to parse the response of addLUN from server");
                    taskCompleter.error(dbClient, serviceError);
                    return;
                }
            } else {
                log.info("All the volumes are already part of the HSDs.");
            }
            taskCompleter.ready(dbClient);
        }
    } catch (Exception e) {
        log.error(String.format("addVolumes failed - maskURI: %s", exportMaskURI.toString()), e);
        ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
        taskCompleter.error(dbClient, serviceError);
    }
    log.info("{} addVolumes END...", storage.getSerialNumber());
}
Also used : Path(com.emc.storageos.hds.model.Path) HDSApiClient(com.emc.storageos.hds.api.HDSApiClient) StringSetMap(com.emc.storageos.db.client.model.StringSetMap) ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) ExportMask(com.emc.storageos.db.client.model.ExportMask) ArrayList(java.util.ArrayList) HDSApiExportManager(com.emc.storageos.hds.api.HDSApiExportManager) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) HDSException(com.emc.storageos.hds.HDSException) HostStorageDomain(com.emc.storageos.hds.model.HostStorageDomain) Map(java.util.Map) HashMap(java.util.HashMap) StringSetMap(com.emc.storageos.db.client.model.StringSetMap)

Example 34 with HostStorageDomain

use of com.emc.storageos.hds.model.HostStorageDomain in project coprhd-controller by CoprHD.

the class HDSExportOperations method refreshExportMask.

@Override
public ExportMask refreshExportMask(StorageSystem storage, ExportMask mask) throws DeviceControllerException {
    try {
        HDSApiClient client = hdsApiFactory.getClient(HDSUtils.getHDSServerManagementServerInfo(storage), storage.getSmisUserName(), storage.getSmisPassword());
        HDSApiExportManager exportManager = client.getHDSApiExportManager();
        String systemObjectID = HDSUtils.getSystemObjectID(storage);
        if (null != mask.getDeviceDataMap() && !mask.getDeviceDataMap().isEmpty()) {
            Set<String> hsdList = mask.getDeviceDataMap().keySet();
            StringBuilder builder = new StringBuilder();
            Set<String> discoveredInitiators = new HashSet<String>();
            String maskName = null;
            Map<String, Integer> discoveredVolumes = new HashMap<String, Integer>();
            for (String hsdObjectIdFromDb : hsdList) {
                HostStorageDomain hsd = exportManager.getHostStorageDomain(systemObjectID, hsdObjectIdFromDb);
                if (null == hsd) {
                    // If the HSD is removed using non-ViPR, update ViPR DB.
                    mask.getDeviceDataMap().remove(hsdObjectIdFromDb);
                    continue;
                }
                maskName = (null == hsd.getName()) ? hsd.getNickname() : hsd.getName();
                // Get volumes and initiators for the masking instance
                discoveredVolumes.putAll(HDSUtils.getVolumesFromHSD(hsd, storage));
                discoveredInitiators.addAll(HDSUtils.getInitiatorsFromHSD(hsd));
            }
            Set existingInitiators = (mask.getExistingInitiators() != null) ? mask.getExistingInitiators() : Collections.emptySet();
            Set existingVolumes = (mask.getExistingVolumes() != null) ? mask.getExistingVolumes().keySet() : Collections.emptySet();
            builder.append(String.format("%nXM object: %s I{%s} V:{%s}%n", maskName, Joiner.on(',').join(existingInitiators), Joiner.on(',').join(existingVolumes)));
            builder.append(String.format("XM discovered: %s I:{%s} V:{%s}%n", maskName, Joiner.on(',').join(discoveredInitiators), Joiner.on(',').join(discoveredVolumes.keySet())));
            List<Initiator> initiatorList = new ArrayList<>();
            if (!CollectionUtils.isEmpty(discoveredInitiators)) {
                for (String port : discoveredInitiators) {
                    Initiator existingInitiator = ExportUtils.getInitiator(Initiator.toPortNetworkId(port), dbClient);
                    if (existingInitiator != null && !existingInitiator.getInactive()) {
                        initiatorList.add(existingInitiator);
                    }
                }
            }
            mask.addInitiators(initiatorList);
            dbClient.updateObject(mask);
            List<String> initiatorsToAddToExisting = new ArrayList<String>();
            List<Initiator> initiatorsToAddToUserAddedAndInitiatorList = new ArrayList<Initiator>();
            /**
             * For the newly discovered initiators, if they are ViPR discovered ports and belong to same resource
             * add them to user added and initiators list, otherwise add to existing list.
             */
            for (String port : discoveredInitiators) {
                String normalizedPort = Initiator.normalizePort(port);
                if (!mask.hasExistingInitiator(normalizedPort) && !mask.hasUserInitiator(normalizedPort)) {
                    Initiator existingInitiator = ExportUtils.getInitiator(Initiator.toPortNetworkId(port), dbClient);
                    // Don't add additional initiator to initiators list if it belongs to different host/cluster
                    if (existingInitiator != null && !ExportMaskUtils.checkIfDifferentResource(mask, existingInitiator)) {
                        log.info("Initiator {}->{} belonging to same compute, adding to userAdded and initiator list.", normalizedPort, existingInitiator.getId());
                        initiatorsToAddToUserAddedAndInitiatorList.add(existingInitiator);
                    } else {
                        initiatorsToAddToExisting.add(normalizedPort);
                    }
                }
            }
            /**
             * Get the existing initiators from the mask and remove the non-discovered ports because
             * they are not discovered and are stale.
             *
             * If the mask has existing initiators but if they are discovered and belongs to same compute resource, then the
             * initiators has to get added to user Added and initiators list, and removed from existing list.
             */
            List<String> initiatorsToRemoveFromExistingList = new ArrayList<String>();
            if (mask.getExistingInitiators() != null && !mask.getExistingInitiators().isEmpty()) {
                for (String existingInitiatorStr : mask.getExistingInitiators()) {
                    if (!discoveredInitiators.contains(existingInitiatorStr)) {
                        initiatorsToRemoveFromExistingList.add(existingInitiatorStr);
                    } else {
                        Initiator existingInitiator = ExportUtils.getInitiator(Initiator.toPortNetworkId(existingInitiatorStr), dbClient);
                        if (existingInitiator != null && !ExportMaskUtils.checkIfDifferentResource(mask, existingInitiator)) {
                            log.info("Initiator {}->{} belonging to same compute, removing from existing," + " and adding to userAdded and initiator list", existingInitiatorStr, existingInitiator.getId());
                            initiatorsToAddToUserAddedAndInitiatorList.add(existingInitiator);
                            initiatorsToRemoveFromExistingList.add(existingInitiatorStr);
                        }
                    }
                }
            }
            /**
             * Get all the initiators from the mask and remove all the ViPR discovered ports.
             * The remaining list has to be removed from user Added and initiator list, because they are not available in ViPR
             * but has to be moved to existing list.
             */
            List<URI> initiatorsToRemoveFromUserAddedAndInitiatorList = new ArrayList<URI>();
            if (mask.getInitiators() != null && !mask.getInitiators().isEmpty()) {
                initiatorsToRemoveFromUserAddedAndInitiatorList.addAll(transform(mask.getInitiators(), CommonTransformerFunctions.FCTN_STRING_TO_URI));
                for (String port : discoveredInitiators) {
                    String normalizedPort = Initiator.normalizePort(port);
                    Initiator initiatorDiscoveredInViPR = ExportUtils.getInitiator(Initiator.toPortNetworkId(port), dbClient);
                    if (initiatorDiscoveredInViPR != null) {
                        initiatorsToRemoveFromUserAddedAndInitiatorList.remove(initiatorDiscoveredInViPR.getId());
                    } else if (!mask.hasExistingInitiator(normalizedPort)) {
                        log.info("Initiator {} not found in database, removing from user Added and initiator list," + " and adding to existing list.", port);
                        initiatorsToAddToExisting.add(normalizedPort);
                    }
                }
            }
            boolean removeInitiators = !initiatorsToRemoveFromExistingList.isEmpty() || !initiatorsToRemoveFromUserAddedAndInitiatorList.isEmpty();
            boolean addInitiators = !initiatorsToAddToUserAddedAndInitiatorList.isEmpty() || !initiatorsToAddToExisting.isEmpty();
            // Check the volumes and update the lists as necessary
            Map<String, Integer> volumesToAdd = ExportMaskUtils.diffAndFindNewVolumes(mask, discoveredVolumes);
            boolean addVolumes = !volumesToAdd.isEmpty();
            boolean removeVolumes = false;
            List<String> volumesToRemove = new ArrayList<String>();
            // if the volume is in export mask's user added volumes and also in the existing volumes, remove from existing volumes
            for (String wwn : discoveredVolumes.keySet()) {
                if (mask.hasExistingVolume(wwn)) {
                    URIQueryResultList volumeList = new URIQueryResultList();
                    dbClient.queryByConstraint(AlternateIdConstraint.Factory.getVolumeWwnConstraint(wwn), volumeList);
                    if (volumeList.iterator().hasNext()) {
                        URI volumeURI = volumeList.iterator().next();
                        if (mask.hasUserCreatedVolume(volumeURI)) {
                            builder.append(String.format("\texisting volumes contain wwn %s, but it is also in the " + "export mask's user added volumes, so removing from existing volumes", wwn));
                            volumesToRemove.add(wwn);
                        }
                    }
                }
            }
            if (mask.getExistingVolumes() != null && !mask.getExistingVolumes().isEmpty()) {
                volumesToRemove.addAll(mask.getExistingVolumes().keySet());
                volumesToRemove.removeAll(discoveredVolumes.keySet());
                removeVolumes = !volumesToRemove.isEmpty();
            }
            // Update user added volume's HLU information in ExportMask and ExportGroup
            ExportMaskUtils.updateHLUsInExportMask(mask, discoveredVolumes, dbClient);
            builder.append(String.format("XM refresh: %s existing initiators; add:{%s} remove:{%s}%n", maskName, Joiner.on(',').join(initiatorsToAddToExisting), Joiner.on(',').join(initiatorsToRemoveFromExistingList)));
            builder.append(String.format("XM refresh: %s user added and initiator list; add:{%s} remove:{%s}%n", maskName, Joiner.on(',').join(initiatorsToAddToUserAddedAndInitiatorList), Joiner.on(',').join(initiatorsToRemoveFromUserAddedAndInitiatorList)));
            builder.append(String.format("XM refresh: %s volumes; add:{%s} remove:{%s}%n", maskName, Joiner.on(',').join(volumesToAdd.keySet()), Joiner.on(',').join(volumesToRemove)));
            // Any changes indicated, then update the mask and persist it
            if (addInitiators || removeInitiators || addVolumes || removeVolumes) {
                builder.append("XM refresh: There are changes to mask, " + "updating it...\n");
                if (!initiatorsToRemoveFromUserAddedAndInitiatorList.isEmpty()) {
                    mask.removeInitiatorURIs(initiatorsToRemoveFromUserAddedAndInitiatorList);
                    mask.removeFromUserAddedInitiatorsByURI(initiatorsToRemoveFromUserAddedAndInitiatorList);
                }
                List<Initiator> userAddedInitiators = ExportMaskUtils.findIfInitiatorsAreUserAddedInAnotherMask(mask, initiatorsToAddToUserAddedAndInitiatorList, dbClient);
                mask.addToUserCreatedInitiators(userAddedInitiators);
                builder.append(String.format("XM refresh: %s user added initiators; add:{%s} remove:{%s}%n", maskName, Joiner.on(',').join(userAddedInitiators), Joiner.on(',').join(initiatorsToRemoveFromUserAddedAndInitiatorList)));
                mask.addInitiators(initiatorsToAddToUserAddedAndInitiatorList);
                mask.addToUserCreatedInitiators(initiatorsToAddToUserAddedAndInitiatorList);
                mask.addToExistingInitiatorsIfAbsent(initiatorsToAddToExisting);
                mask.removeFromExistingInitiators(initiatorsToRemoveFromExistingList);
                mask.removeFromExistingVolumes(volumesToRemove);
                mask.addToExistingVolumesIfAbsent(volumesToAdd);
                ExportMaskUtils.sanitizeExportMaskContainers(dbClient, mask);
                builder.append("XM refresh: There are changes to mask, " + "updating it...\n");
                dbClient.updateObject(mask);
            } else {
                builder.append("XM refresh: There are no changes to the mask\n");
            }
            _networkDeviceController.refreshZoningMap(mask, transform(initiatorsToRemoveFromUserAddedAndInitiatorList, CommonTransformerFunctions.FCTN_URI_TO_STRING), Collections.EMPTY_LIST, (addInitiators || removeInitiators), true);
            log.info(builder.toString());
        }
    } catch (Exception e) {
        log.error("Error when attempting to query HostStorageDomain information", e);
        throw HDSException.exceptions.refreshExistingMaskFailure(mask.getLabel());
    }
    return mask;
}
Also used : HDSApiClient(com.emc.storageos.hds.api.HDSApiClient) Set(java.util.Set) HashSet(java.util.HashSet) StringSet(com.emc.storageos.db.client.model.StringSet) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) HDSApiExportManager(com.emc.storageos.hds.api.HDSApiExportManager) URI(java.net.URI) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) HDSException(com.emc.storageos.hds.HDSException) HostStorageDomain(com.emc.storageos.hds.model.HostStorageDomain) Initiator(com.emc.storageos.db.client.model.Initiator) HashSet(java.util.HashSet)

Example 35 with HostStorageDomain

use of com.emc.storageos.hds.model.HostStorageDomain in project coprhd-controller by CoprHD.

the class HDSExportOperations method processTargetPortsToFormHSDs.

/**
 * This routine iterates through the target ports and prepares a batch of HostStorageDomain
 * Objects with required information.
 *
 * @param storage
 * @param targetURIList
 * @param hostName
 * @param exportMask
 * @param hostModeInfo
 * @return
 */
private List<HostStorageDomain> processTargetPortsToFormHSDs(HDSApiClient hdsApiClient, StorageSystem storage, List<URI> targetURIList, String hostName, ExportMask exportMask, Pair<String, String> hostModeInfo, String systemObjectID) throws Exception {
    List<HostStorageDomain> hsdList = new ArrayList<HostStorageDomain>();
    String hostMode = null, hostModeOption = null;
    if (hostModeInfo != null) {
        hostMode = hostModeInfo.first;
        hostModeOption = hostModeInfo.second;
    }
    for (URI targetPortURI : targetURIList) {
        StoragePort storagePort = dbClient.queryObject(StoragePort.class, targetPortURI);
        String storagePortNumber = getStoragePortNumber(storagePort.getNativeGuid());
        DataSource dataSource = dataSourceFactory.createHSDNickNameDataSource(hostName, storagePortNumber, storage);
        // Hitachi allows only 32 chars as nickname, we should trim the
        // length 32 chars.
        String hsdNickName = customConfigHandler.getComputedCustomConfigValue(CustomConfigConstants.HDS_HOST_STORAGE_DOMAIN_NICKNAME_MASK_NAME, storage.getSystemType(), dataSource);
        // HostStorageDomain.
        if (Transport.IP.name().equalsIgnoreCase(storagePort.getTransportType())) {
            log.info("Populating iSCSI HSD for storage: {}", storage.getSerialNumber());
            HostStorageDomain hostGroup = new HostStorageDomain(storagePortNumber, exportMask.getMaskName(), HDSConstants.ISCSI_TARGET_DOMAIN_TYPE, hsdNickName);
            hostGroup.setHostMode(hostMode);
            hostGroup.setHostModeOption(hostModeOption);
            hsdList.add(hostGroup);
        }
        // If there are FC initiators then create a FC HostStorageDomain.
        if (Transport.FC.name().equalsIgnoreCase(storagePort.getTransportType())) {
            log.info("Populating FC HSD for storage: {}", storage.getSerialNumber());
            HostStorageDomain hostGroup = new HostStorageDomain(storagePortNumber, exportMask.getMaskName(), HDSConstants.HOST_GROUP_DOMAIN_TYPE, hsdNickName);
            hostGroup.setHostMode(hostMode);
            hostGroup.setHostModeOption(hostModeOption);
            hsdList.add(hostGroup);
        }
    }
    return hsdList;
}
Also used : HostStorageDomain(com.emc.storageos.hds.model.HostStorageDomain) ArrayList(java.util.ArrayList) StoragePort(com.emc.storageos.db.client.model.StoragePort) URI(java.net.URI) DataSource(com.emc.storageos.customconfigcontroller.DataSource)

Aggregations

HostStorageDomain (com.emc.storageos.hds.model.HostStorageDomain)35 URI (java.net.URI)18 HashMap (java.util.HashMap)17 ArrayList (java.util.ArrayList)16 HDSApiClient (com.emc.storageos.hds.api.HDSApiClient)12 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)11 HDSApiExportManager (com.emc.storageos.hds.api.HDSApiExportManager)11 StorageArray (com.emc.storageos.hds.model.StorageArray)11 ClientResponse (com.sun.jersey.api.client.ClientResponse)11 IOException (java.io.IOException)11 InputStream (java.io.InputStream)11 JavaResult (org.milyn.payload.JavaResult)11 ExportMask (com.emc.storageos.db.client.model.ExportMask)10 HDSException (com.emc.storageos.hds.HDSException)9 StringSetMap (com.emc.storageos.db.client.model.StringSetMap)8 Path (com.emc.storageos.hds.model.Path)7 HashSet (java.util.HashSet)7 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)6 StoragePort (com.emc.storageos.db.client.model.StoragePort)5 Add (com.emc.storageos.hds.model.Add)5