Search in sources :

Example 11 with ResourceContainerCloud

use of org.palladiosimulator.pcm.cloud.pcmcloud.resourceenvironmentcloud.ResourceContainerCloud in project iobserve-analysis by research-iobserve.

the class ReplicateActionScript method getDescription.

@Override
public String getDescription() {
    final ResourceContainerCloud sourceContainer = this.getResourceContainerCloud(this.action.getSourceResourceContainer());
    final ResourceContainerCloud targetContainer = this.getResourceContainerCloud(this.action.getNewResourceContainer());
    final StringBuilder builder = new StringBuilder();
    builder.append("Replicate Action: Replicate container from provider '");
    builder.append(sourceContainer.getInstanceType().getProvider().getName());
    builder.append("' of type '");
    builder.append(sourceContainer.getInstanceType());
    builder.append("' in location '");
    builder.append(sourceContainer.getInstanceType().getLocation());
    builder.append("' with name '");
    builder.append(ModelHelper.getGroupName(sourceContainer));
    builder.append(" to container from provider '");
    builder.append(targetContainer.getInstanceType().getProvider().getName());
    builder.append("' of type '");
    builder.append(targetContainer.getInstanceType());
    builder.append("' in location '");
    builder.append(targetContainer.getInstanceType().getLocation());
    builder.append("' with name '");
    builder.append(ModelHelper.getGroupName(targetContainer));
    return builder.toString();
}
Also used : ResourceContainerCloud(org.palladiosimulator.pcm.cloud.pcmcloud.resourceenvironmentcloud.ResourceContainerCloud)

Example 12 with ResourceContainerCloud

use of org.palladiosimulator.pcm.cloud.pcmcloud.resourceenvironmentcloud.ResourceContainerCloud in project iobserve-analysis by research-iobserve.

the class TerminateActionScript method getDescription.

@Override
public String getDescription() {
    final ResourceContainerCloud container = this.getResourceContainerCloud(this.action.getSourceResourceContainer());
    final StringBuilder builder = new StringBuilder();
    builder.append("Terminate Action: Terminate container group from provider '");
    builder.append(container.getInstanceType().getProvider().getName());
    builder.append("' of type '");
    builder.append(container.getInstanceType());
    builder.append("' in location '");
    builder.append(container.getInstanceType().getLocation());
    builder.append("' with name '");
    builder.append(ModelHelper.getGroupName(container));
    return builder.toString();
}
Also used : ResourceContainerCloud(org.palladiosimulator.pcm.cloud.pcmcloud.resourceenvironmentcloud.ResourceContainerCloud)

Example 13 with ResourceContainerCloud

use of org.palladiosimulator.pcm.cloud.pcmcloud.resourceenvironmentcloud.ResourceContainerCloud in project iobserve-analysis by research-iobserve.

the class ModelHelper method getResourceContainerFromHostname.

/**
 * Creates a cloud container from the given hostname with the information provided by the model
 * providers in the resource environment provided by the model providers.
 *
 * If the hostname is not a valid cloud container hostname or if no matching VMType could be
 * found, the method returns null.
 *
 * @param modelProviders
 *            the model providers to use
 * @param hostname
 *            the hostname to convert
 * @return the new cloud container or null in case of a problem
 * @throws ModelHandlingErrorException
 *             modeling handlign issue
 */
