use of com.emc.storageos.model.host.vcenter.VcenterRestRep in project coprhd-controller by CoprHD.
the class HostMapper method map.
public static VcenterRestRep map(Vcenter from) {
if (from == null) {
return null;
}
VcenterRestRep to = new VcenterRestRep();
mapDiscoveredSystemObjectFields(from, to);
to.setUsername(from.getUsername());
to.setPortNumber(from.getPortNumber());
to.setIpAddress(from.getIpAddress());
to.setUseSsl(from.getUseSSL());
to.setTenant(toRelatedResource(ResourceTypeEnum.TENANT, from.findVcenterTenant()));
to.setOsVersion(from.getOsVersion());
to.setCascadeTenancy(from.getCascadeTenancy());
return to;
}
use of com.emc.storageos.model.host.vcenter.VcenterRestRep 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.vcenter.VcenterRestRep 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);
}
use of com.emc.storageos.model.host.vcenter.VcenterRestRep in project coprhd-controller by CoprHD.
the class VcenterClusterProvider method getClusterOptions.
@Asset("vcenterCluster")
public List<AssetOption> getClusterOptions(AssetOptionsContext ctx) {
debug("getting clusters");
Collection<ClusterRestRep> clusters = getClusters(ctx);
List<AssetOption> options = Lists.newArrayList();
Map<URI, String> vcenterMap = getVcenters(ctx);
Map<URI, String> dataCenterNameMap = new HashMap<URI, String>();
Map<URI, String> dataCenterVcenterMap = new HashMap<URI, String>();
String vcenterName;
String datacenterName;
for (ClusterRestRep value : clusters) {
if (value.getVcenterDataCenter() != null) {
RelatedResourceRep datacenterVal = value.getVcenterDataCenter();
if (datacenterVal != null) {
if (dataCenterVcenterMap.get(datacenterVal.getId()) == null) {
VcenterDataCenterRestRep restResponse = api(ctx).vcenterDataCenters().get(datacenterVal.getId());
datacenterName = restResponse.getName();
dataCenterNameMap.put(datacenterVal.getId(), datacenterName);
RelatedResourceRep vcenterResp = restResponse.getVcenter();
if (vcenterMap.get(vcenterResp.getId()) == null) {
VcenterRestRep vcenterRep = api(ctx).vcenters().get(vcenterResp);
vcenterMap.put(vcenterResp.getId(), vcenterRep.getName());
vcenterName = vcenterRep.getName();
dataCenterVcenterMap.put(datacenterVal.getId(), vcenterName);
} else {
vcenterName = vcenterMap.get(vcenterResp.getId());
dataCenterVcenterMap.put(datacenterVal.getId(), vcenterName);
}
} else {
datacenterName = dataCenterNameMap.get(datacenterVal.getId());
vcenterName = dataCenterVcenterMap.get(datacenterVal.getId());
}
options.add(createClusterOption(ctx, value, true, vcenterName, datacenterName));
}
}
}
AssetOptionsUtils.sortOptionsByLabel(options);
return options;
}
use of com.emc.storageos.model.host.vcenter.VcenterRestRep in project coprhd-controller by CoprHD.
the class VMWareProvider method listVcentersForCluster.
protected List<VcenterRestRep> listVcentersForCluster(AssetOptionsContext context, URI clusterId) {
ClusterRestRep clusterRestRep = api(context).clusters().get(clusterId);
RelatedResourceRep vcenterDatacenter = clusterRestRep.getVcenterDataCenter();
if (vcenterDatacenter == null) {
// return all vcenters
return api(context).vcenters().getByTenant(context.getTenant(), REGISTERED.and(INCOMPATIBLE.not()));
} else {
// return the vcenter this vipr cluster is already associated with in vcenter
RelatedResourceRep vcenterRelatedRestRep = api(context).vcenterDataCenters().get(vcenterDatacenter.getId()).getVcenter();
VcenterRestRep vcenterRestRep = api(context).vcenters().get(vcenterRelatedRestRep.getId());
return Arrays.asList(vcenterRestRep);
}
}
Aggregations