use of com.emc.storageos.model.vpool.ComputeVirtualPoolRestRep in project coprhd-controller by CoprHD.
the class ComputeVirtualPoolMapper method toComputeVirtualPool.
public static ComputeVirtualPoolRestRep toComputeVirtualPool(DbClient dbClient, ComputeVirtualPool from, boolean inUse) {
if (from == null) {
return null;
}
ComputeVirtualPoolRestRep to = new ComputeVirtualPoolRestRep();
to.setDescription(from.getDescription());
to.setSystemType(from.getSystemType());
to.setMinProcessors(translateDbValueToClientValue(from.getMinProcessors()));
to.setMaxProcessors(translateDbValueToClientValue(from.getMaxProcessors()));
to.setMinTotalCores(translateDbValueToClientValue(from.getMinTotalCores()));
to.setMaxTotalCores(translateDbValueToClientValue(from.getMaxTotalCores()));
to.setMinTotalThreads(translateDbValueToClientValue(from.getMinTotalThreads()));
to.setMaxTotalThreads(translateDbValueToClientValue(from.getMaxTotalThreads()));
to.setMinCpuSpeed(translateDbValueToClientValue(from.getMinCpuSpeed()));
to.setMaxCpuSpeed(translateDbValueToClientValue(from.getMaxCpuSpeed()));
to.setMinMemory(translateDbValueToClientValue(from.getMinMemory()));
to.setMaxMemory(translateDbValueToClientValue(from.getMaxMemory()));
to.setMinNics(translateDbValueToClientValue(from.getMinNics()));
to.setMaxNics(translateDbValueToClientValue(from.getMaxNics()));
to.setMinHbas(translateDbValueToClientValue(from.getMinHbas()));
to.setMaxHbas(translateDbValueToClientValue(from.getMaxHbas()));
if (from.getVirtualArrays() != null) {
for (String varray : from.getVirtualArrays()) {
to.getVirtualArrays().add(toRelatedResource(ResourceTypeEnum.VARRAY, URI.create(varray)));
}
}
to.setUseMatchedElements(from.getUseMatchedElements());
to.setInUse(inUse);
if (from.getMatchedComputeElements() != null) {
for (String ce : from.getMatchedComputeElements()) {
to.getMatchedComputeElements().add(toRelatedResource(ResourceTypeEnum.COMPUTE_ELEMENT, URI.create(ce)));
}
}
if (dbClient != null) {
if (from.getServiceProfileTemplates() != null) {
for (String spt : from.getServiceProfileTemplates()) {
URI sptURI = URI.create(spt);
UCSServiceProfileTemplate template = dbClient.queryObject(UCSServiceProfileTemplate.class, sptURI);
NamedRelatedResourceRep sptNamedRelatedResource = new NamedRelatedResourceRep();
sptNamedRelatedResource.setId(template.getId());
sptNamedRelatedResource.setName(template.getLabel());
to.getServiceProfileTemplates().add(sptNamedRelatedResource);
}
}
if (from.getMatchedComputeElements() != null) {
to.getAvailableMatchedComputeElements().addAll(getAvailableComputeElements(dbClient, from.getMatchedComputeElements()));
}
}
mapDataObjectFields(from, to);
return to;
}
Aggregations