Search in sources :

Example 6 with ClusterRestRep

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

the class BlockExportGroups method availableClustersJson.

public static void availableClustersJson(String exportGroupId) {
    List<ClusterRestRep> availableClusters = Lists.newArrayList();
    ExportGroupRestRep exportGroup = getViprClient().blockExports().get(uri(exportGroupId));
    List<URI> allClusterIds = getViprClient().clusters().listBulkIds();
    final List<URI> exportGroupClusters = ResourceUtils.ids(exportGroup.getClusters());
    availableClusters = getViprClient().clusters().getByIds(allClusterIds, new DefaultResourceFilter<ClusterRestRep>() {

        @Override
        public boolean accept(ClusterRestRep item) {
            return !exportGroupClusters.contains(item.getId());
        }
    });
    renderJSON(DataTablesSupport.createJSON(availableClusters, params));
}
Also used : ClusterRestRep(com.emc.storageos.model.host.cluster.ClusterRestRep) ExportGroupRestRep(com.emc.storageos.model.block.export.ExportGroupRestRep) DefaultResourceFilter(com.emc.vipr.client.core.filters.DefaultResourceFilter) URI(java.net.URI)

Example 7 with ClusterRestRep

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

the class ClusterProvider method getVblockClusterOptions.

@Asset("vblockCluster")
public List<AssetOption> getVblockClusterOptions(AssetOptionsContext ctx) {
    debug("getting vblock clusters");
    Collection<ClusterRestRep> clusters = getClusters(ctx);
    List<AssetOption> options = Lists.newArrayList();
    for (ClusterRestRep value : clusters) {
        List<HostRestRep> hostList = api(ctx).hosts().getByCluster(value.getId());
        for (HostRestRep host : hostList) {
            // If Cluster has an esx or No-OS host and if host has a computeElement - then add it to the list
            if (host.getType() != null && (host.getType().equalsIgnoreCase(Host.HostType.Esx.name()) || host.getType().equalsIgnoreCase(Host.HostType.No_OS.name())) && host.getComputeElement() != null && !NullColumnValueGetter.isNullURI(host.getComputeElement().getId())) {
                String dataCenterName = getDataCenterName(ctx, value);
                options.add(createClusterOption(ctx, value, dataCenterName));
                break;
            }
        }
    }
    AssetOptionsUtils.sortOptionsByLabel(options);
    return options;
}
Also used : ClusterRestRep(com.emc.storageos.model.host.cluster.ClusterRestRep) HostRestRep(com.emc.storageos.model.host.HostRestRep) AssetOption(com.emc.vipr.model.catalog.AssetOption) Asset(com.emc.sa.asset.annotation.Asset)

Example 8 with ClusterRestRep

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

the class ClusterProvider method getClusterOptions.

@Asset("cluster")
public List<AssetOption> getClusterOptions(AssetOptionsContext ctx) {
    debug("getting clusters");
    Collection<ClusterRestRep> clusters = getClusters(ctx);
    List<AssetOption> options = Lists.newArrayList();
    for (ClusterRestRep value : clusters) {
        String dataCenterName = getDataCenterName(ctx, value);
        options.add(createClusterOption(ctx, value, dataCenterName));
    }
    AssetOptionsUtils.sortOptionsByLabel(options);
    return options;
}
Also used : ClusterRestRep(com.emc.storageos.model.host.cluster.ClusterRestRep) AssetOption(com.emc.vipr.model.catalog.AssetOption) Asset(com.emc.sa.asset.annotation.Asset)

Example 9 with ClusterRestRep

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

the class ClusterProvider method getEsxClusterOptions.

@Asset("esxCluster")
public List<AssetOption> getEsxClusterOptions(AssetOptionsContext ctx) {
    debug("getting esx clusters");
    Collection<ClusterRestRep> clusters = getClusters(ctx);
    List<AssetOption> options = Lists.newArrayList();
    for (ClusterRestRep value : clusters) {
        // If Cluster has an esx host - then add it to the list
        List<HostRestRep> hostList = api(ctx).hosts().getByCluster(value.getId());
        for (HostRestRep host : hostList) {
            if (host.getType().equalsIgnoreCase(Host.HostType.Esx.name())) {
                String dataCenterName = getDataCenterName(ctx, value);
                options.add(createClusterOption(ctx, value, dataCenterName));
                break;
            }
        }
    }
    AssetOptionsUtils.sortOptionsByLabel(options);
    return options;
}
Also used : ClusterRestRep(com.emc.storageos.model.host.cluster.ClusterRestRep) HostRestRep(com.emc.storageos.model.host.HostRestRep) AssetOption(com.emc.vipr.model.catalog.AssetOption) Asset(com.emc.sa.asset.annotation.Asset)

Example 10 with ClusterRestRep

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

the class VMWareProvider method listDatacentersByVCenterAndCluster.

protected List<VcenterDataCenterRestRep> listDatacentersByVCenterAndCluster(AssetOptionsContext context, URI vcenterId, URI clusterId) {
    ClusterRestRep clusterRestRep = api(context).clusters().get(clusterId);
    RelatedResourceRep vcenterDatacenter = clusterRestRep.getVcenterDataCenter();
    if (vcenterDatacenter == null) {
        // return all datacenters for this datacenter
        return api(context).vcenterDataCenters().getByVcenter(vcenterId, context.getTenant());
    } else {
        // return the datacenter this vipr cluster is already associated with in vcenter
        VcenterDataCenterRestRep vcenterDataCenterRestRep = api(context).vcenterDataCenters().get(vcenterDatacenter.getId());
        return Arrays.asList(vcenterDataCenterRestRep);
    }
}
Also used : ClusterRestRep(com.emc.storageos.model.host.cluster.ClusterRestRep) RelatedResourceRep(com.emc.storageos.model.RelatedResourceRep) 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