Search in sources :

Example 16 with HostRestRep

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);
}
Also used : HostRestRep(com.emc.storageos.model.host.HostRestRep)

Example 17 with HostRestRep

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));
}
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 18 with HostRestRep

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);
}
Also used : ClusterRestRep(com.emc.storageos.model.host.cluster.ClusterRestRep) HostRestRep(com.emc.storageos.model.host.HostRestRep) VcenterRestRep(com.emc.storageos.model.host.vcenter.VcenterRestRep) VcenterDataCenterRestRep(com.emc.storageos.model.host.vcenter.VcenterDataCenterRestRep) ProjectRestRep(com.emc.storageos.model.project.ProjectRestRep)

Example 19 with HostRestRep

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));
}
Also used : ClusterRestRep(com.emc.storageos.model.host.cluster.ClusterRestRep) HostRestRep(com.emc.storageos.model.host.HostRestRep) DefaultResourceFilter(com.emc.vipr.client.core.filters.DefaultResourceFilter) FilterChain(com.emc.vipr.client.core.filters.FilterChain) URI(java.net.URI) HostTypeFilter(com.emc.vipr.client.core.filters.HostTypeFilter)

Example 20 with HostRestRep

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));
}
Also used : HostRestRep(com.emc.storageos.model.host.HostRestRep) VcenterDataCenterRestRep(com.emc.storageos.model.host.vcenter.VcenterDataCenterRestRep) URI(java.net.URI) HostInfo(models.datatable.HostDataTable.HostInfo)

Aggregations

HostRestRep (com.emc.storageos.model.host.HostRestRep)46 URI (java.net.URI)17 ArrayList (java.util.ArrayList)10 ExecutionException (com.emc.sa.engine.ExecutionException)7 Host (com.emc.storageos.db.client.model.Host)6 ClusterRestRep (com.emc.storageos.model.host.cluster.ClusterRestRep)6 DeactivateHost (com.emc.sa.service.vipr.compute.tasks.DeactivateHost)5 DiscoverHost (com.emc.sa.service.vipr.compute.tasks.DiscoverHost)5 GetHost (com.emc.sa.service.vipr.tasks.GetHost)5 ExportGroupRestRep (com.emc.storageos.model.block.export.ExportGroupRestRep)5 TimeoutException (com.emc.vipr.client.exceptions.TimeoutException)5 ViPRException (com.emc.vipr.client.exceptions.ViPRException)5 HashMap (java.util.HashMap)5 HostUpdateParam (com.emc.storageos.model.host.HostUpdateParam)4 InitiatorRestRep (com.emc.storageos.model.host.InitiatorRestRep)4 Asset (com.emc.sa.asset.annotation.Asset)3 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)3 BlockObjectRestRep (com.emc.storageos.model.block.BlockObjectRestRep)3 VcenterDataCenterRestRep (com.emc.storageos.model.host.vcenter.VcenterDataCenterRestRep)3 Task (com.emc.vipr.client.Task)3