Search in sources :

Example 6 with InitiatorRestRep

use of com.emc.storageos.model.host.InitiatorRestRep in project coprhd-controller by CoprHD.

the class BlockProvider method buildPathOptions.

/* helper for building the list of asset option for affected and removed paths */
private List<AssetOption> buildPathOptions(AssetOptionsContext ctx, List<InitiatorPortMapRestRep> list, String message) {
    ViPRCoreClient client = api(ctx);
    List<AssetOption> options = Lists.newArrayList();
    for (InitiatorPortMapRestRep ipm : list) {
        InitiatorRestRep initiator = ipm.getInitiator();
        List<NamedRelatedResourceRep> ports = ipm.getStoragePorts();
        String portList = new String(" ");
        List<URI> portURIs = new ArrayList<URI>();
        for (NamedRelatedResourceRep port : ports) {
            StoragePortRestRep p = client.storagePorts().get(port.getId());
            portList += p.getPortName() + " ";
            portURIs.add(port.getId());
        }
        Map<URI, List<URI>> key = new HashMap<URI, List<URI>>();
        key.put(initiator.getId(), portURIs);
        String label = getMessage(message, initiator.getHostName(), initiator.getName(), portList);
        String keyString = EMPTY_STRING;
        try {
            keyString = CatalogSerializationUtils.serializeToString(key);
        } catch (Exception ex) {
        }
        options.add(new AssetOption(keyString, label));
    }
    return options;
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) AssetOption(com.emc.vipr.model.catalog.AssetOption) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) StoragePortRestRep(com.emc.storageos.model.ports.StoragePortRestRep) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) InitiatorRestRep(com.emc.storageos.model.host.InitiatorRestRep) URI(java.net.URI) InitiatorPortMapRestRep(com.emc.storageos.model.block.export.InitiatorPortMapRestRep) StoragePortGroupRestRepList(com.emc.storageos.model.portgroup.StoragePortGroupRestRepList) BlockSnapshotSessionList(com.emc.storageos.model.block.BlockSnapshotSessionList) StoragePortList(com.emc.storageos.model.ports.StoragePortList) ArrayList(java.util.ArrayList) VolumeGroupList(com.emc.storageos.model.application.VolumeGroupList) List(java.util.List) NamedVolumesList(com.emc.storageos.model.block.NamedVolumesList) SnapshotList(com.emc.storageos.model.SnapshotList)

Example 7 with InitiatorRestRep

use of com.emc.storageos.model.host.InitiatorRestRep in project coprhd-controller by CoprHD.

the class BlockExportGroups method availableInitiatorsJson.

public static void availableInitiatorsJson(String id) {
    CachedResources<HostRestRep> hosts = HostUtils.createCache();
    List<EndpointInfo> items = Lists.newArrayList();
    for (InitiatorRestRep initiator : getEligibleInitiators(uri(id))) {
        items.add(new EndpointInfo(initiator, hosts));
    }
    renderJSON(DataTablesSupport.createJSON(items, params));
}
Also used : EndpointInfo(models.datatable.NetworkEndpointDataTable.EndpointInfo) HostRestRep(com.emc.storageos.model.host.HostRestRep) InitiatorRestRep(com.emc.storageos.model.host.InitiatorRestRep)

Example 8 with InitiatorRestRep

use of com.emc.storageos.model.host.InitiatorRestRep in project coprhd-controller by CoprHD.

the class Networks method endpointsJson.

/**
 * Creates and renders JSON datatable source for endpoints for the given network.
 *
 * @param networkId
 *            the network ID.
 */
