Search in sources :

Example 1 with ClusterRestRep

use of com.emc.storageos.model.host.cluster.ClusterRestRep 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 2 with ClusterRestRep

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

the class HostClusters method editHosts.

@FlashException("list")
public static void editHosts(String id) {
    ClusterRestRep cluster = ClusterUtils.getCluster(uri(id));
    if (cluster != null) {
        SimpleHostDataTable dataTable = new SimpleHostDataTable();
        render(dataTable, cluster);
    } else {
        flash.error(MessagesUtils.get(UNKNOWN, id));
        list();
    }
}
Also used : ClusterRestRep(com.emc.storageos.model.host.cluster.ClusterRestRep) SimpleHostDataTable(models.datatable.SimpleHostDataTable) FlashException(controllers.util.FlashException)

Example 3 with ClusterRestRep

use of com.emc.storageos.model.host.cluster.ClusterRestRep 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 4 with ClusterRestRep

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

the class HostClusters method edit.

@FlashException("list")
public static void edit(String id) {
    ClusterRestRep cluster = ClusterUtils.getCluster(uri(id));
    if (cluster != null) {
        HostClusterForm hostCluster = new HostClusterForm(cluster);
        render(hostCluster);
    } else {
        flash.error(MessagesUtils.get(UNKNOWN, id));
        list();
    }
}
Also used : ClusterRestRep(com.emc.storageos.model.host.cluster.ClusterRestRep) FlashException(controllers.util.FlashException)

Example 5 with ClusterRestRep

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

the class Hosts method itemDetails.

public static void itemDetails(String id) {
    HostRestRep host = HostUtils.getHost(uri(id));
    ClusterRestRep cluster = ClusterUtils.getCluster(ResourceUtils.id(host.getCluster()));
    VcenterDataCenterRestRep dataCenter = VCenterUtils.getDataCenter(ResourceUtils.id(host.getvCenterDataCenter()));
    VcenterRestRep vcenter = VCenterUtils.getVCenter(dataCenter);
    render(host, cluster, 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)

Aggregations

ClusterRestRep (com.emc.storageos.model.host.cluster.ClusterRestRep)23 HostRestRep (com.emc.storageos.model.host.HostRestRep)7 Asset (com.emc.sa.asset.annotation.Asset)6 AssetOption (com.emc.vipr.model.catalog.AssetOption)6 URI (java.net.URI)6 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)5 VcenterDataCenterRestRep (com.emc.storageos.model.host.vcenter.VcenterDataCenterRestRep)4 VcenterRestRep (com.emc.storageos.model.host.vcenter.VcenterRestRep)4 DefaultResourceFilter (com.emc.vipr.client.core.filters.DefaultResourceFilter)3 ProjectRestRep (com.emc.storageos.model.project.ProjectRestRep)2 FlashException (controllers.util.FlashException)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)1 Vcenter (com.emc.storageos.db.client.model.Vcenter)1 VcenterDataCenter (com.emc.storageos.db.client.model.VcenterDataCenter)1 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)1 SnapshotList (com.emc.storageos.model.SnapshotList)1 VirtualArrayRelatedResourceRep (com.emc.storageos.model.VirtualArrayRelatedResourceRep)1 VolumeGroupList (com.emc.storageos.model.application.VolumeGroupList)1