Search in sources :

Example 1 with InitiatorRestRep

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

the class Networks method availableHostEndpointsJson.

public static void availableHostEndpointsJson(String id) {
    NetworkRestRep network = NetworkUtils.getNetwork(id);
    CachedResources<HostRestRep> hosts = HostUtils.createCache();
    List<EndpointInfo> items = Lists.newArrayList();
    if (TransportProtocols.isIp(network.getTransportType())) {
        // Host IP interfaces not in the network
        for (IpInterfaceRestRep ipInterface : NetworkUtils.getEligibleIpInterfaces(network.getId())) {
            items.add(new EndpointInfo(ipInterface, hosts));
        }
    }
    // Host initiators not in the network
    Set<String> protocols = NetworkUtils.getSupportedProtocols(network);
    for (InitiatorRestRep initiator : NetworkUtils.getEligibleInitiators(network.getId(), protocols)) {
        items.add(new EndpointInfo(initiator, hosts));
    }
    setEndpointAttrs(network, items);
    renderJSON(DataTablesSupport.createJSON(items, params));
}
Also used : EndpointInfo(models.datatable.NetworkEndpointDataTable.EndpointInfo) HostRestRep(com.emc.storageos.model.host.HostRestRep) IpInterfaceRestRep(com.emc.storageos.model.host.IpInterfaceRestRep) InitiatorRestRep(com.emc.storageos.model.host.InitiatorRestRep) NetworkRestRep(com.emc.storageos.model.varray.NetworkRestRep)

Example 2 with InitiatorRestRep

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

the class Hosts method edit.

@FlashException("list")
public static void edit(String id) {
    HostRestRep dbHost = HostUtils.getHost(uri(id));
    if (dbHost != null) {
        addReferenceData();
        HostForm host = new HostForm(dbHost);
        List<InitiatorRestRep> initiators = HostUtils.getInitiators(dbHost.getId());
        List<IpInterfaceRestRep> ipInterfaces = HostUtils.getIpInterfaces(dbHost.getId());
        render(host, dbHost, initiators, ipInterfaces);
    } else {
        flash.error(MessagesUtils.get(UNKNOWN, id));
        list();
    }
}
Also used : HostRestRep(com.emc.storageos.model.host.HostRestRep) InitiatorRestRep(com.emc.storageos.model.host.InitiatorRestRep) IpInterfaceRestRep(com.emc.storageos.model.host.IpInterfaceRestRep) FlashException(controllers.util.FlashException)

Example 3 with InitiatorRestRep

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

the class BlockExportGroups method getEligibleInitiators.

/**
 * Return list of initiators that can be added to this export group
 *
 * @param exportGroupId id of the export group
 * @return list of initiators
 */
public static List<InitiatorRestRep> getEligibleInitiators(URI exportGroupId) {
    if (exportGroupId == null) {
        return Lists.newArrayList();
    }
    ExportGroupRestRep exportGroup = getViprClient().blockExports().get(exportGroupId);
    final List<URI> initiatorsInExport = ResourceUtils.ids(exportGroup.getInitiators());
    List<URI> allInitiatorIds = getViprClient().initiators().listBulkIds();
    final List<URI> validHosts = getValidHostsForInitiatorExport(exportGroup);
    return getViprClient().initiators().getByIds(allInitiatorIds, new DefaultResourceFilter<InitiatorRestRep>() {

        @Override
        public boolean accept(InitiatorRestRep item) {
            return !initiatorsInExport.contains(item.getId()) && (validHosts.isEmpty() || (item.getHost() != null && !NullColumnValueGetter.isNullURI(item.getHost().getId()) && validHosts.contains(item.getHost().getId())));
        }
    });
}
Also used : ExportGroupRestRep(com.emc.storageos.model.block.export.ExportGroupRestRep) URI(java.net.URI) InitiatorRestRep(com.emc.storageos.model.host.InitiatorRestRep)

Example 4 with InitiatorRestRep

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

the class HostInitiators method delete.

@FlashException
public static void delete(String hostId, @As(",") String[] ids) {
    if (ids != null && ids.length > 0) {
        for (String initiatorId : ids) {
            InitiatorRestRep initiator = getViprClient().initiators().get(uri(initiatorId));
            HostUtils.deactivateInitiator(initiator);
        }
        flash.success(MessagesUtils.get(DELETED));
    }
    list(hostId);
}
Also used : InitiatorRestRep(com.emc.storageos.model.host.InitiatorRestRep) FlashException(controllers.util.FlashException)

Example 5 with InitiatorRestRep

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

the class VirtualArrays method findByInitiators.

/**
 * Finds the list of virtual arrays connected to any of the given initiators, optionally filtering the results.
 *
 * @param initiators
 *            the initiators.
 * @param filter
 *            the resource filter to apply to the results as they are returned (optional).
 * @return the list of connected virtual arrays.
 */
public List<VirtualArrayRestRep> findByInitiators(Collection<InitiatorRestRep> initiators, ResourceFilter<VirtualArrayRestRep> filter) {
    // Collect unique virtual array refs before fetching
    Set<RelatedResourceRep> virtualArrayRefs = new TreeSet<RelatedResourceRep>(new RelatedResourceComparator());
    for (InitiatorRestRep initiator : initiators) {
        String port = initiator.getInitiatorPort();
        virtualArrayRefs.addAll(performSearchBy(SearchConstants.INITIATOR_PORT_PARAM, port));
    }
    return getByRefs(virtualArrayRefs, filter);
}
Also used : NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) RelatedResourceRep(com.emc.storageos.model.RelatedResourceRep) RelatedResourceComparator(com.emc.vipr.client.core.util.RelatedResourceComparator) TreeSet(java.util.TreeSet) 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