From 6eeffa50a92e976fb35966bc1e3ebec2aacc68ab Mon Sep 17 00:00:00 2001 From: Manoel Campos Date: Sun, 25 Oct 2026 14:39:14 -0300 Subject: [PATCH] Update to the placement, allocation and provisioning API changes Updates the project to cloudsimplus/cloudsimplus#606 (#588) and cloudsimplus/cloudsimplus#608. Co-Authored-By: Claude Opus 5.5 --- CLAUDE.md | 4 +-- .../examples/network/NetworkExample4.java | 6 ++-- .../NetworkVmExampleAbstract.java | 6 ++-- .../NetworkVmsExampleSimpleApp.java | 6 ++-- .../examples/BasicFirstExample.java | 4 +-- .../examples/CloudletCancellationExample.java | 10 +++--- ...loudletsTableBuilderFormattingExample.java | 4 +-- .../examples/HostFaultInjectionExample1.java | 10 +++--- .../examples/LargeScaleExample.java | 6 ++-- .../cloudsimplus/examples/LoggingExample.java | 16 ++++----- .../examples/MinTimeBetweenEventsExample.java | 6 ++-- .../examples/ParallelSimulationsExample.java | 4 +-- ...va => RandomVmPlacementPolicyExample.java} | 34 +++++++++---------- .../cloudsimplus/examples/ReducedExample.java | 4 +-- .../examples/StorageAreaNetworkExample1.java | 4 +-- .../VmBootTimeAndOverheadExample.java | 6 ++-- .../examples/VmDestructionExample.java | 10 +++--- .../examples/VmGroupPlacementExample1.java | 4 +-- ...> VmPlacementPolicyRoundRobinExample.java} | 14 ++++---- ...dBalancerByHorizontalVmScalingExample.java | 6 ++-- .../VerticalVmCpuScalingDynamicThreshold.java | 8 ++--- .../VerticalVmCpuScalingExample.java | 4 +-- .../VerticalVmRamScalingExample.java | 8 ++--- .../BrokerTargetDatacenterExample.java | 4 +-- ...erBrokerBatchVmCreationRequestExample.java | 12 +++---- .../DatacenterBrokerHeuristicExample.java | 6 ++-- .../DatacenterBrokersMappingComparison.java | 10 +++--- .../DatacenterSelectionByTimeZoneExample.java | 4 +-- .../examples/brokers/MultipleBrokers1.java | 10 +++--- .../examples/brokers/MultipleBrokers2.java | 10 +++--- .../examples/brokers/MultipleBrokers3.java | 6 ++-- .../brokers/SelectNextDatacenterExample.java | 4 +-- .../examples/costs/CostsExample1.java | 4 +-- .../CreateCloudletAfterLastFinishedOne.java | 6 ++-- .../examples/dynamic/DynamicHostCreation.java | 4 +-- ...namicVmPlacementPolicyBestFitExample.java} | 26 +++++++------- .../dynamic/KeepSimulationRunningExample.java | 6 ++-- .../listeners/VmListenersExample1.java | 8 ++--- .../listeners/VmListenersExample2.java | 16 ++++----- ...VmListenersExample3_DynamicVmCreation.java | 8 ++--- .../migration/InterDatacenterMigration1.java | 22 ++++++------ .../migration/ManualMigrationExample1.java | 24 ++++++------- .../examples/migration/MigrationExample1.java | 23 +++++++------ .../examples/migration/package-info.java | 2 +- .../performance/PerformanceExample1.java | 10 +++--- .../UtilizationModelFullPerformance.java | 8 ++--- ...UtilizationModelStochasticPerformance.java | 8 ++--- .../examples/power/HostActivationExample.java | 10 +++--- .../resourceusage/HostsCpuUsageExample.java | 4 ++- ...equestedRamHigherThanAvailableExample.java | 4 +-- ...elativeHostResourceUtilizationExample.java | 6 ++-- .../resourceusage/VmsCpuUsageExample.java | 6 ++-- .../VmsRamAndBwUsageExample.java | 2 +- .../CloudletSchedulerSpaceSharedExample1.java | 8 ++--- ...TwoCloudletsAndOneTimeSharedVmExample.java | 6 ++-- .../VmSchedulerTimeSharedExample.java | 10 +++--- ...nateSimulationAtGivenConditionExample.java | 6 ++-- ...grationWhenCpuMetricIsViolatedExample.java | 10 +++--- .../SynchronousSimulationExample1.java | 4 +-- .../examples/traces/PlanetLabExample1.java | 6 ++-- .../traces/SwfWorkloadFormatExample1.java | 4 +-- .../google/GoogleMachineEventsExample1.java | 4 +-- .../google/GoogleTaskEventsExample1.java | 4 +-- 63 files changed, 262 insertions(+), 257 deletions(-) rename src/main/java/org/cloudsimplus/examples/{RandomVmAllocationPolicyExample.java => RandomVmPlacementPolicyExample.java} (88%) rename src/main/java/org/cloudsimplus/examples/{VmAllocationPolicyRoundRobinExample.java => VmPlacementPolicyRoundRobinExample.java} (94%) rename src/main/java/org/cloudsimplus/examples/dynamic/{DynamicVmAllocationPolicyBestFitExample.java => DynamicVmPlacementPolicyBestFitExample.java} (90%) diff --git a/CLAUDE.md b/CLAUDE.md index c2ae784..8924f7b 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -41,10 +41,10 @@ Common structure of an example (see `BasicFirstExample`): 1. `private static final` constants for host, VM and cloudlet sizes (MIPS, PEs, RAM in MB, BW in Mbps, storage in MB, length in MI). 2. Constructor: `new CloudSimPlus()`, then `createDatacenter()` (`DatacenterSimple` with `HostSimple`s built from `PeSimple`s), then `new DatacenterBrokerSimple(simulation)`. 3. `createVms()` (`VmSimple`) and `createCloudlets()` (`CloudletSimple` + a `UtilizationModel*`), then `broker.submitVmList(...)` and `broker.submitCloudletList(...)`. -4. Optionally register event listeners (e.g. `simulation.addOnClockTickListener`, `vm.addOnHostAllocationListener`) for dynamic behaviour. +4. Optionally register event listeners (e.g. `simulation.addOnClockTickListener`, `vm.addOnHostPlacementListener`) for dynamic behaviour. 5. `simulation.start()`, then print results with `new CloudletsTableBuilder(broker.getCloudletFinishedList()).build()`. -Default policies (VM allocation, VM/cloudlet schedulers, provisioners) apply unless an example sets them on purpose. Usually that choice is the point of the example. +Default policies (VM placement, VM/cloudlet schedulers, allocators) apply unless an example sets them on purpose. Usually that choice is the point of the example. ## Resources diff --git a/src/main/java/org/cloudbus/cloudsim/examples/network/NetworkExample4.java b/src/main/java/org/cloudbus/cloudsim/examples/network/NetworkExample4.java index 250223a..e4ec75e 100755 --- a/src/main/java/org/cloudbus/cloudsim/examples/network/NetworkExample4.java +++ b/src/main/java/org/cloudbus/cloudsim/examples/network/NetworkExample4.java @@ -20,7 +20,7 @@ import org.cloudsimplus.hosts.Host; import org.cloudsimplus.hosts.HostSimple; import org.cloudsimplus.network.topologies.BriteNetworkTopology; -import org.cloudsimplus.provisioners.ResourceProvisionerSimple; +import org.cloudsimplus.allocators.ResourceAllocatorSimple; import org.cloudsimplus.resources.CoreCapacity; import org.cloudsimplus.schedulers.vm.VmSchedulerTimeShared; import org.cloudsimplus.utilizationmodels.UtilizationModelFull; @@ -130,8 +130,8 @@ private Datacenter createDatacenter() { long bw = 10000; //Megabits/s final Host host = new HostSimple(ram, bw, storage, cpuCapacity) - .setRamProvisioner(new ResourceProvisionerSimple()) - .setBwProvisioner(new ResourceProvisionerSimple()) + .setRamAllocator(new ResourceAllocatorSimple()) + .setBwAllocator(new ResourceAllocatorSimple()) .setVmScheduler(new VmSchedulerTimeShared()); hostList.add(host); diff --git a/src/main/java/org/cloudbus/cloudsim/examples/network/applications/NetworkVmExampleAbstract.java b/src/main/java/org/cloudbus/cloudsim/examples/network/applications/NetworkVmExampleAbstract.java index 5ded9b0..06907ba 100755 --- a/src/main/java/org/cloudbus/cloudsim/examples/network/applications/NetworkVmExampleAbstract.java +++ b/src/main/java/org/cloudbus/cloudsim/examples/network/applications/NetworkVmExampleAbstract.java @@ -13,7 +13,7 @@ import org.cloudsimplus.network.switches.AggregateSwitch; import org.cloudsimplus.network.switches.EdgeSwitch; import org.cloudsimplus.network.switches.RootSwitch; -import org.cloudsimplus.provisioners.ResourceProvisionerSimple; +import org.cloudsimplus.allocators.ResourceAllocatorSimple; import org.cloudsimplus.resources.CoreCapacity; import org.cloudsimplus.schedulers.cloudlet.CloudletSchedulerTimeShared; import org.cloudsimplus.schedulers.vm.VmSchedulerTimeShared; @@ -171,8 +171,8 @@ protected final NetworkDatacenter createDatacenter() { final CoreCapacity cpuCapacity = HOST_CAPACITY; final var host = new NetworkHost(HOST_RAM, HOST_BW, HOST_STORAGE, cpuCapacity); host - .setRamProvisioner(new ResourceProvisionerSimple()) - .setBwProvisioner(new ResourceProvisionerSimple()) + .setRamAllocator(new ResourceAllocatorSimple()) + .setBwAllocator(new ResourceAllocatorSimple()) .setVmScheduler(new VmSchedulerTimeShared()); netHostList.add(host); } diff --git a/src/main/java/org/cloudbus/cloudsim/examples/network/applications/NetworkVmsExampleSimpleApp.java b/src/main/java/org/cloudbus/cloudsim/examples/network/applications/NetworkVmsExampleSimpleApp.java index 5c08d51..4832a9f 100755 --- a/src/main/java/org/cloudbus/cloudsim/examples/network/applications/NetworkVmsExampleSimpleApp.java +++ b/src/main/java/org/cloudbus/cloudsim/examples/network/applications/NetworkVmsExampleSimpleApp.java @@ -11,7 +11,7 @@ import org.cloudsimplus.datacenters.network.NetworkDatacenter; import org.cloudsimplus.hosts.network.NetworkHost; import org.cloudsimplus.network.switches.EdgeSwitch; -import org.cloudsimplus.provisioners.ResourceProvisionerSimple; +import org.cloudsimplus.allocators.ResourceAllocatorSimple; import org.cloudsimplus.resources.CoreCapacity; import org.cloudsimplus.schedulers.cloudlet.CloudletSchedulerTimeShared; import org.cloudsimplus.schedulers.vm.VmSchedulerTimeShared; @@ -116,8 +116,8 @@ private NetworkDatacenter createDatacenter() { private NetworkHost createHost() { final var host = new NetworkHost(HOST_RAM, HOST_BW, HOST_STORAGE, HOST_CAPACITY); host - .setRamProvisioner(new ResourceProvisionerSimple()) - .setBwProvisioner(new ResourceProvisionerSimple()) + .setRamAllocator(new ResourceAllocatorSimple()) + .setBwAllocator(new ResourceAllocatorSimple()) .setVmScheduler(new VmSchedulerTimeShared()); return host; diff --git a/src/main/java/org/cloudsimplus/examples/BasicFirstExample.java b/src/main/java/org/cloudsimplus/examples/BasicFirstExample.java index 0db0235..cb18ccf 100755 --- a/src/main/java/org/cloudsimplus/examples/BasicFirstExample.java +++ b/src/main/java/org/cloudsimplus/examples/BasicFirstExample.java @@ -120,13 +120,13 @@ private Datacenter createDatacenter() { hostList.add(host); } - //Uses a VmAllocationPolicySimple by default to allocate VMs + //Uses a VmPlacementPolicySimple by default to place VMs return new DatacenterSimple(simulation, hostList); } private Host createHost() { /* - Uses ResourceProvisionerSimple by default for RAM and BW provisioning + Uses ResourceAllocatorSimple by default for RAM and BW allocation and VmSchedulerSpaceShared for VM scheduling. */ return new HostSimple(HOST_RAM, HOST_BW, HOST_STORAGE, HOST_CAPACITY); diff --git a/src/main/java/org/cloudsimplus/examples/CloudletCancellationExample.java b/src/main/java/org/cloudsimplus/examples/CloudletCancellationExample.java index 3f592ca..638c0b1 100755 --- a/src/main/java/org/cloudsimplus/examples/CloudletCancellationExample.java +++ b/src/main/java/org/cloudsimplus/examples/CloudletCancellationExample.java @@ -34,7 +34,7 @@ import org.cloudsimplus.hosts.Host; import org.cloudsimplus.hosts.HostSimple; import org.cloudsimplus.listeners.CloudletVmEventInfo; -import org.cloudsimplus.provisioners.ResourceProvisionerSimple; +import org.cloudsimplus.allocators.ResourceAllocatorSimple; import org.cloudsimplus.resources.CoreCapacity; import org.cloudsimplus.schedulers.cloudlet.CloudletScheduler; import org.cloudsimplus.schedulers.cloudlet.CloudletSchedulerTimeShared; @@ -157,13 +157,13 @@ private Host createHost() { final long ram = 2048; //in Megabytes final long bw = 10000; //in Megabits/s final long storage = 1000000; //in Megabytes - final var ramProvisioner = new ResourceProvisionerSimple(); - final var bwProvisioner = new ResourceProvisionerSimple(); + final var ramAllocator = new ResourceAllocatorSimple(); + final var bwAllocator = new ResourceAllocatorSimple(); final var vmScheduler = new VmSchedulerTimeShared(); final var host = new HostSimple(ram, bw, storage, HOST_CAPACITY); host - .setRamProvisioner(ramProvisioner) - .setBwProvisioner(bwProvisioner) + .setRamAllocator(ramAllocator) + .setBwAllocator(bwAllocator) .setVmScheduler(vmScheduler); return host; } diff --git a/src/main/java/org/cloudsimplus/examples/CloudletsTableBuilderFormattingExample.java b/src/main/java/org/cloudsimplus/examples/CloudletsTableBuilderFormattingExample.java index 161718b..7458135 100644 --- a/src/main/java/org/cloudsimplus/examples/CloudletsTableBuilderFormattingExample.java +++ b/src/main/java/org/cloudsimplus/examples/CloudletsTableBuilderFormattingExample.java @@ -157,13 +157,13 @@ private Datacenter createDatacenter() { hostList.add(host); } - //Uses a VmAllocationPolicySimple by default to allocate VMs + //Uses a VmPlacementPolicySimple by default to place VMs return new DatacenterSimple(simulation, hostList); } private Host createHost() { /* - Uses ResourceProvisionerSimple by default for RAM and BW provisioning + Uses ResourceAllocatorSimple by default for RAM and BW allocation and VmSchedulerSpaceShared for VM scheduling. */ return new HostSimple(HOST_RAM, HOST_BW, HOST_STORAGE, HOST_CAPACITY); diff --git a/src/main/java/org/cloudsimplus/examples/HostFaultInjectionExample1.java b/src/main/java/org/cloudsimplus/examples/HostFaultInjectionExample1.java index a34d8f9..b6e6618 100755 --- a/src/main/java/org/cloudsimplus/examples/HostFaultInjectionExample1.java +++ b/src/main/java/org/cloudsimplus/examples/HostFaultInjectionExample1.java @@ -36,7 +36,7 @@ import org.cloudsimplus.faultinjection.VmClonerSimple; import org.cloudsimplus.hosts.Host; import org.cloudsimplus.hosts.HostSimple; -import org.cloudsimplus.provisioners.ResourceProvisionerSimple; +import org.cloudsimplus.allocators.ResourceAllocatorSimple; import org.cloudsimplus.resources.CoreCapacity; import org.cloudsimplus.schedulers.cloudlet.CloudletSchedulerTimeShared; import org.cloudsimplus.schedulers.vm.VmSchedulerTimeShared; @@ -234,13 +234,13 @@ private Datacenter createDatacenter() { } public Host createHost(final int id) { - final var ramProvisioner = new ResourceProvisionerSimple(); - final var bwProvisioner = new ResourceProvisionerSimple(); + final var ramAllocator = new ResourceAllocatorSimple(); + final var bwAllocator = new ResourceAllocatorSimple(); final var vmScheduler = new VmSchedulerTimeShared(); final var host = new HostSimple(HOST_RAM, HOST_BW, HOST_STORAGE, HOST_CAPACITY); host - .setRamProvisioner(ramProvisioner) - .setBwProvisioner(bwProvisioner) + .setRamAllocator(ramAllocator) + .setBwAllocator(bwAllocator) .setVmScheduler(vmScheduler) .setId(id); diff --git a/src/main/java/org/cloudsimplus/examples/LargeScaleExample.java b/src/main/java/org/cloudsimplus/examples/LargeScaleExample.java index 90defab..35c8786 100755 --- a/src/main/java/org/cloudsimplus/examples/LargeScaleExample.java +++ b/src/main/java/org/cloudsimplus/examples/LargeScaleExample.java @@ -24,7 +24,7 @@ package org.cloudsimplus.examples; import ch.qos.logback.classic.Level; -import org.cloudsimplus.allocationpolicies.VmAllocationPolicyFirstFit; +import org.cloudsimplus.placementpolicies.VmPlacementPolicyFirstFit; import org.cloudsimplus.brokers.DatacenterBroker; import org.cloudsimplus.brokers.DatacenterBrokerSimple; import org.cloudsimplus.cloudlets.Cloudlet; @@ -165,14 +165,14 @@ private Datacenter createDatacenter() { hostList.add(host); } - var dc = new DatacenterSimple(simulation, hostList, new VmAllocationPolicyFirstFit()); + var dc = new DatacenterSimple(simulation, hostList, new VmPlacementPolicyFirstFit()); dc.setSchedulingInterval(SCHEDULING_INTERVAL); return dc; } private Host createHost() { /* - Uses ResourceProvisionerSimple by default for RAM and BW provisioning + Uses ResourceAllocatorSimple by default for RAM and BW allocation and VmSchedulerSpaceShared for VM scheduling. */ return new HostSimple(HOST_RAM, HOST_BW, HOST_STORAGE, HOST_CAPACITY); diff --git a/src/main/java/org/cloudsimplus/examples/LoggingExample.java b/src/main/java/org/cloudsimplus/examples/LoggingExample.java index a488832..0dfa62f 100755 --- a/src/main/java/org/cloudsimplus/examples/LoggingExample.java +++ b/src/main/java/org/cloudsimplus/examples/LoggingExample.java @@ -24,8 +24,8 @@ package org.cloudsimplus.examples; import ch.qos.logback.classic.Level; -import org.cloudsimplus.allocationpolicies.VmAllocationPolicy; -import org.cloudsimplus.allocationpolicies.migration.VmAllocationPolicyMigrationStaticThreshold; +import org.cloudsimplus.placementpolicies.VmPlacementPolicy; +import org.cloudsimplus.placementpolicies.migration.VmPlacementPolicyMigrationStaticThreshold; import org.cloudsimplus.brokers.DatacenterBroker; import org.cloudsimplus.brokers.DatacenterBrokerSimple; import org.cloudsimplus.builders.tables.CloudletsTableBuilder; @@ -137,7 +137,7 @@ private void configureLogs() { //Enable different log levels for specific classes of objects Log.setLevel(DatacenterBroker.LOGGER, Level.ERROR); Log.setLevel(Datacenter.LOGGER, Level.WARN); - Log.setLevel(VmAllocationPolicy.LOGGER, Level.OFF); + Log.setLevel(VmPlacementPolicy.LOGGER, Level.OFF); Log.setLevel(CloudletScheduler.LOGGER, Level.WARN); } @@ -157,12 +157,12 @@ private Datacenter createDatacenter() { hostList.add(host); } - /*Creates a VmAllocationPolicy that migrates VMs from under/overloaded hosts, + /*Creates a VmPlacementPolicy that migrates VMs from under/overloaded hosts, selecting migrating VMs randomly.*/ - final var vmAllocationPolicy = - new VmAllocationPolicyMigrationStaticThreshold( + final var vmPlacementPolicy = + new VmPlacementPolicyMigrationStaticThreshold( new VmSelectionPolicyRandomSelection(), HOST_OVER_UTILIZATION_MIGRATION_THRESHOLD); - final var dc = new DatacenterSimple(simulation, hostList, vmAllocationPolicy); + final var dc = new DatacenterSimple(simulation, hostList, vmPlacementPolicy); dc.setSchedulingInterval(SCHEDULING_INTERVAL_SECS); if(DISABLE_MIGRATIONS) { dc.disableMigrations(); @@ -175,7 +175,7 @@ private Host createHost(final int pes) { final var cpuCapacity = new CoreCapacity(pes, HOST_MIPS); /* - Uses ResourceProvisionerSimple by default for RAM and BW provisioning + Uses ResourceAllocatorSimple by default for RAM and BW allocation and VmSchedulerSpaceShared for VM scheduling. */ return new HostSimple(HOST_RAM, HOST_BW, HOST_STORAGE, cpuCapacity); diff --git a/src/main/java/org/cloudsimplus/examples/MinTimeBetweenEventsExample.java b/src/main/java/org/cloudsimplus/examples/MinTimeBetweenEventsExample.java index bd8b220..a81940a 100755 --- a/src/main/java/org/cloudsimplus/examples/MinTimeBetweenEventsExample.java +++ b/src/main/java/org/cloudsimplus/examples/MinTimeBetweenEventsExample.java @@ -39,7 +39,7 @@ import org.cloudsimplus.distributions.UniformDistr; import org.cloudsimplus.hosts.Host; import org.cloudsimplus.hosts.HostSimple; -import org.cloudsimplus.provisioners.ResourceProvisionerSimple; +import org.cloudsimplus.allocators.ResourceAllocatorSimple; import org.cloudsimplus.resources.CoreCapacity; import org.cloudsimplus.schedulers.vm.VmSchedulerSpaceShared; import org.cloudsimplus.util.Log; @@ -151,8 +151,8 @@ private Host createHost() { final long bw = 10000; //Megabits/s return new HostSimple(ram, bw, storage, HOST_CAPACITY) - .setRamProvisioner(new ResourceProvisionerSimple()) - .setBwProvisioner(new ResourceProvisionerSimple()) + .setRamAllocator(new ResourceAllocatorSimple()) + .setBwAllocator(new ResourceAllocatorSimple()) .setVmScheduler(new VmSchedulerSpaceShared()); } diff --git a/src/main/java/org/cloudsimplus/examples/ParallelSimulationsExample.java b/src/main/java/org/cloudsimplus/examples/ParallelSimulationsExample.java index 0cd5f3a..4adbed8 100755 --- a/src/main/java/org/cloudsimplus/examples/ParallelSimulationsExample.java +++ b/src/main/java/org/cloudsimplus/examples/ParallelSimulationsExample.java @@ -33,7 +33,7 @@ import org.cloudsimplus.datacenters.DatacenterSimple; import org.cloudsimplus.hosts.Host; import org.cloudsimplus.hosts.HostSimple; -import org.cloudsimplus.provisioners.ResourceProvisionerSimple; +import org.cloudsimplus.allocators.ResourceAllocatorSimple; import org.cloudsimplus.resources.CoreCapacity; import org.cloudsimplus.schedulers.cloudlet.CloudletSchedulerTimeShared; import org.cloudsimplus.schedulers.vm.VmSchedulerTimeShared; @@ -144,7 +144,7 @@ private List createHosts() { return hostList; } - /// Creates a Hosts using a [ResourceProvisionerSimple] + /// Creates a Hosts using a [ResourceAllocatorSimple] /// for RAM and BW. /// @return private Host createHost() { diff --git a/src/main/java/org/cloudsimplus/examples/RandomVmAllocationPolicyExample.java b/src/main/java/org/cloudsimplus/examples/RandomVmPlacementPolicyExample.java similarity index 88% rename from src/main/java/org/cloudsimplus/examples/RandomVmAllocationPolicyExample.java rename to src/main/java/org/cloudsimplus/examples/RandomVmPlacementPolicyExample.java index 33508cf..f5b68ab 100755 --- a/src/main/java/org/cloudsimplus/examples/RandomVmAllocationPolicyExample.java +++ b/src/main/java/org/cloudsimplus/examples/RandomVmPlacementPolicyExample.java @@ -23,8 +23,8 @@ */ package org.cloudsimplus.examples; -import org.cloudsimplus.allocationpolicies.VmAllocationPolicy; -import org.cloudsimplus.allocationpolicies.VmAllocationPolicySimple; +import org.cloudsimplus.placementpolicies.VmPlacementPolicy; +import org.cloudsimplus.placementpolicies.VmPlacementPolicySimple; import org.cloudsimplus.brokers.DatacenterBroker; import org.cloudsimplus.brokers.DatacenterBrokerSimple; import org.cloudsimplus.builders.tables.CloudletsTableBuilder; @@ -37,7 +37,7 @@ import org.cloudsimplus.distributions.UniformDistr; import org.cloudsimplus.hosts.Host; import org.cloudsimplus.hosts.HostSimple; -import org.cloudsimplus.provisioners.ResourceProvisionerSimple; +import org.cloudsimplus.allocators.ResourceAllocatorSimple; import org.cloudsimplus.resources.CoreCapacity; import org.cloudsimplus.schedulers.cloudlet.CloudletSchedulerTimeShared; import org.cloudsimplus.schedulers.vm.VmSchedulerTimeShared; @@ -54,18 +54,18 @@ import java.util.Optional; /// An example showing how to implement a custom -/// [VmAllocationPolicy] that randomly +/// [VmPlacementPolicy] that randomly /// selects suitable Hosts to place submitted VMs. /// Check the [#createDatacenter()] method for details. /// /// Since CloudSim Plus provides functional -/// VmAllocationPolicy implementations, you don't +/// VmPlacementPolicy implementations, you don't /// even need to create a new class to implement your own policy, /// unless you really want to (to make reuse easy). /// /// @author Manoel Campos da Silva Filho /// @since CloudSim Plus 4.0.5 -public class RandomVmAllocationPolicyExample { +public class RandomVmPlacementPolicyExample { private static final int HOSTS = 10; private static final int HOST_CORES = 8; @@ -102,10 +102,10 @@ public class RandomVmAllocationPolicyExample { private final ContinuousDistribution random; public static void main(String[] args) { - new RandomVmAllocationPolicyExample(); + new RandomVmPlacementPolicyExample(); } - private RandomVmAllocationPolicyExample() { + private RandomVmPlacementPolicyExample() { final double startSecs = TimeUtil.currentTimeSecs(); //Enables just some level of log messages. Log.setLevel(ch.qos.logback.classic.Level.WARN); @@ -132,7 +132,7 @@ private RandomVmAllocationPolicyExample() { } /// Creates a Datacenter and its Hosts, defining - /// a [VmAllocationPolicy] that randomly selects suitable Hosts + /// a [VmPlacementPolicy] that randomly selects suitable Hosts /// to place submitted VMs. private Datacenter createDatacenter() { final var hostList = new ArrayList(HOSTS); @@ -141,24 +141,24 @@ private Datacenter createDatacenter() { hostList.add(host); } - final var vmAllocationPolicy = new VmAllocationPolicySimple(); + final var vmPlacementPolicy = new VmPlacementPolicySimple(); //Replaces the default method that allocates Hosts to VMs by our own implementation - vmAllocationPolicy.setFindHostForVmFunction(this::findRandomSuitableHostForVm); + vmPlacementPolicy.setFindHostForVmFunction(this::findRandomSuitableHostForVm); - return new DatacenterSimple(simulation, hostList, vmAllocationPolicy); + return new DatacenterSimple(simulation, hostList, vmPlacementPolicy); } /// Define a specific policy to randomly select a suitable Host to place a given VM. /// It's a very efficient policy since it doesn't perform sorting /// in order to find a suitable Host. /// - /// @param vmAllocationPolicy the [VmAllocationPolicy] containing Host allocation information + /// @param vmPlacementPolicy the [VmPlacementPolicy] containing VM placement information /// @param vm the [Vm] to find a host to be placed /// @return an [Optional] that may contain a Host in which to place a Vm, or an [Optional#empty()] /// [Optional] if not suitable Host was found. - private Optional findRandomSuitableHostForVm(final VmAllocationPolicy vmAllocationPolicy, final Vm vm) { - final var hostList = vmAllocationPolicy.getHostList(); + private Optional findRandomSuitableHostForVm(final VmPlacementPolicy vmPlacementPolicy, final Vm vm) { + final var hostList = vmPlacementPolicy.getHostList(); /* Despite the loop is bound to the number of Hosts inside the List, * the index "i" is not used to get a Host at that position, * but just to define that the maximum number of tries to find a @@ -180,8 +180,8 @@ private Host createHost() { final long storage = 1000000; //in Megabytes final var host = new HostSimple(ram, bw, storage, HOST_CAPACITY); host - .setRamProvisioner(new ResourceProvisionerSimple()) - .setBwProvisioner(new ResourceProvisionerSimple()) + .setRamAllocator(new ResourceAllocatorSimple()) + .setBwAllocator(new ResourceAllocatorSimple()) .setVmScheduler(new VmSchedulerTimeShared()); return host; } diff --git a/src/main/java/org/cloudsimplus/examples/ReducedExample.java b/src/main/java/org/cloudsimplus/examples/ReducedExample.java index 17a41a8..25cfd03 100755 --- a/src/main/java/org/cloudsimplus/examples/ReducedExample.java +++ b/src/main/java/org/cloudsimplus/examples/ReducedExample.java @@ -66,12 +66,12 @@ void main() { final long bw = 100000; //in Megabits/s //Creates one Hosts with a specific list of CPU cores (PEs). - //Uses ResourceProvisionerSimple by default for RAM and BW provisioning + //Uses ResourceAllocatorSimple by default for RAM and BW allocation //Uses VmSchedulerSpaceShared by default for VM scheduling final var host0 = new HostSimple(ram, bw, storage, new CoreCapacity(20000)); //Creates one Datacenter with a list of Hosts - //Uses a VmAllocationPolicySimple by default to allocate VMs + //Uses a VmPlacementPolicySimple by default to place VMs final var dc0 = new DatacenterSimple(simulation, List.of(host0)); //Creates one Vm to run applications (Cloudlets). diff --git a/src/main/java/org/cloudsimplus/examples/StorageAreaNetworkExample1.java b/src/main/java/org/cloudsimplus/examples/StorageAreaNetworkExample1.java index 4ae46e1..c827a0c 100755 --- a/src/main/java/org/cloudsimplus/examples/StorageAreaNetworkExample1.java +++ b/src/main/java/org/cloudsimplus/examples/StorageAreaNetworkExample1.java @@ -23,7 +23,7 @@ */ package org.cloudsimplus.examples; -import org.cloudsimplus.allocationpolicies.VmAllocationPolicySimple; +import org.cloudsimplus.placementpolicies.VmPlacementPolicySimple; import org.cloudsimplus.brokers.DatacenterBroker; import org.cloudsimplus.brokers.DatacenterBrokerSimple; import org.cloudsimplus.builders.tables.CloudletsTableBuilder; @@ -184,7 +184,7 @@ private Datacenter createDatacenter() { hostList.add(host); } - return new DatacenterSimple(simulation, hostList, new VmAllocationPolicySimple(), createSanArray()); + return new DatacenterSimple(simulation, hostList, new VmPlacementPolicySimple(), createSanArray()); } private Host createHost() { diff --git a/src/main/java/org/cloudsimplus/examples/VmBootTimeAndOverheadExample.java b/src/main/java/org/cloudsimplus/examples/VmBootTimeAndOverheadExample.java index 494f65e..ba7e2f0 100755 --- a/src/main/java/org/cloudsimplus/examples/VmBootTimeAndOverheadExample.java +++ b/src/main/java/org/cloudsimplus/examples/VmBootTimeAndOverheadExample.java @@ -131,7 +131,7 @@ private static double getVmCpuUsage(Vm vm) { } private static double getVmRamUsage(final Vm vm) { - return vm.getRam().getPercentUtilization() * 100.0; + return vm.getRam().getPercentOccupied() * 100.0; } /// Creates a Datacenter and its Hosts. @@ -142,13 +142,13 @@ private Datacenter createDatacenter() { hostList.add(host); } - //Uses a VmAllocationPolicySimple by default to allocate VMs + //Uses a VmPlacementPolicySimple by default to place VMs return new DatacenterSimple(simulation, hostList).setSchedulingInterval(SCHEDULING_INTERVAL); } private Host createHost() { /* - Uses ResourceProvisionerSimple by default for RAM and BW provisioning + Uses ResourceAllocatorSimple by default for RAM and BW allocation and VmSchedulerSpaceShared for VM scheduling. */ return new HostSimple(HOST_RAM, HOST_BW, HOST_STORAGE, HOST_CAPACITY); diff --git a/src/main/java/org/cloudsimplus/examples/VmDestructionExample.java b/src/main/java/org/cloudsimplus/examples/VmDestructionExample.java index 1af10d8..28e9c68 100755 --- a/src/main/java/org/cloudsimplus/examples/VmDestructionExample.java +++ b/src/main/java/org/cloudsimplus/examples/VmDestructionExample.java @@ -35,7 +35,7 @@ import org.cloudsimplus.hosts.HostSimple; import org.cloudsimplus.listeners.EventListener; import org.cloudsimplus.listeners.VmHostEventInfo; -import org.cloudsimplus.provisioners.ResourceProvisionerSimple; +import org.cloudsimplus.allocators.ResourceAllocatorSimple; import org.cloudsimplus.resources.CoreCapacity; import org.cloudsimplus.schedulers.cloudlet.CloudletSchedulerTimeShared; import org.cloudsimplus.schedulers.vm.VmSchedulerTimeShared; @@ -179,13 +179,13 @@ private Host createHost() { final long ram = 2048; //in Megabytes final long bw = 10000; //in Megabits/s final long storage = 1000000; //in Megabytes - final var ramProvisioner = new ResourceProvisionerSimple(); - final var bwProvisioner = new ResourceProvisionerSimple(); + final var ramAllocator = new ResourceAllocatorSimple(); + final var bwAllocator = new ResourceAllocatorSimple(); final var vmScheduler = new VmSchedulerTimeShared(); final var host = new HostSimple(ram, bw, storage, HOST_CAPACITY); host - .setRamProvisioner(ramProvisioner) - .setBwProvisioner(bwProvisioner) + .setRamAllocator(ramAllocator) + .setBwAllocator(bwAllocator) .setVmScheduler(vmScheduler); return host; } diff --git a/src/main/java/org/cloudsimplus/examples/VmGroupPlacementExample1.java b/src/main/java/org/cloudsimplus/examples/VmGroupPlacementExample1.java index c294b21..834491a 100755 --- a/src/main/java/org/cloudsimplus/examples/VmGroupPlacementExample1.java +++ b/src/main/java/org/cloudsimplus/examples/VmGroupPlacementExample1.java @@ -132,7 +132,7 @@ private Datacenter createDatacenter() { hostList.add(host); } - //Uses a VmAllocationPolicySimple by default to allocate VMs + //Uses a VmPlacementPolicySimple by default to place VMs return new DatacenterSimple(simulation, hostList); } @@ -145,7 +145,7 @@ private Host createHost(final long id, final int pes) { final long storage = BASE_HOST_STORAGE * id; //in Megabytes /* - Uses ResourceProvisionerSimple by default for RAM and BW provisioning + Uses ResourceAllocatorSimple by default for RAM and BW allocation and VmSchedulerSpaceShared for VM scheduling. */ final Host host = new HostSimple(ram, bw, storage, cpuCapacity); diff --git a/src/main/java/org/cloudsimplus/examples/VmAllocationPolicyRoundRobinExample.java b/src/main/java/org/cloudsimplus/examples/VmPlacementPolicyRoundRobinExample.java similarity index 94% rename from src/main/java/org/cloudsimplus/examples/VmAllocationPolicyRoundRobinExample.java rename to src/main/java/org/cloudsimplus/examples/VmPlacementPolicyRoundRobinExample.java index 07a8788..e62dc4f 100755 --- a/src/main/java/org/cloudsimplus/examples/VmAllocationPolicyRoundRobinExample.java +++ b/src/main/java/org/cloudsimplus/examples/VmPlacementPolicyRoundRobinExample.java @@ -23,7 +23,7 @@ */ package org.cloudsimplus.examples; -import org.cloudsimplus.allocationpolicies.VmAllocationPolicyRoundRobin; +import org.cloudsimplus.placementpolicies.VmPlacementPolicyRoundRobin; import org.cloudsimplus.brokers.DatacenterBroker; import org.cloudsimplus.brokers.DatacenterBrokerSimple; import org.cloudsimplus.builders.tables.CloudletsTableBuilder; @@ -43,7 +43,7 @@ import java.util.Comparator; import java.util.List; -/// An example that show the usage of the [VmAllocationPolicyRoundRobin], +/// An example that show the usage of the [VmPlacementPolicyRoundRobin], /// that cyclically places VMs into Hosts. This way, it places a VM into a Host /// and moves to the next Host. /// All hosts are not powered-on when created. As VMs need to be placed, @@ -54,7 +54,7 @@ /// /// @author Manoel Campos da Silva Filho /// @since CloudSim Plus 4.4.2 -public class VmAllocationPolicyRoundRobinExample { +public class VmPlacementPolicyRoundRobinExample { private static final int HOSTS = 4; private static final int HOST_CORES = 8; @@ -86,10 +86,10 @@ public class VmAllocationPolicyRoundRobinExample { private Datacenter datacenter0; public static void main(String[] args) { - new VmAllocationPolicyRoundRobinExample(); + new VmPlacementPolicyRoundRobinExample(); } - private VmAllocationPolicyRoundRobinExample() { + private VmPlacementPolicyRoundRobinExample() { /*Enables just some level of log messages. Make sure to import org.cloudsimplus.util.Log;*/ //Log.setLevel(ch.qos.logback.classic.Level.WARN); @@ -120,7 +120,7 @@ private Datacenter createDatacenter() { hostList.add(host); } - return new DatacenterSimple(simulation, hostList, new VmAllocationPolicyRoundRobin()); + return new DatacenterSimple(simulation, hostList, new VmPlacementPolicyRoundRobin()); } private Host createHost() { @@ -129,7 +129,7 @@ private Host createHost() { final long storage = 1000000; //in Megabytes /* - Uses ResourceProvisionerSimple by default for RAM and BW provisioning + Uses ResourceAllocatorSimple by default for RAM and BW allocation and VmSchedulerSpaceShared for VM scheduling. */ return new HostSimple(ram, bw, storage, HOST_CAPACITY, false); diff --git a/src/main/java/org/cloudsimplus/examples/autoscaling/LoadBalancerByHorizontalVmScalingExample.java b/src/main/java/org/cloudsimplus/examples/autoscaling/LoadBalancerByHorizontalVmScalingExample.java index a10e0bd..54437af 100755 --- a/src/main/java/org/cloudsimplus/examples/autoscaling/LoadBalancerByHorizontalVmScalingExample.java +++ b/src/main/java/org/cloudsimplus/examples/autoscaling/LoadBalancerByHorizontalVmScalingExample.java @@ -40,7 +40,7 @@ import org.cloudsimplus.hosts.HostSimple; import org.cloudsimplus.listeners.EventInfo; import org.cloudsimplus.listeners.EventListener; -import org.cloudsimplus.provisioners.ResourceProvisionerSimple; +import org.cloudsimplus.allocators.ResourceAllocatorSimple; import org.cloudsimplus.resources.CoreCapacity; import org.cloudsimplus.schedulers.cloudlet.CloudletSchedulerTimeShared; import org.cloudsimplus.schedulers.vm.VmSchedulerTimeShared; @@ -230,8 +230,8 @@ private Host createHost() { final long storage = 1000000; // in Megabytes final long bw = 10000; //in Megabits/s return new HostSimple(ram, bw, storage, HOST_CAPACITY) - .setRamProvisioner(new ResourceProvisionerSimple()) - .setBwProvisioner(new ResourceProvisionerSimple()) + .setRamAllocator(new ResourceAllocatorSimple()) + .setBwAllocator(new ResourceAllocatorSimple()) .setVmScheduler(new VmSchedulerTimeShared()); } diff --git a/src/main/java/org/cloudsimplus/examples/autoscaling/VerticalVmCpuScalingDynamicThreshold.java b/src/main/java/org/cloudsimplus/examples/autoscaling/VerticalVmCpuScalingDynamicThreshold.java index bdea028..0853235 100755 --- a/src/main/java/org/cloudsimplus/examples/autoscaling/VerticalVmCpuScalingDynamicThreshold.java +++ b/src/main/java/org/cloudsimplus/examples/autoscaling/VerticalVmCpuScalingDynamicThreshold.java @@ -42,7 +42,7 @@ import org.cloudsimplus.hosts.HostSimple; import org.cloudsimplus.listeners.EventInfo; import org.cloudsimplus.listeners.EventListener; -import org.cloudsimplus.provisioners.ResourceProvisionerSimple; +import org.cloudsimplus.allocators.ResourceAllocatorSimple; import org.cloudsimplus.resources.CoreCapacity; import org.cloudsimplus.resources.Processor; import org.cloudsimplus.schedulers.cloudlet.CloudletSchedulerTimeShared; @@ -196,8 +196,8 @@ private Host createHost() { final long storage = 10000000; //in Megabytes final int id = hostList.size(); return new HostSimple(ram, bw, storage, HOST_CAPACITY) - .setRamProvisioner(new ResourceProvisionerSimple()) - .setBwProvisioner(new ResourceProvisionerSimple()) + .setRamAllocator(new ResourceAllocatorSimple()) + .setBwAllocator(new ResourceAllocatorSimple()) .setVmScheduler(new VmSchedulerTimeShared()); } @@ -271,7 +271,7 @@ private VerticalVmScaling createVerticalPeScaling() { /// So, here we are defining our own [ResourceScaling] instead of /// using the available ones such as the [ResourceScalingGradual] /// or [ResourceScalingInstantaneous]. - verticalCpuScaling.setResourceScaling(vs -> 2*vs.getScalingFactor()*vs.getAllocatedResource()); + verticalCpuScaling.setResourceScaling(vs -> 2*vs.getScalingFactor()*vs.getOccupiedResource()); verticalCpuScaling.setLowerThresholdFunction(this::lowerCpuUtilizationThreshold); verticalCpuScaling.setUpperThresholdFunction(this::upperCpuUtilizationThreshold); diff --git a/src/main/java/org/cloudsimplus/examples/autoscaling/VerticalVmCpuScalingExample.java b/src/main/java/org/cloudsimplus/examples/autoscaling/VerticalVmCpuScalingExample.java index 900574a..3e5973c 100755 --- a/src/main/java/org/cloudsimplus/examples/autoscaling/VerticalVmCpuScalingExample.java +++ b/src/main/java/org/cloudsimplus/examples/autoscaling/VerticalVmCpuScalingExample.java @@ -163,7 +163,7 @@ private void onClockTickListener(EventInfo evt) { "\t\tTime %6.1f: Vm %d CPU Usage: %6.2f%% (%2d vCPUs. Running Cloudlets: #%d). RAM usage: %.2f%% (%d MB)%n", evt.getTime(), vm.getId(), vm.getCpuPercentUtilization()*100.0, vm.getProcessor().getCores(), vm.getCloudletScheduler().getCloudletExecList().size(), - vm.getRam().getPercentUtilization()*100, vm.getRam().getAllocatedResource()) + vm.getRam().getPercentOccupied()*100, vm.getRam().getOccupied()) ); } @@ -254,7 +254,7 @@ private VerticalVmScaling createVerticalPeScaling() { /// using the available ones such as the [ResourceScalingGradual] /// or [ResourceScalingInstantaneous]. final double multiplier = 2; - verticalCpuScaling.setResourceScaling(vs -> multiplier * vs.getScalingFactor() * vs.getAllocatedResource()) + verticalCpuScaling.setResourceScaling(vs -> multiplier * vs.getScalingFactor() * vs.getOccupiedResource()) .setLowerThresholdFunction(this::lowerCpuUtilizationThreshold) .setUpperThresholdFunction(this::upperCpuUtilizationThreshold); diff --git a/src/main/java/org/cloudsimplus/examples/autoscaling/VerticalVmRamScalingExample.java b/src/main/java/org/cloudsimplus/examples/autoscaling/VerticalVmRamScalingExample.java index 516c265..95fd808 100755 --- a/src/main/java/org/cloudsimplus/examples/autoscaling/VerticalVmRamScalingExample.java +++ b/src/main/java/org/cloudsimplus/examples/autoscaling/VerticalVmRamScalingExample.java @@ -178,12 +178,12 @@ private VerticalVmRamScalingExample() { private void onClockTickListener(final EventInfo event) { for (final var vm : vmList) { System.out.printf("\t\tTime %6.1f: Vm %d Ram Usage: %6.2f%% (%4d of %4d MB)", - event.getTime(), vm.getId(), vm.getRam().getPercentUtilization() * 100.0, - vm.getRam().getAllocatedResource(), vm.getRam().getCapacity()); + event.getTime(), vm.getId(), vm.getRam().getPercentOccupied() * 100.0, + vm.getRam().getOccupied(), vm.getRam().getCapacity()); System.out.printf(" | Host Ram Allocation: %6.2f%% (%5d of %5d MB). Running Cloudlets: %d%n", - vm.getHost().getRam().getPercentUtilization() * 100, - vm.getHost().getRam().getAllocatedResource(), + vm.getHost().getRam().getPercentOccupied() * 100, + vm.getHost().getRam().getOccupied(), vm.getHost().getRam().getCapacity(), vm.getCloudletScheduler().getCloudletExecList().size()); } } diff --git a/src/main/java/org/cloudsimplus/examples/brokers/BrokerTargetDatacenterExample.java b/src/main/java/org/cloudsimplus/examples/brokers/BrokerTargetDatacenterExample.java index 2dc83f9..71d5367 100755 --- a/src/main/java/org/cloudsimplus/examples/brokers/BrokerTargetDatacenterExample.java +++ b/src/main/java/org/cloudsimplus/examples/brokers/BrokerTargetDatacenterExample.java @@ -153,7 +153,7 @@ private Datacenter createDatacenter() { .mapToObj(i -> createHost()) .toList(); - //Uses a VmAllocationPolicySimple by default to allocate VMs + //Uses a VmPlacementPolicySimple by default to place VMs return new DatacenterSimple(simulation, hostList); } @@ -163,7 +163,7 @@ private Host createHost() { final long storage = 1000000; //in Megabytes /* - Uses ResourceProvisionerSimple by default for RAM and BW provisioning + Uses ResourceAllocatorSimple by default for RAM and BW allocation and VmSchedulerSpaceShared for VM scheduling. */ final Host host = new HostSimple(ram, bw, storage, HOST_CAPACITY); diff --git a/src/main/java/org/cloudsimplus/examples/brokers/DatacenterBrokerBatchVmCreationRequestExample.java b/src/main/java/org/cloudsimplus/examples/brokers/DatacenterBrokerBatchVmCreationRequestExample.java index 13e9e58..285e2e5 100755 --- a/src/main/java/org/cloudsimplus/examples/brokers/DatacenterBrokerBatchVmCreationRequestExample.java +++ b/src/main/java/org/cloudsimplus/examples/brokers/DatacenterBrokerBatchVmCreationRequestExample.java @@ -23,7 +23,7 @@ */ package org.cloudsimplus.examples.brokers; -import org.cloudsimplus.allocationpolicies.VmAllocationPolicyBatchPlacementUnderloadedHosts; +import org.cloudsimplus.placementpolicies.VmPlacementPolicyBatchUnderloadedHosts; import org.cloudsimplus.brokers.DatacenterBroker; import org.cloudsimplus.brokers.DatacenterBrokerSimple; import org.cloudsimplus.builders.tables.CloudletsTableBuilder; @@ -49,8 +49,8 @@ /// An example showing how to enable a [DatacenterBroker] to /// request creation of a Vm List in batch, instead of in a one-by-one basis. -/// It can use any [org.cloudsimplus.allocationpolicies.VmAllocationPolicy] -/// but it uses the [VmAllocationPolicyBatchPlacementUnderloadedHosts] +/// It can use any [org.cloudsimplus.placementpolicies.VmPlacementPolicy] +/// but it uses the [VmPlacementPolicyBatchUnderloadedHosts] /// as an example. /// Check [DatacenterBroker#setBatchVmCreation(boolean)] /// @@ -160,15 +160,15 @@ private Datacenter createDatacenter() { hostList.add(host); } - final var vmAllocationPolicy = new VmAllocationPolicyBatchPlacementUnderloadedHosts(new VmSelectionPolicyMinimumUtilization()); - final var dc = new DatacenterSimple(simulation, hostList, vmAllocationPolicy); + final var vmPlacementPolicy = new VmPlacementPolicyBatchUnderloadedHosts(new VmSelectionPolicyMinimumUtilization()); + final var dc = new DatacenterSimple(simulation, hostList, vmPlacementPolicy); dc.setSchedulingInterval(SCHEDULING_INTERVAL); return dc; } private Host createHost() { /* - Uses ResourceProvisionerSimple by default for RAM and BW provisioning + Uses ResourceAllocatorSimple by default for RAM and BW allocation and VmSchedulerSpaceShared for VM scheduling. */ return new HostSimple(HOST_RAM, HOST_BW, HOST_STORAGE, HOST_CAPACITY); diff --git a/src/main/java/org/cloudsimplus/examples/brokers/DatacenterBrokerHeuristicExample.java b/src/main/java/org/cloudsimplus/examples/brokers/DatacenterBrokerHeuristicExample.java index 4e9bb48..7c1ce54 100755 --- a/src/main/java/org/cloudsimplus/examples/brokers/DatacenterBrokerHeuristicExample.java +++ b/src/main/java/org/cloudsimplus/examples/brokers/DatacenterBrokerHeuristicExample.java @@ -38,7 +38,7 @@ import org.cloudsimplus.heuristics.HeuristicSolution; import org.cloudsimplus.hosts.Host; import org.cloudsimplus.hosts.HostSimple; -import org.cloudsimplus.provisioners.ResourceProvisionerSimple; +import org.cloudsimplus.allocators.ResourceAllocatorSimple; import org.cloudsimplus.resources.CoreCapacity; import org.cloudsimplus.schedulers.cloudlet.CloudletSchedulerTimeShared; import org.cloudsimplus.schedulers.vm.VmSchedulerTimeShared; @@ -195,8 +195,8 @@ private Host createHost() { final var cpuCapacity = new CoreCapacity(8, mips); return new HostSimple(ram, bw, storage, cpuCapacity) - .setRamProvisioner(new ResourceProvisionerSimple()) - .setBwProvisioner(new ResourceProvisionerSimple()) + .setRamAllocator(new ResourceAllocatorSimple()) + .setBwAllocator(new ResourceAllocatorSimple()) .setVmScheduler(new VmSchedulerTimeShared()); } diff --git a/src/main/java/org/cloudsimplus/examples/brokers/DatacenterBrokersMappingComparison.java b/src/main/java/org/cloudsimplus/examples/brokers/DatacenterBrokersMappingComparison.java index 53a18fd..2bb98c0 100755 --- a/src/main/java/org/cloudsimplus/examples/brokers/DatacenterBrokersMappingComparison.java +++ b/src/main/java/org/cloudsimplus/examples/brokers/DatacenterBrokersMappingComparison.java @@ -24,7 +24,7 @@ package org.cloudsimplus.examples.brokers; import ch.qos.logback.classic.Level; -import org.cloudsimplus.allocationpolicies.VmAllocationPolicySimple; +import org.cloudsimplus.placementpolicies.VmPlacementPolicySimple; import org.cloudsimplus.brokers.DatacenterBroker; import org.cloudsimplus.brokers.DatacenterBrokerBestFit; import org.cloudsimplus.brokers.DatacenterBrokerHeuristic; @@ -43,7 +43,7 @@ import org.cloudsimplus.heuristics.HeuristicSolution; import org.cloudsimplus.hosts.Host; import org.cloudsimplus.hosts.HostSimple; -import org.cloudsimplus.provisioners.ResourceProvisionerSimple; +import org.cloudsimplus.allocators.ResourceAllocatorSimple; import org.cloudsimplus.resources.CoreCapacity; import org.cloudsimplus.schedulers.cloudlet.CloudletSchedulerTimeShared; import org.cloudsimplus.schedulers.vm.VmSchedulerTimeShared; @@ -208,7 +208,7 @@ private DatacenterSimple createDatacenter(final Simulation sim) { hostList.add(createHost()); } - return new DatacenterSimple(sim, hostList, new VmAllocationPolicySimple()); + return new DatacenterSimple(sim, hostList, new VmPlacementPolicySimple()); } private Host createHost() { @@ -221,8 +221,8 @@ private Host createHost() { final var cpuCapacity = new CoreCapacity(8, mips); return new HostSimple(ram, bw, storage, cpuCapacity) - .setRamProvisioner(new ResourceProvisionerSimple()) - .setBwProvisioner(new ResourceProvisionerSimple()) + .setRamAllocator(new ResourceAllocatorSimple()) + .setBwAllocator(new ResourceAllocatorSimple()) .setVmScheduler(new VmSchedulerTimeShared()); } diff --git a/src/main/java/org/cloudsimplus/examples/brokers/DatacenterSelectionByTimeZoneExample.java b/src/main/java/org/cloudsimplus/examples/brokers/DatacenterSelectionByTimeZoneExample.java index eff86e3..7d02570 100755 --- a/src/main/java/org/cloudsimplus/examples/brokers/DatacenterSelectionByTimeZoneExample.java +++ b/src/main/java/org/cloudsimplus/examples/brokers/DatacenterSelectionByTimeZoneExample.java @@ -174,7 +174,7 @@ private Datacenter createDatacenter(final double timeZone) { hostList.add(host); } - //Uses a VmAllocationPolicySimple by default to allocate VMs + //Uses a VmPlacementPolicySimple by default to place VMs final var dc = new DatacenterSimple(simulation, hostList); dc.setTimeZone(timeZone); return dc; @@ -186,7 +186,7 @@ private Host createHost() { final long storage = 1000000; //in Megabytes /* - Uses ResourceProvisionerSimple by default for RAM and BW provisioning + Uses ResourceAllocatorSimple by default for RAM and BW allocation and VmSchedulerSpaceShared for VM scheduling. */ final var host = new HostSimple(ram, bw, storage, HOST_CAPACITY); diff --git a/src/main/java/org/cloudsimplus/examples/brokers/MultipleBrokers1.java b/src/main/java/org/cloudsimplus/examples/brokers/MultipleBrokers1.java index 9bc32c7..e0e654a 100755 --- a/src/main/java/org/cloudsimplus/examples/brokers/MultipleBrokers1.java +++ b/src/main/java/org/cloudsimplus/examples/brokers/MultipleBrokers1.java @@ -33,7 +33,7 @@ import org.cloudsimplus.datacenters.DatacenterSimple; import org.cloudsimplus.hosts.Host; import org.cloudsimplus.hosts.HostSimple; -import org.cloudsimplus.provisioners.ResourceProvisionerSimple; +import org.cloudsimplus.allocators.ResourceAllocatorSimple; import org.cloudsimplus.resources.CoreCapacity; import org.cloudsimplus.schedulers.cloudlet.CloudletSchedulerTimeShared; import org.cloudsimplus.schedulers.vm.VmSchedulerTimeShared; @@ -191,13 +191,13 @@ private Host createHost() { final long ram = 2048; //in Megabytes final long bw = 10000; //in Megabits/s final long storage = 1000000; //in Megabytes - final var ramProvisioner = new ResourceProvisionerSimple(); - final var bwProvisioner = new ResourceProvisionerSimple(); + final var ramAllocator = new ResourceAllocatorSimple(); + final var bwAllocator = new ResourceAllocatorSimple(); final var vmScheduler = new VmSchedulerTimeShared(); final var host = new HostSimple(ram, bw, storage, HOST_CAPACITY); host - .setRamProvisioner(ramProvisioner) - .setBwProvisioner(bwProvisioner) + .setRamAllocator(ramAllocator) + .setBwAllocator(bwAllocator) .setVmScheduler(vmScheduler); return host; } diff --git a/src/main/java/org/cloudsimplus/examples/brokers/MultipleBrokers2.java b/src/main/java/org/cloudsimplus/examples/brokers/MultipleBrokers2.java index caa6a56..f3baaab 100755 --- a/src/main/java/org/cloudsimplus/examples/brokers/MultipleBrokers2.java +++ b/src/main/java/org/cloudsimplus/examples/brokers/MultipleBrokers2.java @@ -35,7 +35,7 @@ import org.cloudsimplus.hosts.HostSimple; import org.cloudsimplus.listeners.EventInfo; import org.cloudsimplus.listeners.EventListener; -import org.cloudsimplus.provisioners.ResourceProvisionerSimple; +import org.cloudsimplus.allocators.ResourceAllocatorSimple; import org.cloudsimplus.resources.CoreCapacity; import org.cloudsimplus.schedulers.cloudlet.CloudletSchedulerTimeShared; import org.cloudsimplus.schedulers.vm.VmSchedulerTimeShared; @@ -245,13 +245,13 @@ private Host createHost() { final long ram = 2048; //in Megabytes final long bw = 10000; //in Megabits/s final long storage = 1000000; //in Megabytes - final var ramProvisioner = new ResourceProvisionerSimple(); - final var bwProvisioner = new ResourceProvisionerSimple(); + final var ramAllocator = new ResourceAllocatorSimple(); + final var bwAllocator = new ResourceAllocatorSimple(); final var vmScheduler = new VmSchedulerTimeShared(); final var host = new HostSimple(ram, bw, storage, HOST_CAPACITY); host - .setRamProvisioner(ramProvisioner) - .setBwProvisioner(bwProvisioner) + .setRamAllocator(ramAllocator) + .setBwAllocator(bwAllocator) .setVmScheduler(vmScheduler); return host; } diff --git a/src/main/java/org/cloudsimplus/examples/brokers/MultipleBrokers3.java b/src/main/java/org/cloudsimplus/examples/brokers/MultipleBrokers3.java index bbb0e90..25ded71 100755 --- a/src/main/java/org/cloudsimplus/examples/brokers/MultipleBrokers3.java +++ b/src/main/java/org/cloudsimplus/examples/brokers/MultipleBrokers3.java @@ -33,7 +33,7 @@ import org.cloudsimplus.datacenters.DatacenterSimple; import org.cloudsimplus.hosts.Host; import org.cloudsimplus.hosts.HostSimple; -import org.cloudsimplus.provisioners.ResourceProvisionerSimple; +import org.cloudsimplus.allocators.ResourceAllocatorSimple; import org.cloudsimplus.resources.CoreCapacity; import org.cloudsimplus.schedulers.cloudlet.CloudletSchedulerTimeShared; import org.cloudsimplus.schedulers.vm.VmSchedulerTimeShared; @@ -154,8 +154,8 @@ private Host createHost() { final long storage = 1000000; //in Megabytes final var host = new HostSimple(ram, bw, storage, HOST_CAPACITY); host - .setRamProvisioner(new ResourceProvisionerSimple()) - .setBwProvisioner(new ResourceProvisionerSimple()) + .setRamAllocator(new ResourceAllocatorSimple()) + .setBwAllocator(new ResourceAllocatorSimple()) .setVmScheduler(new VmSchedulerTimeShared()); return host; } diff --git a/src/main/java/org/cloudsimplus/examples/brokers/SelectNextDatacenterExample.java b/src/main/java/org/cloudsimplus/examples/brokers/SelectNextDatacenterExample.java index b6ab445..0d77656 100755 --- a/src/main/java/org/cloudsimplus/examples/brokers/SelectNextDatacenterExample.java +++ b/src/main/java/org/cloudsimplus/examples/brokers/SelectNextDatacenterExample.java @@ -124,7 +124,7 @@ private Datacenter createDatacenter(final int hostsPes) { hostList.add(host); } - //Uses a VmAllocationPolicySimple by default to allocate VMs + //Uses a VmPlacementPolicySimple by default to place VMs return new DatacenterSimple(simulation, hostList); } @@ -136,7 +136,7 @@ private Host createHost(final int pes) { final long storage = 1000000; //in Megabytes /* - Uses ResourceProvisionerSimple by default for RAM and BW provisioning + Uses ResourceAllocatorSimple by default for RAM and BW allocation and VmSchedulerSpaceShared for VM scheduling. */ final var host = new HostSimple(ram, bw, storage, cpuCapacity); diff --git a/src/main/java/org/cloudsimplus/examples/costs/CostsExample1.java b/src/main/java/org/cloudsimplus/examples/costs/CostsExample1.java index 711fffc..614c253 100755 --- a/src/main/java/org/cloudsimplus/examples/costs/CostsExample1.java +++ b/src/main/java/org/cloudsimplus/examples/costs/CostsExample1.java @@ -143,7 +143,7 @@ private Datacenter createDatacenter() { hostList.add(host); } - //Uses a VmAllocationPolicySimple by default to allocate VMs + //Uses a VmPlacementPolicySimple by default to place VMs final var dc = new DatacenterSimple(simulation, hostList).setSchedulingInterval(SCHEDULING_INTERVAL); // Those are monetary values. Consider any currency you want (such as Dollar) @@ -157,7 +157,7 @@ private Host createHost() { final long storage = 1000000; //in Megabytes /* - Uses ResourceProvisionerSimple by default for RAM and BW provisioning + Uses ResourceAllocatorSimple by default for RAM and BW allocation and VmSchedulerSpaceShared for VM scheduling. */ return new HostSimple(ram, bw, storage, HOST_CAPACITY); diff --git a/src/main/java/org/cloudsimplus/examples/dynamic/CreateCloudletAfterLastFinishedOne.java b/src/main/java/org/cloudsimplus/examples/dynamic/CreateCloudletAfterLastFinishedOne.java index e800c9b..1d420d6 100755 --- a/src/main/java/org/cloudsimplus/examples/dynamic/CreateCloudletAfterLastFinishedOne.java +++ b/src/main/java/org/cloudsimplus/examples/dynamic/CreateCloudletAfterLastFinishedOne.java @@ -35,7 +35,7 @@ import org.cloudsimplus.hosts.HostSimple; import org.cloudsimplus.listeners.CloudletVmEventInfo; import org.cloudsimplus.listeners.EventListener; -import org.cloudsimplus.provisioners.ResourceProvisionerSimple; +import org.cloudsimplus.allocators.ResourceAllocatorSimple; import org.cloudsimplus.resources.CoreCapacity; import org.cloudsimplus.schedulers.cloudlet.CloudletSchedulerTimeShared; import org.cloudsimplus.schedulers.vm.VmSchedulerSpaceShared; @@ -181,8 +181,8 @@ private Host createHost(int id) { long bw = 10000; //Megabits/s return new HostSimple(ram, bw, storage, cpuCapacity) - .setRamProvisioner(new ResourceProvisionerSimple()) - .setBwProvisioner(new ResourceProvisionerSimple()) + .setRamAllocator(new ResourceAllocatorSimple()) + .setBwAllocator(new ResourceAllocatorSimple()) .setVmScheduler(new VmSchedulerSpaceShared()); } } diff --git a/src/main/java/org/cloudsimplus/examples/dynamic/DynamicHostCreation.java b/src/main/java/org/cloudsimplus/examples/dynamic/DynamicHostCreation.java index 2d295bc..62f0dfa 100755 --- a/src/main/java/org/cloudsimplus/examples/dynamic/DynamicHostCreation.java +++ b/src/main/java/org/cloudsimplus/examples/dynamic/DynamicHostCreation.java @@ -23,7 +23,7 @@ */ package org.cloudsimplus.examples.dynamic; -import org.cloudsimplus.allocationpolicies.VmAllocationPolicy; +import org.cloudsimplus.placementpolicies.VmPlacementPolicy; import org.cloudsimplus.brokers.DatacenterBroker; import org.cloudsimplus.brokers.DatacenterBrokerSimple; import org.cloudsimplus.builders.tables.CloudletsTableBuilder; @@ -57,7 +57,7 @@ /// it's created a new Host and VM. Two new Cloudlets are created for this new VM /// the Cloudlets and the VM is submitted by the broker to the Datacenter. /// Since the Hosts created before starting the simulation -/// don't have enough PEs to place this new VM, the [VmAllocationPolicy] +/// don't have enough PEs to place this new VM, the [VmPlacementPolicy] /// will chose the 5th Host (created dynamically) to place that VM /// and run the Cloudlets. /// diff --git a/src/main/java/org/cloudsimplus/examples/dynamic/DynamicVmAllocationPolicyBestFitExample.java b/src/main/java/org/cloudsimplus/examples/dynamic/DynamicVmPlacementPolicyBestFitExample.java similarity index 90% rename from src/main/java/org/cloudsimplus/examples/dynamic/DynamicVmAllocationPolicyBestFitExample.java rename to src/main/java/org/cloudsimplus/examples/dynamic/DynamicVmPlacementPolicyBestFitExample.java index ce18f3f..c7e5734 100755 --- a/src/main/java/org/cloudsimplus/examples/dynamic/DynamicVmAllocationPolicyBestFitExample.java +++ b/src/main/java/org/cloudsimplus/examples/dynamic/DynamicVmPlacementPolicyBestFitExample.java @@ -46,8 +46,8 @@ */ package org.cloudsimplus.examples.dynamic; -import org.cloudsimplus.allocationpolicies.VmAllocationPolicy; -import org.cloudsimplus.allocationpolicies.VmAllocationPolicySimple; +import org.cloudsimplus.placementpolicies.VmPlacementPolicy; +import org.cloudsimplus.placementpolicies.VmPlacementPolicySimple; import org.cloudsimplus.brokers.DatacenterBroker; import org.cloudsimplus.brokers.DatacenterBrokerSimple; import org.cloudsimplus.builders.tables.CloudletsTableBuilder; @@ -74,14 +74,14 @@ /// An example showing how to create 1 Datacenter with 5 hosts, /// 1 VM by host and 1 cloudlet by VM and perform VM allocation by /// using Java 8+ Functional Programming to change, at runtime, the -/// policy used by a [VmAllocationPolicy]. +/// policy used by a [VmPlacementPolicy]. /// /// VMs are allocated based on a **Best Fit allocation policy**, which /// selects the suitable Host with the lowest number of available PEs /// that is enough to run the VM. /// This policy is dynamically defined by changing the [Function] -/// of the [VmAllocationPolicy], without requiring to create -/// a new class. The [VmAllocationPolicySimple] used in this example ignores power usage of +/// of the [VmPlacementPolicy], without requiring to create +/// a new class. The [VmPlacementPolicySimple] used in this example ignores power usage of /// Hosts. This way, it isn't required to set a PowerModel for Hosts. /// /// It is used some constants to create simulation objects such as @@ -99,7 +99,7 @@ /// to run correctly. /// /// @author Manoel Campos da Silva Filho -public final class DynamicVmAllocationPolicyBestFitExample { +public final class DynamicVmPlacementPolicyBestFitExample { private static final int SCHEDULE_INTERVAL = 5; private static final int HOSTS = 5; @@ -130,10 +130,10 @@ public final class DynamicVmAllocationPolicyBestFitExample { private final List hostList = new ArrayList<>(); public static void main(String[] args) { - new DynamicVmAllocationPolicyBestFitExample(); + new DynamicVmPlacementPolicyBestFitExample(); } - private DynamicVmAllocationPolicyBestFitExample(){ + private DynamicVmPlacementPolicyBestFitExample(){ /*Enables just some level of log messages. Make sure to import org.cloudsimplus.util.Log;*/ //Log.setLevel(ch.qos.logback.classic.Level.WARN); @@ -160,13 +160,13 @@ private DynamicVmAllocationPolicyBestFitExample(){ /// A method that defines a Best Fit policy to select a suitable Host with the least /// available PEs to place a VM. /// Using Java 8+ Functional Programming, this method is given as parameter - /// to the constructor of a [VmAllocationPolicySimple] + /// to the constructor of a [VmPlacementPolicySimple] /// - /// @param allocationPolicy the [VmAllocationPolicy] that is trying to allocate a Host for the requesting VM + /// @param allocationPolicy the [VmPlacementPolicy] that is trying to place the requesting VM into a Host /// @param vm the VM to find a host to /// @return an [`Optional`][java.util.Optional] which may contain a Host or an empty Optional if no suitable Host was found /// @see #createDatacenter() - private Optional bestFitHostSelectionPolicy(VmAllocationPolicy allocationPolicy, Vm vm) { + private Optional bestFitHostSelectionPolicy(VmPlacementPolicy allocationPolicy, Vm vm) { return allocationPolicy .getHostList() .stream() @@ -229,8 +229,8 @@ private Datacenter createDatacenter() { } System.out.println(); - /*Creates a VmAllocationPolicy and changes, at runtime, the policy used to select a Host for a VM.*/ - final var allocationPolicy = new VmAllocationPolicySimple(this::bestFitHostSelectionPolicy); + /*Creates a VmPlacementPolicy and changes, at runtime, the policy used to select a Host for a VM.*/ + final var allocationPolicy = new VmPlacementPolicySimple(this::bestFitHostSelectionPolicy); final var dc = new DatacenterSimple(simulation, hostList, allocationPolicy); diff --git a/src/main/java/org/cloudsimplus/examples/dynamic/KeepSimulationRunningExample.java b/src/main/java/org/cloudsimplus/examples/dynamic/KeepSimulationRunningExample.java index ac07150..79fd663 100755 --- a/src/main/java/org/cloudsimplus/examples/dynamic/KeepSimulationRunningExample.java +++ b/src/main/java/org/cloudsimplus/examples/dynamic/KeepSimulationRunningExample.java @@ -36,7 +36,7 @@ import org.cloudsimplus.hosts.HostSimple; import org.cloudsimplus.listeners.EventInfo; import org.cloudsimplus.listeners.EventListener; -import org.cloudsimplus.provisioners.ResourceProvisionerSimple; +import org.cloudsimplus.allocators.ResourceAllocatorSimple; import org.cloudsimplus.resources.CoreCapacity; import org.cloudsimplus.schedulers.cloudlet.CloudletSchedulerTimeShared; import org.cloudsimplus.schedulers.vm.VmSchedulerTimeShared; @@ -171,8 +171,8 @@ private Host createHost() { final long storage = 1000000; //in Megabytes final var host = new HostSimple(ram, bw, storage, HOST_CAPACITY); host - .setRamProvisioner(new ResourceProvisionerSimple()) - .setBwProvisioner(new ResourceProvisionerSimple()) + .setRamAllocator(new ResourceAllocatorSimple()) + .setBwAllocator(new ResourceAllocatorSimple()) .setVmScheduler(new VmSchedulerTimeShared()); return host; } diff --git a/src/main/java/org/cloudsimplus/examples/listeners/VmListenersExample1.java b/src/main/java/org/cloudsimplus/examples/listeners/VmListenersExample1.java index 2374d84..1ae977b 100755 --- a/src/main/java/org/cloudsimplus/examples/listeners/VmListenersExample1.java +++ b/src/main/java/org/cloudsimplus/examples/listeners/VmListenersExample1.java @@ -52,8 +52,8 @@ /// The example uses the new Vm listeners to get these /// notifications while the simulation is running. /// -/// @see Vm#addOnHostAllocationListener(EventListener) -/// @see Vm#addOnHostDeallocationListener(EventListener) +/// @see Vm#addOnHostPlacementListener(EventListener) +/// @see Vm#addOnHostRemovalListener(EventListener) /// @see Vm#addOnCreationFailureListener(EventListener) /// @see EventListener /// @@ -129,14 +129,14 @@ private void createAndSubmitVms() { /* Sets the Listener to intercept allocation of a Host to the Vm. * The Listener is created using Java 8+ Lambda Expressions. */ - vm0.addOnHostAllocationListener(eventInfo -> System.out.printf( + vm0.addOnHostPlacementListener(eventInfo -> System.out.printf( "%n\t#EventListener: Host %d allocated to Vm %d at time %.2f%n", eventInfo.getHost().getId(), eventInfo.getVm().getId(), eventInfo.getTime())); /* Sets the listener to intercept deallocation of a Host for the Vm. * The Listener is created using Java 8+ Lambda Expressions. */ - vm0.addOnHostDeallocationListener(eventInfo -> System.out.printf( + vm0.addOnHostRemovalListener(eventInfo -> System.out.printf( "%n\t#EventListener: Vm %d moved/removed from Host %d at time %.2f%n", eventInfo.getVm().getId(), eventInfo.getHost().getId(), eventInfo.getTime())); diff --git a/src/main/java/org/cloudsimplus/examples/listeners/VmListenersExample2.java b/src/main/java/org/cloudsimplus/examples/listeners/VmListenersExample2.java index 04e0818..0c9bb54 100755 --- a/src/main/java/org/cloudsimplus/examples/listeners/VmListenersExample2.java +++ b/src/main/java/org/cloudsimplus/examples/listeners/VmListenersExample2.java @@ -53,8 +53,8 @@ /// notifications while the simulation is running. It also shows how to /// reuse the same listener object to different VMs. /// -/// @see Vm#addOnHostAllocationListener(EventListener) -/// @see Vm#addOnHostDeallocationListener(EventListener) +/// @see Vm#addOnHostPlacementListener(EventListener) +/// @see Vm#addOnHostRemovalListener(EventListener) /// @see EventListener /// /// @author Manoel Campos da Silva Filho @@ -78,12 +78,12 @@ public class VmListenersExample2 { /// The listener object that will be created in order to be notified when /// a host is allocated for a VM. The same listener is used for all created VMs. /// @see #createVmListeners() - private EventListener onHostAllocationListener; + private EventListener onHostPlacementListener; /// The listener object that will be created in order to be notified when /// a host is deallocated for a VM. The same listener is used for all created VMs. /// @see #createVmListeners() - private EventListener onHostDeallocationListener; + private EventListener onHostRemovalListener; /// Starts the example execution, calling the class constructor\ /// to build and run the simulation. @@ -140,7 +140,7 @@ private void createVmListeners() { All VMs will use this same listener. The Listener is created using Java 8+ Lambda Expressions. */ - this.onHostAllocationListener = eventInfo -> System.out.printf( + this.onHostPlacementListener = eventInfo -> System.out.printf( "\t#EventListener: Host %d allocated to Vm %d at time %.2f%n", eventInfo.getHost().getId(), eventInfo.getVm().getId(), eventInfo.getTime()); @@ -149,7 +149,7 @@ private void createVmListeners() { All VMs will use this same listener. The Listener is created using Java 8+ Lambda Expressions. */ - this.onHostDeallocationListener = evt -> System.out.printf( + this.onHostRemovalListener = evt -> System.out.printf( "\t#EventListener: Vm %d moved/removed from Host %d at time %.2f%n", evt.getVm().getId(), evt.getHost().getId(), evt.getTime()); } @@ -169,10 +169,10 @@ private Vm createVm(int id) { .setCloudletScheduler(new CloudletSchedulerTimeShared()); /*Adds the listener to intercept allocation of a Host to the Vm.*/ - vm.addOnHostAllocationListener(this.onHostAllocationListener); + vm.addOnHostPlacementListener(this.onHostPlacementListener); /*Adds the listener to intercept deallocation of a Host for the Vm.*/ - vm.addOnHostDeallocationListener(this.onHostDeallocationListener); + vm.addOnHostRemovalListener(this.onHostRemovalListener); return vm; } diff --git a/src/main/java/org/cloudsimplus/examples/listeners/VmListenersExample3_DynamicVmCreation.java b/src/main/java/org/cloudsimplus/examples/listeners/VmListenersExample3_DynamicVmCreation.java index 9ff6708..31871b5 100755 --- a/src/main/java/org/cloudsimplus/examples/listeners/VmListenersExample3_DynamicVmCreation.java +++ b/src/main/java/org/cloudsimplus/examples/listeners/VmListenersExample3_DynamicVmCreation.java @@ -55,7 +55,7 @@ /// is deallocated for a VM (in this case meaning that the VM has finished /// executing) in order to place the next VM to run inside the host. /// -/// @see Vm#addOnHostDeallocationListener(EventListener) +/// @see Vm#addOnHostRemovalListener(EventListener) /// @see EventListener /// /// @author Manoel Campos da Silva Filho @@ -127,7 +127,7 @@ the deallocation of a host to a VM (that means the VM has finished executing).*/ /// @param eventInfo information about the happened event /// /// @see #createVm(int, DatacenterBroker) - private void onHostDeallocationListener(VmHostEventInfo eventInfo) { + private void onHostRemovalListener(VmHostEventInfo eventInfo) { numberOfFinishedVms++; System.out.printf( "\t# EventListener: Vm %d finished running all its cloudlets at time %.0f.%n", @@ -201,7 +201,7 @@ private Vm createAndSubmitVmForNewBroker() { /// @param broker the broker that will be submit the VM /// @return the created VM /// - /// @see #onHostDeallocationListener(VmHostEventInfo) + /// @see #onHostRemovalListener(VmHostEventInfo) private Vm createVm(int id, DatacenterBroker broker) { final int mips = 1000; final long size = 10000; // image size (Megabyte) @@ -211,7 +211,7 @@ private Vm createVm(int id, DatacenterBroker broker) { return new VmSimple(id, new CoreCapacity(VM_PES_NUMBER, mips)) .setRam(ram).setBw(bw).setSize(size) .setCloudletScheduler(new CloudletSchedulerSpaceShared()) - .addOnHostDeallocationListener(this::onHostDeallocationListener); + .addOnHostRemovalListener(this::onHostRemovalListener); } /// Creates a cloudlet with pre-defined configuration. diff --git a/src/main/java/org/cloudsimplus/examples/migration/InterDatacenterMigration1.java b/src/main/java/org/cloudsimplus/examples/migration/InterDatacenterMigration1.java index 3cb19a2..a832052 100755 --- a/src/main/java/org/cloudsimplus/examples/migration/InterDatacenterMigration1.java +++ b/src/main/java/org/cloudsimplus/examples/migration/InterDatacenterMigration1.java @@ -24,8 +24,8 @@ package org.cloudsimplus.examples.migration; import ch.qos.logback.classic.Level; -import org.cloudsimplus.allocationpolicies.migration.VmAllocationPolicyMigration; -import org.cloudsimplus.allocationpolicies.migration.VmAllocationPolicyMigrationFirstFitStaticThreshold; +import org.cloudsimplus.placementpolicies.migration.VmPlacementPolicyMigration; +import org.cloudsimplus.placementpolicies.migration.VmPlacementPolicyMigrationFirstFitStaticThreshold; import org.cloudsimplus.brokers.DatacenterBroker; import org.cloudsimplus.brokers.DatacenterBrokerSimple; import org.cloudsimplus.builders.tables.CloudletsTableBuilder; @@ -77,10 +77,10 @@ /// Check [DatacenterCharacteristics#getDistribution()] for details. /// /// The example performs VM migration using -/// a [VmAllocationPolicyMigrationFirstFitStaticThreshold]. +/// a [VmPlacementPolicyMigrationFirstFitStaticThreshold]. /// Such a policy migrates VMs based on /// a static host CPU utilization threshold. -/// The VmAllocationPolicy used in this example ignores power consumption of Hosts. +/// The VmPlacementPolicy used in this example ignores power consumption of Hosts. /// This way, it isn't required to set a PowerModel for Hosts. /// /// A Host from Datacenter 1 will become overloaded, @@ -89,7 +89,7 @@ /// Therefore, intra-datacenter migration is not possible /// and the next datacenter available will be tried next time. /// -/// The [VmAllocationPolicyMigrationFirstFitStaticThreshold] +/// The [VmPlacementPolicyMigrationFirstFitStaticThreshold] /// allows setting static under/over CPU utilization thresholds to /// enable VM migration. /// The example uses a [UtilizationModelDynamic] to define that CPU usage of cloudlets @@ -240,7 +240,7 @@ private void validateConfiguration() { } } - /// Creates an VmAllocationPolicy and sets an upper utilization threshold higher than the + /// Creates an VmPlacementPolicy and sets an upper utilization threshold higher than the /// [#HOST_OVER_UTILIZATION_THRESHOLD_FOR_VM_MIGRATION] /// to enable placing VMs which will use more CPU than /// defined by the value in the mentioned constant. @@ -248,9 +248,9 @@ private void validateConfiguration() { /// to the value of the constant. /// This is used to place VMs into a Host which will /// become overloaded in order to trigger the migration. - private VmAllocationPolicyMigration createVmAllocationPolicy() { + private VmPlacementPolicyMigration createVmPlacementPolicy() { final var vmSelection = new VmSelectionPolicyMinimumUtilization(); - final var vmAllocation = new VmAllocationPolicyMigrationFirstFitStaticThreshold(vmSelection, 0.9); + final var vmAllocation = new VmPlacementPolicyMigrationFirstFitStaticThreshold(vmSelection, 0.9); vmAllocation.setUnderUtilizationThreshold(HOST_UNDER_UTILIZATION_THRESHOLD_FOR_VM_MIGRATION); return vmAllocation; @@ -281,7 +281,7 @@ private void printHostStateHistory() { "%nHosts CPU usage History (when allocated MIPS is lower than requested one, it is due to VM migration overhead)"); datacenterList.stream() .map(Datacenter::getHostList).flatMap(List::stream) - .filter(h -> !h.getStateHistory().isEmpty()) + .filter(h -> !h.getStateHistory().getEntries().isEmpty()) .forEach(this::printHostStateHistory); } @@ -315,7 +315,7 @@ private void onVmsCreatedListener(final DatacenterBrokerEventInfo info) { System.out.printf("# %d VMs submitted to %s have been created. VMs: %s.%n", broker.getVmCreatedList().size(), broker, vmIds); datacenterList.stream() - .map(dc -> (VmAllocationPolicyMigrationFirstFitStaticThreshold)dc.getVmAllocationPolicy()) + .map(dc -> (VmPlacementPolicyMigrationFirstFitStaticThreshold)dc.getVmPlacementPolicy()) .forEach(policy -> policy.setOverUtilizationThreshold(HOST_OVER_UTILIZATION_THRESHOLD_FOR_VM_MIGRATION)); broker.removeOnVmsCreatedListener(info.getListener()); } @@ -422,7 +422,7 @@ private List createDatacenters() { private Datacenter createDatacenter(final int index) { final var distribution = index % 2 == 0 ? Distribution.PRIVATE : Distribution.PUBLIC; final var hostList = createHosts(DC_HOST_PES[index]); - final var allocationPolicy = createVmAllocationPolicy(); + final var allocationPolicy = createVmPlacementPolicy(); final var dc = new DatacenterSimple(simulation, hostList, allocationPolicy); dc.setSchedulingInterval(SCHEDULING_INTERVAL) .setHostSearchRetryDelay(HOST_SEARCH_RETRY_DELAY) diff --git a/src/main/java/org/cloudsimplus/examples/migration/ManualMigrationExample1.java b/src/main/java/org/cloudsimplus/examples/migration/ManualMigrationExample1.java index beaee96..306a57e 100755 --- a/src/main/java/org/cloudsimplus/examples/migration/ManualMigrationExample1.java +++ b/src/main/java/org/cloudsimplus/examples/migration/ManualMigrationExample1.java @@ -23,10 +23,10 @@ */ package org.cloudsimplus.examples.migration; -import org.cloudsimplus.allocationpolicies.VmAllocationPolicyFirstFit; -import org.cloudsimplus.allocationpolicies.migration.VmAllocationPolicyMigration; -import org.cloudsimplus.allocationpolicies.migration.VmAllocationPolicyMigrationAbstract; -import org.cloudsimplus.allocationpolicies.migration.VmAllocationPolicyMigrationBestFitStaticThreshold; +import org.cloudsimplus.placementpolicies.VmPlacementPolicyFirstFit; +import org.cloudsimplus.placementpolicies.migration.VmPlacementPolicyMigration; +import org.cloudsimplus.placementpolicies.migration.VmPlacementPolicyMigrationAbstract; +import org.cloudsimplus.placementpolicies.migration.VmPlacementPolicyMigrationBestFitStaticThreshold; import org.cloudsimplus.brokers.DatacenterBroker; import org.cloudsimplus.brokers.DatacenterBrokerSimple; import org.cloudsimplus.builders.tables.CloudletsTableBuilder; @@ -58,21 +58,21 @@ /// when the simulation reaches specific times. /// /// This is a manual migration, different when using some -/// [VmAllocationPolicyMigration] implementation. +/// [VmPlacementPolicyMigration] implementation. /// Such a policy automatically migrates VMs based on /// a static host CPU utilization threshold. /// In this example, such an implementation is not used /// and therefore, automatic VM migration based on CPU utilization threshold is not triggered. /// If you want to implement a VM migration policy, you should /// create a subclass from some of the existing ones. -/// Usually the starting point is the [VmAllocationPolicyMigrationAbstract] -/// but concrete implementations such as the [VmAllocationPolicyMigrationBestFitStaticThreshold] +/// Usually the starting point is the [VmPlacementPolicyMigrationAbstract] +/// but concrete implementations such as the [VmPlacementPolicyMigrationBestFitStaticThreshold] /// can be used as an example. /// /// VMs are initially placed into Hosts following the -/// [VmAllocationPolicyFirstFit] policy, which doesn't implement automatic VM +/// [VmPlacementPolicyFirstFit] policy, which doesn't implement automatic VM /// migration based on CPU utilization threshold. We call this VM as "manual migration" -/// exactly because we are not using a [VmAllocationPolicyMigration] implementation +/// exactly because we are not using a [VmPlacementPolicyMigration] implementation /// and the migration is defined by the simulation class itself. /// /// When the simulation clock reaches a specific time, @@ -179,13 +179,13 @@ private void clockTickListener(EventInfo info) { /// Prints the state of a Host along the simulation time. /// /// Realize that the Host State History is just collected - /// if [history is enabled][Host#isStateHistoryEnabled()] + /// if [history is enabled][org.cloudsimplus.hosts.HostStateHistory#isEnabled()] /// by calling [Host#setStateHistoryEnabled(boolean)]. /// /// @param host private void printHostHistory(Host host) { final boolean cpuUtilizationNotZero = - host.getStateHistory() + host.getStateHistory().getEntries() .stream() .map(HostStateHistoryEntry::percentUsage) .anyMatch(cpuUtilization -> cpuUtilization > 0); @@ -266,7 +266,7 @@ private Datacenter createDatacenter() { } System.out.println(); - final var dc = new DatacenterSimple(simulation, hostList, new VmAllocationPolicyFirstFit()); + final var dc = new DatacenterSimple(simulation, hostList, new VmPlacementPolicyFirstFit()); dc.setSchedulingInterval(SCHEDULING_INTERVAL); return dc; } diff --git a/src/main/java/org/cloudsimplus/examples/migration/MigrationExample1.java b/src/main/java/org/cloudsimplus/examples/migration/MigrationExample1.java index 1d10b5d..aac999f 100755 --- a/src/main/java/org/cloudsimplus/examples/migration/MigrationExample1.java +++ b/src/main/java/org/cloudsimplus/examples/migration/MigrationExample1.java @@ -24,8 +24,8 @@ package org.cloudsimplus.examples.migration; import ch.qos.logback.classic.Level; -import org.cloudsimplus.allocationpolicies.migration.VmAllocationPolicyMigrationBestFitStaticThreshold; -import org.cloudsimplus.allocationpolicies.migration.VmAllocationPolicyMigrationStaticThreshold; +import org.cloudsimplus.placementpolicies.migration.VmPlacementPolicyMigrationBestFitStaticThreshold; +import org.cloudsimplus.placementpolicies.migration.VmPlacementPolicyMigrationStaticThreshold; import org.cloudsimplus.brokers.DatacenterBroker; import org.cloudsimplus.brokers.DatacenterBrokerSimple; import org.cloudsimplus.builders.tables.CloudletsTableBuilder; @@ -55,6 +55,7 @@ import java.util.List; import static java.util.Comparator.comparingLong; +import static org.cloudsimplus.resources.Processor.totalMips; /// An example showing how to create 1 Datacenter having: 5 hosts /// with increasing number of PEs (starting at 4 PEs for the 1st host); @@ -62,10 +63,10 @@ /// and 1 cloudlet by VM, each one having the same number of PEs from its VM. /// /// The example then performs VM migration using -/// a [VmAllocationPolicyMigrationBestFitStaticThreshold]. +/// a [VmPlacementPolicyMigrationBestFitStaticThreshold]. /// Such a policy migrates VMs based on /// a static host CPU utilization threshold. -/// The VmAllocationPolicy used in this example ignores power consumption of Hosts. +/// The VmPlacementPolicy used in this example ignores power consumption of Hosts. /// This way, it isn't required to set a PowerModel for Hosts. /// /// According to the allocation policy, VM 0 will be allocated to Host 0. @@ -79,7 +80,7 @@ /// overreaching its upper utilization threshold (defined as 70%). /// This way, VMs 1 and 2 are allocated to Host 1 which has 5 PEs. /// -/// The [VmAllocationPolicyMigrationBestFitStaticThreshold] +/// The [VmPlacementPolicyMigrationBestFitStaticThreshold] /// allows setting static under/over CPU utilization thresholds to /// enable VM migration. /// The example uses a [UtilizationModelDynamic] to define that CPU usage of cloudlets @@ -174,7 +175,7 @@ public final class MigrationExample1 { private final DatacenterBrokerSimple broker; private final CloudSimPlus simulation; - private final VmAllocationPolicyMigrationStaticThreshold allocationPolicy; + private final VmPlacementPolicyMigrationStaticThreshold allocationPolicy; private final List hostList; private int migrationsNumber = 0; @@ -282,7 +283,7 @@ private void finishMigration(final VmHostEventInfo info) { private void showHostAllocatedMips(final double time, final Host host) { System.out.printf( "%.2f: %s allocated %.2f MIPS from %.2f total capacity%n", - time, host, host.getVmScheduler().getTotalAllocatedMips(), host.getTotalMipsCapacity()); + time, host, host.getVmScheduler().getTotalAllocatedMips(), totalMips(host)); } public void createAndSubmitCloudlets(DatacenterBroker broker) { @@ -391,14 +392,14 @@ private Datacenter createDatacenter() { for (Host host : hostList) { System.out.printf( "# Created %s with %.0f MIPS x %d PEs (%.0f total MIPS)%n", - host, host.getProcessor().getMips(), host.getProcessor().getCores(), host.getTotalMipsCapacity()); + host, host.getProcessor().getMips(), host.getProcessor().getCores(), totalMips(host)); } dc.setSchedulingInterval(SCHEDULING_INTERVAL) .setHostSearchRetryDelay(HOST_SEARCH_RETRY_DELAY); return dc; } - /// Creates a VmAllocationPolicy that + /// Creates a VmPlacementPolicy that /// sets an upper utilization threshold higher than the /// [#HOST_OVER_UTILIZATION_THRESHOLD_FOR_VM_MIGRATION] /// to enable placing VMs which will use more CPU than @@ -407,9 +408,9 @@ private Datacenter createDatacenter() { /// to the value of the constant. /// This is used to place VMs into a Host which will /// become overloaded in order to trigger the migration. - private VmAllocationPolicyMigrationStaticThreshold createAllocationPolicy() { + private VmPlacementPolicyMigrationStaticThreshold createAllocationPolicy() { final var policy = - new VmAllocationPolicyMigrationBestFitStaticThreshold( + new VmPlacementPolicyMigrationBestFitStaticThreshold( new VmSelectionPolicyMinimumUtilization(), HOST_OVER_UTILIZATION_THRESHOLD_FOR_VM_MIGRATION + 0.2); policy.setUnderUtilizationThreshold(HOST_UNDER_UTILIZATION_THRESHOLD_FOR_VM_MIGRATION); diff --git a/src/main/java/org/cloudsimplus/examples/migration/package-info.java b/src/main/java/org/cloudsimplus/examples/migration/package-info.java index 9dc6246..82ccaa9 100755 --- a/src/main/java/org/cloudsimplus/examples/migration/package-info.java +++ b/src/main/java/org/cloudsimplus/examples/migration/package-info.java @@ -22,7 +22,7 @@ * along with CloudSim Plus. If not, see . */ /// Examples showing how to enable VM migration -/// using a [org.cloudsimplus.allocationpolicies.migration.VmAllocationPolicyMigration]. +/// using a [org.cloudsimplus.placementpolicies.migration.VmPlacementPolicyMigration]. /// Such policies define the conditions when VM migration should be fired. /// /// @author Manoel Campos da Silva Filho diff --git a/src/main/java/org/cloudsimplus/examples/performance/PerformanceExample1.java b/src/main/java/org/cloudsimplus/examples/performance/PerformanceExample1.java index f32da91..25604e8 100755 --- a/src/main/java/org/cloudsimplus/examples/performance/PerformanceExample1.java +++ b/src/main/java/org/cloudsimplus/examples/performance/PerformanceExample1.java @@ -23,8 +23,8 @@ */ package org.cloudsimplus.examples.performance; -import org.cloudsimplus.allocationpolicies.VmAllocationPolicy; -import org.cloudsimplus.allocationpolicies.VmAllocationPolicyFirstFit; +import org.cloudsimplus.placementpolicies.VmPlacementPolicy; +import org.cloudsimplus.placementpolicies.VmPlacementPolicyFirstFit; import org.cloudsimplus.brokers.DatacenterBroker; import org.cloudsimplus.brokers.DatacenterBrokerSimple; import org.cloudsimplus.cloudlets.Cloudlet; @@ -58,7 +58,7 @@ /// check how they may drastically impact simulation performance. /// That includes the constants provided in this example /// (mainly the [#SCHEDULING_INTERVAL]), -/// and the type of [VmAllocationPolicy] and [CloudletScheduler] +/// and the type of [VmPlacementPolicy] and [CloudletScheduler] /// created. /// /// @author Manoel Campos da Silva Filho @@ -100,7 +100,7 @@ public class PerformanceExample1 { /// A [Supplier] Function that returns a new instance of a specific [CloudletScheduler]. private final Supplier cloudletSchedulerSupplier = CloudletSchedulerTimeShared::new; - private final VmAllocationPolicyFirstFit vmAllocationPolicy = new VmAllocationPolicyFirstFit(); + private final VmPlacementPolicyFirstFit vmPlacementPolicy = new VmPlacementPolicyFirstFit(); private final CloudSimPlus simulation; private final DatacenterBroker broker0; @@ -146,7 +146,7 @@ private Datacenter createDatacenter() { .collect(toCollection(() -> new ArrayList<>(HOSTS))); return new DatacenterSimple(simulation, hostList) - .setVmAllocationPolicy(vmAllocationPolicy) + .setVmPlacementPolicy(vmPlacementPolicy) .setSchedulingInterval(SCHEDULING_INTERVAL); } diff --git a/src/main/java/org/cloudsimplus/examples/performance/UtilizationModelFullPerformance.java b/src/main/java/org/cloudsimplus/examples/performance/UtilizationModelFullPerformance.java index c03055f..69a529d 100755 --- a/src/main/java/org/cloudsimplus/examples/performance/UtilizationModelFullPerformance.java +++ b/src/main/java/org/cloudsimplus/examples/performance/UtilizationModelFullPerformance.java @@ -23,8 +23,8 @@ */ package org.cloudsimplus.examples.performance; -import org.cloudsimplus.allocationpolicies.VmAllocationPolicy; -import org.cloudsimplus.allocationpolicies.VmAllocationPolicyFirstFit; +import org.cloudsimplus.placementpolicies.VmPlacementPolicy; +import org.cloudsimplus.placementpolicies.VmPlacementPolicyFirstFit; import org.cloudsimplus.brokers.DatacenterBroker; import org.cloudsimplus.brokers.DatacenterBrokerSimple; import org.cloudsimplus.cloudlets.Cloudlet; @@ -90,7 +90,7 @@ public class UtilizationModelFullPerformance { private static final int CLOUDLET_LENGTH = 10_000; private static final int SCHEDULING_INTERVAL = 0; - private static final VmAllocationPolicy VM_ALLOCATION_POLICY = new VmAllocationPolicyFirstFit(); + private static final VmPlacementPolicy VM_ALLOCATION_POLICY = new VmPlacementPolicyFirstFit(); private final CloudSimPlus simulation; private final DatacenterBroker broker0; @@ -124,7 +124,7 @@ private UtilizationModelFullPerformance() { final double execMinutes = TimeUtil.millisecsToMinutes(System.currentTimeMillis() - startMillis); System.out.printf("UtilizationModel: %s (single instance)%n%n", um.getClass().getSimpleName()); - System.out.println("| Execution time | Simulation time | Max Heap Used | VmAllocationPolicy | Hosts | VMs | Cloudlets | Cloudlet Len | DC Scheduling Interval |"); + System.out.println("| Execution time | Simulation time | Max Heap Used | VmPlacementPolicy | Hosts | VMs | Cloudlets | Cloudlet Len | DC Scheduling Interval |"); System.out.println("| ---------------|-----------------|---------------|--------------------|------------|------------|------------|--------------|------------------------|"); System.out.printf( "| %10.2f min | %11.2f min | %10.2f GB | %18s | %10d | %10d | %10d | %12d | %22d |", diff --git a/src/main/java/org/cloudsimplus/examples/performance/UtilizationModelStochasticPerformance.java b/src/main/java/org/cloudsimplus/examples/performance/UtilizationModelStochasticPerformance.java index d9200ea..c967eaa 100755 --- a/src/main/java/org/cloudsimplus/examples/performance/UtilizationModelStochasticPerformance.java +++ b/src/main/java/org/cloudsimplus/examples/performance/UtilizationModelStochasticPerformance.java @@ -23,8 +23,8 @@ */ package org.cloudsimplus.examples.performance; -import org.cloudsimplus.allocationpolicies.VmAllocationPolicy; -import org.cloudsimplus.allocationpolicies.VmAllocationPolicyFirstFit; +import org.cloudsimplus.placementpolicies.VmPlacementPolicy; +import org.cloudsimplus.placementpolicies.VmPlacementPolicyFirstFit; import org.cloudsimplus.brokers.DatacenterBroker; import org.cloudsimplus.brokers.DatacenterBrokerSimple; import org.cloudsimplus.cloudlets.Cloudlet; @@ -124,7 +124,7 @@ public class UtilizationModelStochasticPerformance { /// execution. Disabling this flag reduces simulation time and memory consumption. private static final boolean STORE_CLOUDLETS_CPU_UTILIZATION_HISTORY = true; - private static final VmAllocationPolicy VM_ALLOCATION_POLICY = new VmAllocationPolicyFirstFit(); + private static final VmPlacementPolicy VM_ALLOCATION_POLICY = new VmPlacementPolicyFirstFit(); private static final long SEED = 123456; private final CloudSimPlus simulation; @@ -164,7 +164,7 @@ private UtilizationModelStochasticPerformance() { "Multiple Utilization Models: %s | Store Utilization History: %s%n%n", MULTIPLE_UTILIZATION_MODELS, STORE_CLOUDLETS_CPU_UTILIZATION_HISTORY); - System.out.println("| Execution time | Simulation time | Max Heap Used | VmAllocationPolicy | Hosts | VMs | Cloudlets | Cloudlet Len | DC Scheduling Interval |"); + System.out.println("| Execution time | Simulation time | Max Heap Used | VmPlacementPolicy | Hosts | VMs | Cloudlets | Cloudlet Len | DC Scheduling Interval |"); System.out.println("| ---------------|-----------------|---------------|--------------------|------------|------------|------------|--------------|------------------------|"); System.out.printf( "| %10.2f min | %11.2f min | %10.2f GB | %18s | %10d | %10d | %10d | %12d | %22d |", diff --git a/src/main/java/org/cloudsimplus/examples/power/HostActivationExample.java b/src/main/java/org/cloudsimplus/examples/power/HostActivationExample.java index 567efea..6b36988 100755 --- a/src/main/java/org/cloudsimplus/examples/power/HostActivationExample.java +++ b/src/main/java/org/cloudsimplus/examples/power/HostActivationExample.java @@ -23,8 +23,8 @@ */ package org.cloudsimplus.examples.power; -import org.cloudsimplus.allocationpolicies.VmAllocationPolicy; -import org.cloudsimplus.allocationpolicies.VmAllocationPolicyBestFit; +import org.cloudsimplus.placementpolicies.VmPlacementPolicy; +import org.cloudsimplus.placementpolicies.VmPlacementPolicyBestFit; import org.cloudsimplus.brokers.DatacenterBroker; import org.cloudsimplus.brokers.DatacenterBrokerSimple; import org.cloudsimplus.builders.tables.CloudletsTableBuilder; @@ -52,8 +52,8 @@ import java.util.function.Function; /// An example showing how to create a Datacenter with all Hosts powered off -/// and let the [VmAllocationPolicy] to power Hosts on and off according to demand. -/// For this simulation, the [VmAllocationPolicyBestFit] is used. +/// and let the [VmPlacementPolicy] to power Hosts on and off according to demand. +/// For this simulation, the [VmPlacementPolicyBestFit] is used. /// /// The dynamic demand for Hosts is simulated /// by creating VMs during simulation runtime. @@ -259,7 +259,7 @@ private Datacenter createDatacenter() { hostList.add(host); } - final var dc = new DatacenterSimple(simulation, hostList, new VmAllocationPolicyBestFit()); + final var dc = new DatacenterSimple(simulation, hostList, new VmPlacementPolicyBestFit()); dc.setSchedulingInterval(SCHEDULING_INTERVAL); return dc; } diff --git a/src/main/java/org/cloudsimplus/examples/resourceusage/HostsCpuUsageExample.java b/src/main/java/org/cloudsimplus/examples/resourceusage/HostsCpuUsageExample.java index 4fa6a49..9640d70 100755 --- a/src/main/java/org/cloudsimplus/examples/resourceusage/HostsCpuUsageExample.java +++ b/src/main/java/org/cloudsimplus/examples/resourceusage/HostsCpuUsageExample.java @@ -44,6 +44,8 @@ import java.util.ArrayList; import java.util.List; +import static org.cloudsimplus.resources.Processor.totalMips; + /// An example showing how to create a Datacenter with two hosts, /// with one Vm in each one, and run 1 cloudlet in each Vm. /// At the end, it shows the total CPU utilization of hosts @@ -148,7 +150,7 @@ private Vm createVm(final int pesNumber, final long mips) { /// Shows CPU utilization mean of all hosts into a given Datacenter. private void printCpuUtilizationForAllHosts() { for (final var host : hostList) { - final double mipsByPe = host.getTotalMipsCapacity() / (double)host.getProcessor().getCores(); + final double mipsByPe = totalMips(host) / (double)host.getProcessor().getCores(); final double cpuUsageMean = host.getCpuUtilizationStats().getMean()*100; System.out.printf( "\tHost %d: PEs number: %2d MIPS by PE: %.0f CPU Utilization mean: %6.2f%%%n", diff --git a/src/main/java/org/cloudsimplus/examples/resourceusage/VirtualMemoryForRequestedRamHigherThanAvailableExample.java b/src/main/java/org/cloudsimplus/examples/resourceusage/VirtualMemoryForRequestedRamHigherThanAvailableExample.java index ada7e33..0ef5f8a 100755 --- a/src/main/java/org/cloudsimplus/examples/resourceusage/VirtualMemoryForRequestedRamHigherThanAvailableExample.java +++ b/src/main/java/org/cloudsimplus/examples/resourceusage/VirtualMemoryForRequestedRamHigherThanAvailableExample.java @@ -207,7 +207,7 @@ private Datacenter createDatacenter() { hostList.add(host); } - //Uses a VmAllocationPolicySimple by default to allocate VMs + //Uses a VmPlacementPolicySimple by default to place VMs final var dc = new DatacenterSimple(simulation, hostList); dc.setSchedulingInterval(SCHEDULING_INTERVAL); return dc; @@ -224,7 +224,7 @@ private Host createHost() { hardDrive.setAvgSeekTime(0).setLatency(0).setMaxTransferRate(HOSTS_MAX_TRANSFER_RATE); /* - Uses ResourceProvisionerSimple by default for RAM and BW provisioning + Uses ResourceAllocatorSimple by default for RAM and BW allocation and VmSchedulerSpaceShared for VM scheduling. */ return new HostSimple(HOST_RAM, bw, hardDrive, HOST_CAPACITY); diff --git a/src/main/java/org/cloudsimplus/examples/resourceusage/VmRelativeHostResourceUtilizationExample.java b/src/main/java/org/cloudsimplus/examples/resourceusage/VmRelativeHostResourceUtilizationExample.java index 00a69c2..b3cef7e 100755 --- a/src/main/java/org/cloudsimplus/examples/resourceusage/VmRelativeHostResourceUtilizationExample.java +++ b/src/main/java/org/cloudsimplus/examples/resourceusage/VmRelativeHostResourceUtilizationExample.java @@ -124,8 +124,8 @@ private void onClockTick(final EventInfo info) { System.out.printf( "Host %-2d Total Utilization: %5.0f%% | %5.0f%% | %5.0f%%%n%n", host.getId(),host.getCpuPercentUtilization()*100, - host.getRam().getPercentUtilization()*100, - host.getBw().getPercentUtilization()*100); + host.getRam().getPercentOccupied()*100, + host.getBw().getPercentOccupied()*100); } } @@ -143,7 +143,7 @@ private Host createHost() { final long storage = 1000000; //in Megabytes /* - Uses ResourceProvisionerSimple by default for RAM and BW provisioning + Uses ResourceAllocatorSimple by default for RAM and BW allocation and VmSchedulerSpaceShared for VM scheduling. */ return new HostSimple(HOST_RAM, HOST_BW, storage, HOST_CAPACITY); diff --git a/src/main/java/org/cloudsimplus/examples/resourceusage/VmsCpuUsageExample.java b/src/main/java/org/cloudsimplus/examples/resourceusage/VmsCpuUsageExample.java index 08b4d61..05a6bfe 100755 --- a/src/main/java/org/cloudsimplus/examples/resourceusage/VmsCpuUsageExample.java +++ b/src/main/java/org/cloudsimplus/examples/resourceusage/VmsCpuUsageExample.java @@ -34,7 +34,7 @@ import org.cloudsimplus.datacenters.DatacenterSimple; import org.cloudsimplus.hosts.Host; import org.cloudsimplus.hosts.HostSimple; -import org.cloudsimplus.provisioners.ResourceProvisionerSimple; +import org.cloudsimplus.allocators.ResourceAllocatorSimple; import org.cloudsimplus.resources.CoreCapacity; import org.cloudsimplus.schedulers.cloudlet.CloudletSchedulerTimeShared; import org.cloudsimplus.schedulers.vm.VmSchedulerTimeShared; @@ -183,8 +183,8 @@ private static Host createHost(final int id, final int pesNumber, final long mip final var host = new HostSimple(ram, bw, storage, cpuCapacity) .setId(id) .setStateHistoryEnabled(true) - .setRamProvisioner(new ResourceProvisionerSimple()) - .setBwProvisioner(new ResourceProvisionerSimple()) + .setRamAllocator(new ResourceAllocatorSimple()) + .setBwAllocator(new ResourceAllocatorSimple()) .setVmScheduler(new VmSchedulerTimeShared()); return host; } diff --git a/src/main/java/org/cloudsimplus/examples/resourceusage/VmsRamAndBwUsageExample.java b/src/main/java/org/cloudsimplus/examples/resourceusage/VmsRamAndBwUsageExample.java index 2b7da7f..d483db9 100755 --- a/src/main/java/org/cloudsimplus/examples/resourceusage/VmsRamAndBwUsageExample.java +++ b/src/main/java/org/cloudsimplus/examples/resourceusage/VmsRamAndBwUsageExample.java @@ -206,7 +206,7 @@ private void collectVmResourceUtilization(final Map> all * The key of this map is the time the usage was collected (in seconds) * and the value the percentage of utilization (from 0 to 1). */ final Map vmUtilizationHistory = Objects.requireNonNull(allVmsUtilizationHistory.get(vm)); - vmUtilizationHistory.put(simulation.clock(), vm.getResource(resourceClass).getPercentUtilization()); + vmUtilizationHistory.put(simulation.clock(), vm.getResource(resourceClass).getPercentOccupied()); } } diff --git a/src/main/java/org/cloudsimplus/examples/schedulers/CloudletSchedulerSpaceSharedExample1.java b/src/main/java/org/cloudsimplus/examples/schedulers/CloudletSchedulerSpaceSharedExample1.java index 12234e5..03e91f1 100755 --- a/src/main/java/org/cloudsimplus/examples/schedulers/CloudletSchedulerSpaceSharedExample1.java +++ b/src/main/java/org/cloudsimplus/examples/schedulers/CloudletSchedulerSpaceSharedExample1.java @@ -23,7 +23,7 @@ */ package org.cloudsimplus.examples.schedulers; -import org.cloudsimplus.allocationpolicies.VmAllocationPolicySimple; +import org.cloudsimplus.placementpolicies.VmPlacementPolicySimple; import org.cloudsimplus.brokers.DatacenterBroker; import org.cloudsimplus.brokers.DatacenterBrokerSimple; import org.cloudsimplus.builders.tables.CloudletsTableBuilder; @@ -34,7 +34,7 @@ import org.cloudsimplus.datacenters.DatacenterSimple; import org.cloudsimplus.hosts.Host; import org.cloudsimplus.hosts.HostSimple; -import org.cloudsimplus.provisioners.ResourceProvisionerSimple; +import org.cloudsimplus.allocators.ResourceAllocatorSimple; import org.cloudsimplus.resources.CoreCapacity; import org.cloudsimplus.schedulers.cloudlet.CloudletSchedulerSpaceShared; import org.cloudsimplus.schedulers.vm.VmSchedulerTimeShared; @@ -107,7 +107,7 @@ private CloudletSchedulerSpaceSharedExample1() { new CloudletsTableBuilder(cloudletFinishedListList).build(); } - /// Creates a Datacenter that uses a [VmAllocationPolicySimple] by default. + /// Creates a Datacenter that uses a [VmPlacementPolicySimple] by default. private Datacenter createDatacenter() { final var hostList = new ArrayList(HOSTS); for(int h = 0; h < HOSTS; h++) { @@ -118,7 +118,7 @@ private Datacenter createDatacenter() { return new DatacenterSimple(simulation, hostList); } - /// Creates a Host that uses a [ResourceProvisionerSimple] by default + /// Creates a Host that uses a [ResourceAllocatorSimple] by default /// for RAM and BW. private Host createHost() { final long ram = 2048; //in Megabytes diff --git a/src/main/java/org/cloudsimplus/examples/schedulers/TwoCloudletsAndOneTimeSharedVmExample.java b/src/main/java/org/cloudsimplus/examples/schedulers/TwoCloudletsAndOneTimeSharedVmExample.java index eb61b71..00d9ac1 100755 --- a/src/main/java/org/cloudsimplus/examples/schedulers/TwoCloudletsAndOneTimeSharedVmExample.java +++ b/src/main/java/org/cloudsimplus/examples/schedulers/TwoCloudletsAndOneTimeSharedVmExample.java @@ -32,7 +32,7 @@ import org.cloudsimplus.datacenters.DatacenterSimple; import org.cloudsimplus.hosts.Host; import org.cloudsimplus.hosts.HostSimple; -import org.cloudsimplus.provisioners.ResourceProvisionerSimple; +import org.cloudsimplus.allocators.ResourceAllocatorSimple; import org.cloudsimplus.resources.CoreCapacity; import org.cloudsimplus.schedulers.cloudlet.CloudletSchedulerTimeShared; import org.cloudsimplus.schedulers.vm.VmSchedulerTimeShared; @@ -151,8 +151,8 @@ private Datacenter createDatacenter() { final long bw = 100000; //in Megabytes final long storage = 10000000; //in Megabytes final var host = new HostSimple(ram, bw, storage, cpuCapacity) - .setRamProvisioner(new ResourceProvisionerSimple()) - .setBwProvisioner(new ResourceProvisionerSimple()) + .setRamAllocator(new ResourceAllocatorSimple()) + .setBwAllocator(new ResourceAllocatorSimple()) .setVmScheduler(new VmSchedulerTimeShared()); hostList.add(host); diff --git a/src/main/java/org/cloudsimplus/examples/schedulers/VmSchedulerTimeSharedExample.java b/src/main/java/org/cloudsimplus/examples/schedulers/VmSchedulerTimeSharedExample.java index 476faa0..3100a06 100755 --- a/src/main/java/org/cloudsimplus/examples/schedulers/VmSchedulerTimeSharedExample.java +++ b/src/main/java/org/cloudsimplus/examples/schedulers/VmSchedulerTimeSharedExample.java @@ -23,7 +23,7 @@ */ package org.cloudsimplus.examples.schedulers; -import org.cloudsimplus.allocationpolicies.VmAllocationPolicyFirstFit; +import org.cloudsimplus.placementpolicies.VmPlacementPolicyFirstFit; import org.cloudsimplus.brokers.DatacenterBroker; import org.cloudsimplus.brokers.DatacenterBrokerSimple; import org.cloudsimplus.builders.tables.CloudletsTableBuilder; @@ -44,6 +44,8 @@ import java.util.ArrayList; import java.util.List; +import static org.cloudsimplus.resources.Processor.totalMips; + /// An example showing the usage of the [VmSchedulerTimeShared] /// which allows multiple VMs to use the same PEs from a Host, /// provided those PEs have available MIPS capacity. @@ -140,7 +142,7 @@ private VmSchedulerTimeSharedExample() { simulation.start(); new CloudletsTableBuilder(broker0.getCloudletFinishedList()) - .addColumn(new TextTableColumn("Host MIPS", "total"), c -> c.getVm().getHost().getTotalMipsCapacity(), 5) + .addColumn(new TextTableColumn("Host MIPS", "total"), c -> totalMips(c.getVm().getHost()), 5) .addColumn(new TextTableColumn("VM MIPS", "total"), c -> c.getVm().getTotalMipsCapacity(), 8) .addColumn(new TextTableColumn(" VM MIPS", "requested"), this::getVmRequestedMips, 9) .addColumn(new TextTableColumn(" VM MIPS", "allocated"), this::getVmAllocatedMips, 10) @@ -162,7 +164,7 @@ private VmSchedulerTimeSharedExample() { private void printHostStateHistory(Host host) { System.out.printf("Host: %d%n", host.getId()); System.out.println("-----------------------------------------------------------------------------------------------------"); - host.getStateHistory().stream().forEach(System.out::print); + host.getStateHistory().getEntries().forEach(System.out::print); System.out.println(); } @@ -189,7 +191,7 @@ private void createDatacenter() { hostList.add(host); } - Datacenter dc0 = new DatacenterSimple(simulation, hostList, new VmAllocationPolicyFirstFit()); + Datacenter dc0 = new DatacenterSimple(simulation, hostList, new VmPlacementPolicyFirstFit()); dc0.setSchedulingInterval(SCHEDULING_INTERVAL); } diff --git a/src/main/java/org/cloudsimplus/examples/simulationstatus/TerminateSimulationAtGivenConditionExample.java b/src/main/java/org/cloudsimplus/examples/simulationstatus/TerminateSimulationAtGivenConditionExample.java index f4b9a7a..6d39f7c 100755 --- a/src/main/java/org/cloudsimplus/examples/simulationstatus/TerminateSimulationAtGivenConditionExample.java +++ b/src/main/java/org/cloudsimplus/examples/simulationstatus/TerminateSimulationAtGivenConditionExample.java @@ -34,7 +34,7 @@ import org.cloudsimplus.hosts.HostSimple; import org.cloudsimplus.listeners.CloudletVmEventInfo; import org.cloudsimplus.listeners.EventListener; -import org.cloudsimplus.provisioners.ResourceProvisionerSimple; +import org.cloudsimplus.allocators.ResourceAllocatorSimple; import org.cloudsimplus.resources.CoreCapacity; import org.cloudsimplus.schedulers.cloudlet.CloudletSchedulerSpaceShared; import org.cloudsimplus.schedulers.vm.VmSchedulerTimeShared; @@ -150,8 +150,8 @@ private Host createHost() { final var cpuCapacity = new CoreCapacity(1, mips); return new HostSimple(ram, bw, storage, cpuCapacity) - .setRamProvisioner(new ResourceProvisionerSimple()) - .setBwProvisioner(new ResourceProvisionerSimple()) + .setRamAllocator(new ResourceAllocatorSimple()) + .setBwAllocator(new ResourceAllocatorSimple()) .setVmScheduler(new VmSchedulerTimeShared()); } diff --git a/src/main/java/org/cloudsimplus/examples/sla/VmMigrationWhenCpuMetricIsViolatedExample.java b/src/main/java/org/cloudsimplus/examples/sla/VmMigrationWhenCpuMetricIsViolatedExample.java index 856c273..c887351 100755 --- a/src/main/java/org/cloudsimplus/examples/sla/VmMigrationWhenCpuMetricIsViolatedExample.java +++ b/src/main/java/org/cloudsimplus/examples/sla/VmMigrationWhenCpuMetricIsViolatedExample.java @@ -23,7 +23,7 @@ */ package org.cloudsimplus.examples.sla; -import org.cloudsimplus.allocationpolicies.migration.VmAllocationPolicyMigrationWorstFitStaticThreshold; +import org.cloudsimplus.placementpolicies.migration.VmPlacementPolicyMigrationWorstFitStaticThreshold; import org.cloudsimplus.brokers.DatacenterBroker; import org.cloudsimplus.brokers.DatacenterBrokerSimple; import org.cloudsimplus.builders.tables.CloudletsTableBuilder; @@ -35,7 +35,7 @@ import org.cloudsimplus.hosts.Host; import org.cloudsimplus.hosts.HostSimple; import org.cloudsimplus.power.models.PowerModelHostSimple; -import org.cloudsimplus.provisioners.ResourceProvisionerSimple; +import org.cloudsimplus.allocators.ResourceAllocatorSimple; import org.cloudsimplus.resources.CoreCapacity; import org.cloudsimplus.schedulers.cloudlet.CloudletSchedulerTimeShared; import org.cloudsimplus.schedulers.vm.VmSchedulerTimeShared; @@ -263,7 +263,7 @@ private Datacenter createDatacenter() { System.out.println(); final var allocationPolicy - = new VmAllocationPolicyMigrationWorstFitStaticThreshold( + = new VmPlacementPolicyMigrationWorstFitStaticThreshold( new VmSelectionPolicyMinimumUtilization(), contract.getCpuUtilizationMetric().getMaxDimension().getValue()); allocationPolicy.setUnderUtilizationThreshold(contract.getCpuUtilizationMetric().getMinDimension().getValue()); @@ -277,8 +277,8 @@ private Host createHost(final int pesNumber, final long mipsByPe) { final var cpuCapacity = new CoreCapacity(pesNumber, mipsByPe); final var host = new HostSimple(HOST_RAM, HOST_BW, HOST_STORAGE, cpuCapacity); host.setPowerModel(new PowerModelHostSimple(1000, 700)); - host.setRamProvisioner(new ResourceProvisionerSimple()); - host.setBwProvisioner(new ResourceProvisionerSimple()); + host.setRamAllocator(new ResourceAllocatorSimple()); + host.setBwAllocator(new ResourceAllocatorSimple()); host.setVmScheduler(new VmSchedulerTimeShared()); return host; } diff --git a/src/main/java/org/cloudsimplus/examples/synchronous/SynchronousSimulationExample1.java b/src/main/java/org/cloudsimplus/examples/synchronous/SynchronousSimulationExample1.java index 9a92360..2123d4b 100755 --- a/src/main/java/org/cloudsimplus/examples/synchronous/SynchronousSimulationExample1.java +++ b/src/main/java/org/cloudsimplus/examples/synchronous/SynchronousSimulationExample1.java @@ -160,7 +160,7 @@ private Datacenter createDatacenter() { hostList.add(host); } - //Uses a VmAllocationPolicySimple by default to allocate VMs + //Uses a VmPlacementPolicySimple by default to place VMs return new DatacenterSimple(simulation, hostList); } @@ -170,7 +170,7 @@ private Host createHost() { final long storage = 1000000; //in Megabytes /* - Uses ResourceProvisionerSimple by default for RAM and BW provisioning + Uses ResourceAllocatorSimple by default for RAM and BW allocation and VmSchedulerSpaceShared for VM scheduling. */ return new HostSimple(ram, bw, storage, HOST_CAPACITY); diff --git a/src/main/java/org/cloudsimplus/examples/traces/PlanetLabExample1.java b/src/main/java/org/cloudsimplus/examples/traces/PlanetLabExample1.java index 0f02e39..be02385 100755 --- a/src/main/java/org/cloudsimplus/examples/traces/PlanetLabExample1.java +++ b/src/main/java/org/cloudsimplus/examples/traces/PlanetLabExample1.java @@ -33,7 +33,7 @@ import org.cloudsimplus.datacenters.DatacenterSimple; import org.cloudsimplus.hosts.Host; import org.cloudsimplus.hosts.HostSimple; -import org.cloudsimplus.provisioners.ResourceProvisionerSimple; +import org.cloudsimplus.allocators.ResourceAllocatorSimple; import org.cloudsimplus.resources.CoreCapacity; import org.cloudsimplus.schedulers.cloudlet.CloudletSchedulerTimeShared; import org.cloudsimplus.schedulers.vm.VmSchedulerTimeShared; @@ -145,8 +145,8 @@ private Host createHost() { final long storage = 1000000; //in Megabytes final var host = new HostSimple(ram, bw, storage, HOST_CAPACITY); host - .setRamProvisioner(new ResourceProvisionerSimple()) - .setBwProvisioner(new ResourceProvisionerSimple()) + .setRamAllocator(new ResourceAllocatorSimple()) + .setBwAllocator(new ResourceAllocatorSimple()) .setVmScheduler(new VmSchedulerTimeShared()); return host; } diff --git a/src/main/java/org/cloudsimplus/examples/traces/SwfWorkloadFormatExample1.java b/src/main/java/org/cloudsimplus/examples/traces/SwfWorkloadFormatExample1.java index fd09fe7..2234ad8 100755 --- a/src/main/java/org/cloudsimplus/examples/traces/SwfWorkloadFormatExample1.java +++ b/src/main/java/org/cloudsimplus/examples/traces/SwfWorkloadFormatExample1.java @@ -23,7 +23,7 @@ */ package org.cloudsimplus.examples.traces; -import org.cloudsimplus.allocationpolicies.VmAllocationPolicyFirstFit; +import org.cloudsimplus.placementpolicies.VmPlacementPolicyFirstFit; import org.cloudsimplus.brokers.DatacenterBroker; import org.cloudsimplus.brokers.DatacenterBrokerSimple; import org.cloudsimplus.builders.tables.CloudletsTableBuilder; @@ -197,7 +197,7 @@ private void createCloudletsFromWorkloadFile() { /// @return the created Datacenter private Datacenter createDatacenter() { final var hostList = createHosts(vmlist.size()/2); - var datacenter = new DatacenterSimple(simulation, hostList, new VmAllocationPolicyFirstFit()); + var datacenter = new DatacenterSimple(simulation, hostList, new VmPlacementPolicyFirstFit()); System.out.printf("# Added %12d Hosts to %s%n", hostList.size(), datacenter); return datacenter; diff --git a/src/main/java/org/cloudsimplus/examples/traces/google/GoogleMachineEventsExample1.java b/src/main/java/org/cloudsimplus/examples/traces/google/GoogleMachineEventsExample1.java index fe051ef..b8b1b8c 100755 --- a/src/main/java/org/cloudsimplus/examples/traces/google/GoogleMachineEventsExample1.java +++ b/src/main/java/org/cloudsimplus/examples/traces/google/GoogleMachineEventsExample1.java @@ -23,7 +23,7 @@ */ package org.cloudsimplus.examples.traces.google; -import org.cloudsimplus.allocationpolicies.VmAllocationPolicySimple; +import org.cloudsimplus.placementpolicies.VmPlacementPolicySimple; import org.cloudsimplus.brokers.DatacenterBroker; import org.cloudsimplus.brokers.DatacenterBrokerSimple; import org.cloudsimplus.builders.tables.CloudletsTableBuilder; @@ -145,7 +145,7 @@ private void createDatacenters() { //Creates Datacenters with no hosts. for(int i = 0; i < DATACENTERS_NUMBER; i++){ - datacenters.add(new DatacenterSimple(simulation, new VmAllocationPolicySimple())); + datacenters.add(new DatacenterSimple(simulation, new VmPlacementPolicySimple())); } /*Process the trace file and creates the Hosts that the timestamp is defined as zero inside the file. diff --git a/src/main/java/org/cloudsimplus/examples/traces/google/GoogleTaskEventsExample1.java b/src/main/java/org/cloudsimplus/examples/traces/google/GoogleTaskEventsExample1.java index 82ddddc..98f1a60 100755 --- a/src/main/java/org/cloudsimplus/examples/traces/google/GoogleTaskEventsExample1.java +++ b/src/main/java/org/cloudsimplus/examples/traces/google/GoogleTaskEventsExample1.java @@ -245,7 +245,7 @@ private Datacenter createDatacenter() { hostList.add(createHost()); } - //Uses a VmAllocationPolicySimple by default + //Uses a VmPlacementPolicySimple by default return new DatacenterSimple(simulation, hostList); } @@ -258,7 +258,7 @@ private long getCloudletSizeInMB(final Cloudlet cloudlet) { } private Host createHost() { - //Uses a ResourceProvisionerSimple for RAM and BW + //Uses a ResourceAllocatorSimple for RAM and BW final Host host = new HostSimple(HOST_RAM, HOST_BW, HOST_STORAGE, HOST_CAPACITY); host.setVmScheduler(new VmSchedulerTimeShared()); return host;