use of com.emc.storageos.model.RelatedResourceRep in project coprhd-controller by CoprHD.
the class ComputeVirtualPools method getByVirtualArray.
/**
* Gets the compute virtual pools that are associated with the given virtual array and specific tenant.
*
* @param varrayId
* the ID of the virtual array.
* @param tenantId
* the ID of the tenant.
* @param filter
* the resource filter to apply to the results as they are returned (optional).
*
* @return the list of compute virtual pools.
*/
public List<ComputeVirtualPoolRestRep> getByVirtualArray(URI varrayId, URI tenantId, ResourceFilter<ComputeVirtualPoolRestRep> filter) {
List<ComputeVirtualPoolRestRep> allPools = null;
if (tenantId == null) {
allPools = getAll(filter);
} else {
allPools = getByTenant(tenantId, filter);
}
// filter by varray
List<ComputeVirtualPoolRestRep> poolsByArray = new ArrayList();
for (ComputeVirtualPoolRestRep poolRep : allPools) {
for (RelatedResourceRep resourceRep : poolRep.getVirtualArrays()) {
if (resourceRep.getId().toString().equals(varrayId.toString())) {
poolsByArray.add(poolRep);
}
}
}
return poolsByArray;
}
use of com.emc.storageos.model.RelatedResourceRep in project coprhd-controller by CoprHD.
the class HostService method findComputeElementsUsedInCluster.
private Map<URI, List<ComputeElement>> findComputeElementsUsedInCluster(URI clusterId) throws DatabaseException {
Map<URI, List<ComputeElement>> computeSystemToComputeElementMap = new HashMap<URI, List<ComputeElement>>();
HostList hostList = clusterService.getClusterHosts(clusterId);
List<NamedRelatedResourceRep> list = hostList.getHosts();
for (NamedRelatedResourceRep hostRep : list) {
HostRestRep host = getHost(hostRep.getId());
RelatedResourceRep computeElement = host.getComputeElement();
if (computeElement == null) {
// this can happen if cluster has hosts that were not provisioned by vipr
continue;
}
ComputeElement ce = _dbClient.queryObject(ComputeElement.class, computeElement.getId());
URI computeSystem = ce.getComputeSystem();
List<ComputeElement> usedComputeElements;
if (computeSystemToComputeElementMap.containsKey(computeSystem)) {
usedComputeElements = computeSystemToComputeElementMap.get(computeSystem);
} else {
usedComputeElements = new ArrayList<ComputeElement>();
}
usedComputeElements.add(ce);
computeSystemToComputeElementMap.put(computeSystem, usedComputeElements);
}
return computeSystemToComputeElementMap;
}
use of com.emc.storageos.model.RelatedResourceRep in project coprhd-controller by CoprHD.
the class ApiTest method updateAllVnxAndVmaxPorts.
/**
* Update the discovered VNX/VMAX storage ports to set the transport zone.
*
* @param provider : Provider.
*/
private void updateAllVnxAndVmaxPorts(SMISProviderRestRep provider) {
StorageSystemList systemList = rZAdmin.path("/vdc/storage-systems").get(StorageSystemList.class);
for (RelatedResourceRep resRep : systemList.getStorageSystems()) {
StorageSystemRestRep system = rZAdmin.path(String.format("/vdc/storage-systems/%s", resRep.getId()).toString()).get(StorageSystemRestRep.class);
if (system.getSystemType().equals(Type.vnxblock.toString()) || system.getSystemType().equals(Type.vmax.toString())) {
// Register all the discovered storage ports .
StoragePortList vnxBlockPortList = rZAdmin.path(String.format("/vdc/storage-systems/%s/storage-ports", system.getId()).toString()).get(StoragePortList.class);
List<NamedRelatedResourceRep> vnxBlockPortURIList = vnxBlockPortList.getPorts();
for (RelatedResourceRep portURI : vnxBlockPortURIList) {
updateStoragePortTZ(resRep.getId(), portURI);
}
}
}
}
use of com.emc.storageos.model.RelatedResourceRep in project coprhd-controller by CoprHD.
the class HostMapper method map.
public static HostRestRep map(Host from) {
if (from == null) {
return null;
}
HostRestRep to = new HostRestRep();
mapDiscoveredSystemObjectFields(from, to);
to.setHostName(from.getHostName());
to.setType(from.getType());
to.setUsername(from.getUsername());
to.setPortNumber(from.getPortNumber());
to.setOsVersion(from.getOsVersion());
to.setUseSsl(from.getUseSSL());
to.setCluster(toRelatedResource(ResourceTypeEnum.CLUSTER, from.getCluster()));
to.setProject(toRelatedResource(ResourceTypeEnum.PROJECT, from.getProject()));
to.setComputeElement(toRelatedResource(ResourceTypeEnum.COMPUTE_ELEMENT, from.getComputeElement()));
to.setvCenterDataCenter(toRelatedResource(ResourceTypeEnum.VCENTERDATACENTER, from.getVcenterDataCenter()));
if ((from.getVolumeGroupIds() != null) && (!from.getVolumeGroupIds().isEmpty())) {
List<RelatedResourceRep> volumeGroups = new ArrayList<RelatedResourceRep>();
for (String volumeGroup : from.getVolumeGroupIds()) {
volumeGroups.add(toRelatedResource(ResourceTypeEnum.VOLUME_GROUP, URI.create(volumeGroup)));
}
to.setVolumeGroups(volumeGroups);
}
StringMap pools = from.getPreferredPools();
if (pools != null && !pools.isEmpty()) {
for (Map.Entry<String, String> entry : pools.entrySet()) {
RelatedResourceRep poolRep = toRelatedResource(ResourceTypeEnum.STORAGE_POOL, URI.create(entry.getKey()));
PreferredPoolParam pool = new PreferredPoolParam(poolRep, entry.getValue());
to.getPreferredPools().add(pool);
}
}
to.setTenant(toRelatedResource(ResourceTypeEnum.TENANT, from.getTenant()));
to.setDiscoverable(from.getDiscoverable());
to.setBootVolume(toRelatedResource(ResourceTypeEnum.VOLUME, from.getBootVolumeId()));
if (from.getDiscoverable() != null && from.getDiscoverable() == false) {
to.setProvisioningJobStatus(from.getProvisioningStatus());
}
return to;
}
use of com.emc.storageos.model.RelatedResourceRep in project coprhd-controller by CoprHD.
the class HostMapper method map.
public static ClusterRestRep map(Cluster from) {
if (from == null) {
return null;
}
ClusterRestRep to = new ClusterRestRep();
mapTenantResource(from, to);
to.setProject(toRelatedResource(ResourceTypeEnum.PROJECT, from.getProject()));
to.setVcenterDataCenter(toRelatedResource(ResourceTypeEnum.VCENTERDATACENTER, from.getVcenterDataCenter()));
to.setAutoExportEnabled(from.getAutoExportEnabled());
if ((from.getVolumeGroupIds() != null) && (!from.getVolumeGroupIds().isEmpty())) {
List<RelatedResourceRep> volumeGroups = new ArrayList<RelatedResourceRep>();
for (String volumeGroup : from.getVolumeGroupIds()) {
volumeGroups.add(toRelatedResource(ResourceTypeEnum.VOLUME_GROUP, URI.create(volumeGroup)));
}
to.setVolumeGroups(volumeGroups);
}
return to;
}
Aggregations