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