use of com.emc.storageos.model.host.HostRestRep in project coprhd-controller by CoprHD.
the class ClusterAutoExportTest method test1.
public void test1() throws Exception {
// Move host from one cluster to another. Exports should be automatic.
HostRestRep host = getHosts(cluster1).get(0);
moveHost(host, cluster2);
verifyHostNotInClusterExport(host, export1);
verifyHostInClusterExport(host, export2);
}
use of com.emc.storageos.model.host.HostRestRep 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.HostRestRep in project coprhd-controller by CoprHD.
the class HostClusters method itemDetails.
public static void itemDetails(String id) {
ClusterRestRep cluster = ClusterUtils.getCluster(uri(id));
if (cluster == null) {
error(MessagesUtils.get(UNKNOWN, id));
}
ProjectRestRep project = ProjectUtils.getProject(ResourceUtils.id(cluster.getProject()));
List<HostRestRep> hosts = ClusterUtils.getHosts(uri(id));
VcenterDataCenterRestRep dataCenter = VCenterUtils.getDataCenter(ResourceUtils.id(cluster.getVcenterDataCenter()));
VcenterRestRep vcenter = VCenterUtils.getVCenter(dataCenter);
render(cluster, project, hosts, dataCenter, vcenter);
}
use of com.emc.storageos.model.host.HostRestRep in project coprhd-controller by CoprHD.
the class HostClusters method availableHostJson.
public static void availableHostJson(String id) {
final URI clusterId = uri(id);
ClusterRestRep cluster = ClusterUtils.getCluster(clusterId);
List<HostRestRep> hosts = null;
DefaultResourceFilter<HostRestRep> defaultHostResourceFilter = new DefaultResourceFilter<HostRestRep>() {
@Override
public boolean accept(HostRestRep hostRestRep) {
return hostRestRep.getCluster() == null || !hostRestRep.getCluster().getId().equals(clusterId);
}
};
// If we have existing hosts in the cluster, limit to that host type
List<HostRestRep> existingHosts = ClusterUtils.getHosts(uri(id));
if (!existingHosts.isEmpty()) {
FilterChain<HostRestRep> hostTypeFilter = new FilterChain<HostRestRep>(new HostTypeFilter(existingHosts.get(0).getType()));
hosts = getViprClient().hosts().getByTenant(cluster.getTenant().getId(), hostTypeFilter.and(defaultHostResourceFilter));
} else {
hosts = getViprClient().hosts().getByTenant(cluster.getTenant().getId(), defaultHostResourceFilter);
}
renderJSON(DataTablesSupport.createJSON(hosts, params));
}
use of com.emc.storageos.model.host.HostRestRep in project coprhd-controller by CoprHD.
the class Hosts method listJson.
public static void listJson() {
String tenantId = Models.currentAdminTenant();
List<HostRestRep> hosts = HostUtils.getHosts(tenantId);
Map<URI, String> clusterMap = ResourceUtils.mapNames(getViprClient().clusters().listByTenant(uri(tenantId)));
Set<URI> dataCenterIds = HostUtils.getDataCenterIds(hosts);
Map<URI, VcenterDataCenterRestRep> vcenterDataCenters = HostUtils.getVcenterDataCenters(dataCenterIds);
List<HostInfo> hostInfos = Lists.newArrayList();
for (HostRestRep host : hosts) {
hostInfos.add(new HostInfo(host, clusterMap, vcenterDataCenters));
}
renderJSON(DataTablesSupport.createJSON(hostInfos, params));
}
Aggregations