public static ResourceContainerCloud getResourceContainerFromHostname(final PCMModelHandler modelProviders, final String hostname) throws ModelHandlingErrorException {
    final String[] nameParts = hostname.split("_");
    VMType vmType = null;
    // ContainerId_AllocationGroupName_ProviderName_Location_InstanceType
    if (nameParts.length == 5) {
        final String groupName = nameParts[1];
        final String providerName = nameParts[2];
        final String location = nameParts[3];
        final String instanceType = nameParts[4];
        vmType = ModelHelper.getVMType(modelProviders.getCloudProfileModel(), providerName, location, instanceType);
        if (vmType != null) {
            final ResourceEnvironment environment = modelProviders.getResourceEnvironmentModel();
            final CostRepository costRepository = modelProviders.getCostModel();
            final ResourceContainerCloud cloudContainer = ModelHelper.createResourceContainerFromVMType(environment, costRepository, vmType, hostname);
            cloudContainer.setGroupName(groupName);
            return cloudContainer;
        }
    }
    return null;
}
Also used : ResourceEnvironment(org.palladiosimulator.pcm.resourceenvironment.ResourceEnvironment) VMType(org.palladiosimulator.pcm.cloud.pcmcloud.cloudprofile.VMType) ResourceContainerCloud(org.palladiosimulator.pcm.cloud.pcmcloud.resourceenvironmentcloud.ResourceContainerCloud) CostRepository(de.uka.ipd.sdq.pcm.cost.CostRepository)

Example 14 with ResourceContainerCloud

use of org.palladiosimulator.pcm.cloud.pcmcloud.resourceenvironmentcloud.ResourceContainerCloud in project iobserve-analysis by research-iobserve.

the class ModelHelper method getResourceContainerIdentifier.

/**
 * Returns the identifier for a resource container.
 *
 * If the resource container is a cloud container, the returned identifier contains the
 * provider, location and the type of this container. For other containers, the entity name is
 * returned.
 *
 * @param allocationContainer
 *            the container for which to retrieve the identifier
 * @return the identifier
 */
public static String getResourceContainerIdentifier(final ResourceContainer allocationContainer) {
    String identifier = "";
    if (allocationContainer instanceof ResourceContainerCloud) {
        final ResourceContainerCloud cloudContainer = (ResourceContainerCloud) allocationContainer;
        final VMType type = cloudContainer.getInstanceType();
        identifier = String.format("%s_%s_%s", type.getProvider().getName(), type.getLocation(), type.getName());
    } else {
        identifier = allocationContainer.getEntityName();
    }
    return identifier;
}
Also used : ResourceContainerCloud(org.palladiosimulator.pcm.cloud.pcmcloud.resourceenvironmentcloud.ResourceContainerCloud) VMType(org.palladiosimulator.pcm.cloud.pcmcloud.cloudprofile.VMType)

Example 15 with ResourceContainerCloud

use of org.palladiosimulator.pcm.cloud.pcmcloud.resourceenvironmentcloud.ResourceContainerCloud 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
 *             when something when wrong with the model handling
 */
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

ResourceContainerCloud (org.palladiosimulator.pcm.cloud.pcmcloud.resourceenvironmentcloud.ResourceContainerCloud)21 VMType (org.palladiosimulator.pcm.cloud.pcmcloud.cloudprofile.VMType)6 ResourceContainer (org.palladiosimulator.pcm.resourceenvironment.ResourceContainer)6 ComputeService (org.jclouds.compute.ComputeService)5 ResourceEnvironment (org.palladiosimulator.pcm.resourceenvironment.ResourceEnvironment)4 CostRepository (de.uka.ipd.sdq.pcm.cost.CostRepository)3 LinkingResource (org.palladiosimulator.pcm.resourceenvironment.LinkingResource)3 ProcessingResourceSpecification (org.palladiosimulator.pcm.resourceenvironment.ProcessingResourceSpecification)2 NodeMetadata (org.jclouds.compute.domain.NodeMetadata)1 Template (org.jclouds.compute.domain.Template)1 TemplateBuilder (org.jclouds.compute.domain.TemplateBuilder)1 TemplateOptions (org.jclouds.compute.options.TemplateOptions)1 Statement (org.jclouds.scriptbuilder.domain.Statement)1 CloudProfile (org.palladiosimulator.pcm.cloud.pcmcloud.cloudprofile.CloudProfile)1 CloudProvider (org.palladiosimulator.pcm.cloud.pcmcloud.cloudprofile.CloudProvider)1 CloudResourceType (org.palladiosimulator.pcm.cloud.pcmcloud.cloudprofile.CloudResourceType)1