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));
}
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();
}
}
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())));
}
});
}
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);
}
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);
}
Aggregations