public static void endpointsJson(String networkId) {
    NetworkRestRep network = NetworkUtils.getNetwork(networkId);
    if (network == null) {
        error(MessagesUtils.get(UNKNOWN, networkId));
    }
    List<EndpointInfo> items = Lists.newArrayList();
    // All known endpoints, remove endpoints from storage systems and hosts to get manual endpoints
    Set<String> endpoints = Sets.newTreeSet(new Comparator<String>() {

        @Override
        public int compare(String s1, String s2) {
            return s1.compareToIgnoreCase(s2);
        }
    });
    endpoints.addAll(network.getEndpoints());
    // Add ports from storage systems
    CachedResources<StorageSystemRestRep> storageSystems = StorageSystemUtils.createCache();
    for (StoragePortRestRep storagePort : StoragePortUtils.getStoragePortsByNetwork(network.getId())) {
        items.add(new EndpointInfo(storagePort, storageSystems));
        for (String endpoint : NetworkUtils.getEndPoints(storagePort)) {
            endpoints.remove(endpoint);
        }
    }
    // Add ports from hosts
    CachedResources<HostRestRep> hosts = HostUtils.createCache();
    for (InitiatorRestRep initiator : NetworkUtils.getInitiators(network.getId())) {
        if (initiator.getHost() != null) {
            items.add(new EndpointInfo(initiator, hosts));
            endpoints.remove(NetworkUtils.getEndPoint(initiator));
        }
    }
    for (IpInterfaceRestRep ipInterface : NetworkUtils.getIpInterfaces(network.getId())) {
        if (ipInterface.getHost() != null) {
            items.add(new EndpointInfo(ipInterface, hosts));
            endpoints.remove(NetworkUtils.getEndPoint(ipInterface));
        }
    }
    // Add any remaining endpoints as 'manual'
    for (String endpoint : endpoints) {
        items.add(new EndpointInfo(endpoint));
    }
    setEndpointAttrs(network, items);
    renderJSON(DataTablesSupport.createJSON(items, params));
}
Also used : StorageSystemRestRep(com.emc.storageos.model.systems.StorageSystemRestRep) StoragePortRestRep(com.emc.storageos.model.ports.StoragePortRestRep) InitiatorRestRep(com.emc.storageos.model.host.InitiatorRestRep) IpInterfaceRestRep(com.emc.storageos.model.host.IpInterfaceRestRep) EndpointInfo(models.datatable.NetworkEndpointDataTable.EndpointInfo) HostRestRep(com.emc.storageos.model.host.HostRestRep) NetworkRestRep(com.emc.storageos.model.varray.NetworkRestRep)

Example 9 with InitiatorRestRep

use of com.emc.storageos.model.host.InitiatorRestRep in project coprhd-controller by CoprHD.

the class HostMapper method map.

public static InitiatorRestRep map(Initiator from) {
    if (from == null) {
        return null;
    }
    InitiatorRestRep to = new InitiatorRestRep();
    mapHostInterfaceFields(from, to);
    mapDataObjectFields(from, to);
    to.setHostName(from.getHostName());
    to.setInitiatorNode(from.getInitiatorNode());
    to.setInitiatorPort(from.getInitiatorPort());
    if (NullColumnValueGetter.isNotNullValue(from.getClusterName())) {
        to.setClusterName(from.getClusterName());
    }
    return to;
}
Also used : InitiatorRestRep(com.emc.storageos.model.host.InitiatorRestRep)

Aggregations

InitiatorRestRep (com.emc.storageos.model.host.InitiatorRestRep)9 HostRestRep (com.emc.storageos.model.host.HostRestRep)4 IpInterfaceRestRep (com.emc.storageos.model.host.IpInterfaceRestRep)3 EndpointInfo (models.datatable.NetworkEndpointDataTable.EndpointInfo)3 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)2 StoragePortRestRep (com.emc.storageos.model.ports.StoragePortRestRep)2 NetworkRestRep (com.emc.storageos.model.varray.NetworkRestRep)2 FlashException (controllers.util.FlashException)2 URI (java.net.URI)2 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)1 SnapshotList (com.emc.storageos.model.SnapshotList)1 VolumeGroupList (com.emc.storageos.model.application.VolumeGroupList)1 BlockSnapshotSessionList (com.emc.storageos.model.block.BlockSnapshotSessionList)1 NamedVolumesList (com.emc.storageos.model.block.NamedVolumesList)1 ExportGroupRestRep (com.emc.storageos.model.block.export.ExportGroupRestRep)1 InitiatorPortMapRestRep (com.emc.storageos.model.block.export.InitiatorPortMapRestRep)1 StoragePortGroupRestRepList (com.emc.storageos.model.portgroup.StoragePortGroupRestRepList)1 StoragePortList (com.emc.storageos.model.ports.StoragePortList)1 StorageSystemRestRep (com.emc.storageos.model.systems.StorageSystemRestRep)1 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)1