Search in sources :

Example 16 with ComputeVirtualPoolRestRep

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;
}
Also used : UCSServiceProfileTemplate(com.emc.storageos.db.client.model.UCSServiceProfileTemplate) ComputeVirtualPoolRestRep(com.emc.storageos.model.vpool.ComputeVirtualPoolRestRep) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) URI(java.net.URI)

Aggregations

ComputeVirtualPoolRestRep (com.emc.storageos.model.vpool.ComputeVirtualPoolRestRep)16 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)5 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)3 Asset (com.emc.sa.asset.annotation.Asset)2 ComputeSystemRestRep (com.emc.storageos.model.compute.ComputeSystemRestRep)2 ServiceErrorException (com.emc.vipr.client.exceptions.ServiceErrorException)2 ViPRException (com.emc.vipr.client.exceptions.ViPRException)2 AssetOption (com.emc.vipr.model.catalog.AssetOption)2 Common.flashException (controllers.Common.flashException)2 URI (java.net.URI)2 HashSet (java.util.HashSet)2 ComputeVirtualPoolElementDataTable (models.datatable.ComputeVirtualPoolElementDataTable)2 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)1 UCSServiceProfileTemplate (com.emc.storageos.db.client.model.UCSServiceProfileTemplate)1 ComputeElementRestRep (com.emc.storageos.model.compute.ComputeElementRestRep)1 VirtualArrayCreateParam (com.emc.storageos.model.varray.VirtualArrayCreateParam)1 VirtualArrayRestRep (com.emc.storageos.model.varray.VirtualArrayRestRep)1 ComputeVirtualPoolCreateParam (com.emc.storageos.model.vpool.ComputeVirtualPoolCreateParam)1 ComputeVirtualPoolList (com.emc.storageos.model.vpool.ComputeVirtualPoolList)1 ComputeVirtualPoolUpdateParam (com.emc.storageos.model.vpool.ComputeVirtualPoolUpdateParam)1