Search in sources :

Example 11 with ProcessingResourceSpecification

use of org.palladiosimulator.pcm.resourceenvironment.ProcessingResourceSpecification in project iobserve-analysis by research-iobserve.

the class ModelHelper method createResourceContainerFromVMType.

/**
 * Creates a new resource container from a specific {@link VMType}, including an entry in the
 * cost repository.
 *
 * @param environment
 *            the resource environment in which to create the container
 * @param costRepository
 *            the cost repository in which to create the costs for the container
 * @param cloudVM
 *            the type of vm this container is an instance of
 * @param containerName
 *            the name of this container
 * @return the newly created resource container
 * @throws ModelHandlingErrorException
 *             model handling error
 */
public static ResourceContainerCloud createResourceContainerFromVMType(final ResourceEnvironment environment, final CostRepository costRepository, final VMType cloudVM, final String containerName) throws ModelHandlingErrorException {
    final ResourceContainerCloud container = ResourceEnvironmentCloudFactory.createResourceContainer(environment, containerName);
    container.setId(EcoreUtil.generateUUID());
    container.setResourceEnvironment_ResourceContainer(environment);
    container.setInstanceType(cloudVM);
    // Connect container to internet
    final LinkingResource linkingResource = ModelHelper.getInternetLinkingResource(environment);
    linkingResource.getConnectedResourceContainers_LinkingResource().add(container);
    final int nrOfCores = ModelHelper.getNrOfCores(cloudVM);
    final float processingRate = ModelHelper.getProcessingRate(cloudVM);
    // Create processing resource and costs
    final ProcessingResourceSpecification processor = ResourceEnvironmentCloudFactory.createProcessingResource(nrOfCores, processingRate, container);
    container.getActiveResourceSpecifications_ResourceContainer().add(processor);
    // TODO HDD is not used by peropteryx?
    CostModelFactory.createFixedProcessingResourceCost(costRepository, 0.0, cloudVM.getPricePerHour(), processor);
    return container;
}
Also used : ResourceContainerCloud(org.palladiosimulator.pcm.cloud.pcmcloud.resourceenvironmentcloud.ResourceContainerCloud) LinkingResource(org.palladiosimulator.pcm.resourceenvironment.LinkingResource) ProcessingResourceSpecification(org.palladiosimulator.pcm.resourceenvironment.ProcessingResourceSpecification)

Aggregations

ProcessingResourceSpecification (org.palladiosimulator.pcm.resourceenvironment.ProcessingResourceSpecification)11 LinkingResource (org.palladiosimulator.pcm.resourceenvironment.LinkingResource)6 ResourceContainer (org.palladiosimulator.pcm.resourceenvironment.ResourceContainer)5 ResourceEnvironment (org.palladiosimulator.pcm.resourceenvironment.ResourceEnvironment)4 ProcessingResourceType (org.palladiosimulator.pcm.resourcetype.ProcessingResourceType)4 ResourceContainerCloud (org.palladiosimulator.pcm.cloud.pcmcloud.resourceenvironmentcloud.ResourceContainerCloud)3 Test (org.junit.Test)2 UnknownObjectException (java.rmi.activation.UnknownObjectException)1 EObject (org.eclipse.emf.ecore.EObject)1 ContainerAllocationEvent (org.iobserve.common.record.ContainerAllocationEvent)1 PCMRandomVariable (org.palladiosimulator.pcm.core.PCMRandomVariable)1 CommunicationLinkResourceSpecification (org.palladiosimulator.pcm.resourceenvironment.CommunicationLinkResourceSpecification)1 CommunicationLinkResourceType (org.palladiosimulator.pcm.resourcetype.CommunicationLinkResourceType)1 SchedulingPolicy (org.palladiosimulator.pcm.resourcetype.SchedulingPolicy)1