Class VmSimple
- All Implemented Interfaces:
Comparable<Vm>
,AbstractMachine<Resource>
,ChangeableId
,CustomerEntity
,Delayable
,Identifiable
,ResourceStatsComputer<VmResourceStats>
,UniquelyIdentifiable
,TimeZoned
,Resourceful
,Vm
Host
that may be shared among other VMs. It processes
cloudlets
. This processing happens according to a policy,
defined by the CloudletScheduler
. Each VM has a owner (user), which
can submit cloudlets to the VM to execute them.- Since:
- CloudSim Toolkit 1.0
- Author:
- Rodrigo N. Calheiros, Anton Beloglazov
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionVmSimple
(double mipsCapacity, long numberOfPes) Creates a Vm with 1024 MEGA of RAM, 100 Megabits/s of Bandwidth and 1024 MEGA of Storage Size.VmSimple
(double mipsCapacity, long numberOfPes, CloudletScheduler cloudletScheduler) Creates a Vm with 1024 MEGA of RAM, 100 Megabits/s of Bandwidth and 1024 MEGA of Storage Size.VmSimple
(long id, double mipsCapacity, long numberOfPes) Creates a Vm with 1024 MEGA of RAM, 100 Megabits/s of Bandwidth and 1024 MEGA of Storage Size.VmSimple
(long id, long mipsCapacity, long numberOfPes) Creates a Vm with 1024 MEGA of RAM, 100 Megabits/s of Bandwidth and 1024 MEGA of Storage Size.A copy constructor that creates a VM based on the configuration of another one. -
Method Summary
Modifier and TypeMethodDescriptionaddExpectedFreePesNumber
(long pesToAdd) Adds a given number of expected free PEs to the total number of expected free PEs.Adds a listener object that will be notified when the Vm fail in being placed for lack of aHost
with enough resources in a specificDatacenter
.Adds a listener object that will be notified when aHost
is allocated to the Vm, that is, when the Vm is placed into a given Host.Adds a listener object that will be notified when the Vm is moved/removed from aHost
.Adds a listener object that will be notified when a VM finishes migrating to a targetHost
.Adds a listener object that will be notified when a VM starts migrating to a targetHost
.Adds a listener object that will be notified every time when the processing of the Vm is updated in itsHost
.void
Adds a VM state history entry.int
Compare this Vm with another one based ongetTotalMipsCapacity()
.void
Enables the data collection and computation of utilization statistics.getBw()
Gets bandwidth resource (in Megabits/s) assigned to the Vm, allowing to check its capacity and usage.Gets aVerticalVmScaling
that will check if the Vm's Bandwidth is overloaded, based on some conditions defined by aPredicate
given to the VerticalVmScaling, and then request the BW up scaling.Gets the Cloudlet scheduler the VM uses to schedule cloudlets execution.double
Gets the percentage of CPU capacity (MIPS %) requested by all Cloudlets running on this VM at the current time.double
getCpuPercentRequested
(double time) Gets the percentage of CPU capacity (MIPS %) requested by all Cloudlets running on this VM at the given time.double
Gets the current percentage of CPU capacity (MIPS %) used by all Cloudlets running on this VM.double
getCpuPercentUtilization
(double time) Gets the percentage of CPU capacity (MIPS %) used by all Cloudlets running on this VM at the given time.Gets machine's CPU utilization percentage statistics (between [0 and 1]).long
Gets the current requested bw.Gets a copy list of current requested MIPS of each virtualPe
, avoiding the original list to be changed.long
Gets the current requested ram (in Megabytes).static long
Gets the Default Bandwidth capacity (in Mbps) for creating VMs.static long
Gets the Default RAM capacity (in MB) for creating VMs.static long
Gets the Default Storage capacity (in MB) for creating VMs.Gets the Vm description, which is an optional text which one can use to provide details about this of this VM.long
Gets the expected free pes number before the VM starts executing.double
getExpectedHostCpuUtilization
(double vmCpuUtilizationPercent) Computes what would be the relative percentage of the CPU the VM is using from a PM's total MIPS Capacity, considering that the VM 's CPU load is at a given percentage.long
Gets the current number of free PEs.getGroup()
Gets thegroup
this Vm belongs toGets aHorizontalVmScaling
that will check if the Vm is overloaded, based on some conditions defined by aPredicate
given to the HorizontalVmScaling, and then request the creation of new VMs to horizontally scale the Vm.getHost()
Gets theHost
where the Vm is or will be placed.double
Computes the relative percentage of the Bandwidth the VM is using from the Host's total Capacity for the current simulation time.double
getHostCpuUtilization
(double time) Computes the relative percentage of the CPU the VM is using from the Host's total MIPS Capacity for the current simulation time.double
Computes the relative percentage of the RAM the VM is using from the Host's total Capacity for the current simulation time.double
Gets the last time the Machine was running some process.double
getMips()
Gets the individual MIPS capacity of any machine'sPe
, considering that all PEs have the same capacity.long
Gets the overall number ofPe
s the machine has, that include PEs of all statuses, including failed PEs.Gets aVerticalVmScaling
that will check if the Vm'sPe
is overloaded, based on some conditions defined by aPredicate
given to the VerticalVmScaling, and then request the RAM up scaling.Gets theProcessor
of this VM.getRam()
Gets the RAM resource assigned to the Vm, allowing to check its capacity (in Megabytes) and usage.Gets aVerticalVmScaling
that will check if the Vm's RAM is overloaded, based on some conditions defined by aPredicate
given to the VerticalVmScaling, and then request the RAM up scaling.getResource
(Class<? extends ResourceManageable> resourceClass) Gets a givenAbstractMachine
Resource
, such asRam
orBandwidth
, from the List of machine resources.Gets a read-only list of resources the machine has.double
Gets the last time the machine was started up (in seconds).Gets a read-only list with the history of requests and allocation of MIPS for this VM.double
Gets the time the VM was destroyed into the last Host it executed (in seconds).Gets the storage device of the VM, which represents the VM image, allowing to check its capacity (in Megabytes) and usage.double
Gets the time (in seconds) that aDatacenterBroker
will wait to submit the entity to a Datacenter, in order to request the creation of the object.double
Gets the time zone offset, a value between [-12 and 12], in which the VM is expected to be placed (if there is aDatacenter
with enough capacity available at that timezone).double
Gets the current requested total MIPS.double
Gets the current total CPU MIPS utilization of all PEs from all cloudlets running on this VM.double
getTotalCpuMipsUtilization
(double time) Gets the total CPU MIPS utilization of all PEs from all cloudlets running on this VM at the given time.double
Gets the total time (in seconds) the Vm spent executing.double
Gets total MIPS capacity of all PEs of the machine.getVmm()
Gets the Virtual Machine Monitor (VMM) that manages the VM.boolean
Checks if the VM has ever started some Cloudlet.final boolean
Checks if the VM was created and placed inside theHost
.boolean
Checks if this object has a submission delay or notboolean
isFailed()
Checks if the Vm is failed or not.boolean
Checks if the VM is in migration process or not, that is, if it is migrating in or out of a Host.boolean
isSuitableForCloudlet
(Cloudlet cloudlet) Checks if the VM has enough capacity to run a Cloudlet.boolean
Checks if the Vm is working or failed.void
notifyOnCreationFailureListeners
(Datacenter failedDatacenter) Notifies all registered listeners when the Vm fail in being placed for lack of aHost
with enough resources in a specificDatacenter
.void
void
notifyOnHostDeallocationListeners
(Host deallocatedHost) void
Notifies all registered listeners when the processing of the Vm is updated in itsHost
.removeExpectedFreePesNumber
(long pesToRemove) Adds a given number of expected free PEs to the total number of expected free PEs.boolean
Removes a listener from the onVmCreationFailureListener List.boolean
Removes a listener from the onHostAllocationListener List.boolean
Removes a listener from the onHostDeallocationListener List.boolean
Removes a listener from the onMigrationFinishListener List.boolean
Removes a listener from the onMigrationStartListener List.boolean
Removes a listener from the onUpdateVmProcessingListener List.void
setAllocatedMips
(MipsShare allocatedMips) final Vm
setBw
(long bwCapacity) Sets the bandwidth capacity (in Megabits/s)final Vm
setBwVerticalScaling
(VerticalVmScaling bwVerticalScaling) Sets aVerticalVmScaling
that will check if the Vm'sBandwidth
is under or overloaded, based on some conditions defined byPredicate
s given to the VerticalVmScaling, and then request the Bandwidth up or down scaling.final Vm
setCloudletScheduler
(CloudletScheduler cloudletScheduler) Sets the Cloudlet scheduler the Vm uses to schedule cloudlets execution.void
void
setCreated
(boolean created) Changes the created status of the Vm inside the Host.static void
setDefaultBwCapacity
(long defaultCapacity) Sets the Default Bandwidth capacity (in Mbps) for creating VMs.static void
setDefaultRamCapacity
(long defaultCapacity) Sets the Default RAM capacity (in MB) for creating VMs.static void
setDefaultStorageCapacity
(long defaultCapacity) Sets the Default Storage capacity (in MB) for creating VMs.setDescription
(String description) Sets the VM description, which is an optional text which one can use to provide details about this of this VM.void
setFailed
(boolean failed) Sets the status of VM to FAILED.setFreePesNumber
(long freePesNumber) Sets the current number of free PEs.void
final Vm
setHorizontalScaling
(HorizontalVmScaling horizontalScaling) Sets aHorizontalVmScaling
that will check if the Vm is overloaded, based on some conditions defined by aPredicate
given to the HorizontalVmScaling, and then request the creation of new VMs to horizontally scale the Vm.final void
Sets the PM that hosts the VM.final void
setInMigration
(boolean migrating) Defines if the VM is in migration process or not.protected final void
setMips
(double mips) Sets the individual MIPS capacity of any VM's PE, considering that all PEs have the same capacity.final Vm
setPeVerticalScaling
(VerticalVmScaling peVerticalScaling) Sets aVerticalVmScaling
that will check if the Vm'sPe
is under or overloaded, based on some conditions defined byPredicate
s given to the VerticalVmScaling, and then request the Pe up or down scaling.final Vm
setRam
(long ramCapacity) Sets RAM capacity in Megabytes.final Vm
setRamVerticalScaling
(VerticalVmScaling ramVerticalScaling) Sets aVerticalVmScaling
that will check if the Vm'sRam
is under or overloaded, based on some conditions defined byPredicate
s given to the VerticalVmScaling, and then request the RAM up or down scaling.void
setRequestedMips
(MipsShare requestedMips) final Vm
setSize
(long size) Sets the storage size (capacity) of the VM image in Megabytes.setStartTime
(double startTime) Sets the current machine startup time.setStopTime
(double stopTime) Sets the time the VM was destroyed into the last Host it executed (in seconds).final void
setSubmissionDelay
(double submissionDelay) Sets a relative time (in seconds), from current simulation time, that aDatacenterBroker
will wait to submit the entity to a Datacenter, in order to request the creation of the object.setTimeZone
(double timeZone) Sets the time zone offset, a value between [-12 and 12], in which the VM is expected to be placed (if there is aDatacenter
with enough capacity available at that timezone).protected final void
Sets the Virtual Machine Monitor (VMM) that manages the VM.toString()
void
updateMigrationFinishListeners
(Host targetHost) Notifies the listeners when the VM finishes migration to a target Host.void
updateMigrationStartListeners
(Host targetHost) Notifies the listeners when the VM starts migration to a target Host.double
updateProcessing
(double currentTime, MipsShare mipsShare) Updates the processing of cloudlets running on this VM.double
updateProcessing
(MipsShare mipsShare) Updates the processing of cloudlets running on this VM at the current simulation time.Methods inherited from class org.cloudbus.cloudsim.core.CustomerEntityAbstract
equals, getArrivedTime, getBroker, getCreationTime, getId, getLastTriedDatacenter, getSimulation, getUid, getWaitTime, hashCode, setArrivedTime, setBroker, setCreationTime, setCreationTime, setId, setLastTriedDatacenter
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.cloudbus.cloudsim.core.AbstractMachine
getIdleInterval, getSimulation, isIdle
Methods inherited from interface org.cloudbus.cloudsim.core.ChangeableId
setId
Methods inherited from interface org.cloudbus.cloudsim.core.CustomerEntity
getArrivedTime, getCreationTime, getLastTriedDatacenter, getSimulation, getWaitTime, setArrivedTime, setLastTriedDatacenter
Methods inherited from interface org.cloudbus.cloudsim.core.Identifiable
getId
Methods inherited from interface org.cloudbus.cloudsim.datacenters.TimeZoned
distance, validateTimeZone
Methods inherited from interface org.cloudbus.cloudsim.core.UniquelyIdentifiable
getUid
Methods inherited from interface org.cloudbus.cloudsim.vms.Vm
getBroker, getHostCpuUtilization, isIdleEnough, setBroker
-
Constructor Details
-
VmSimple
A copy constructor that creates a VM based on the configuration of another one. The created VM will have the same MIPS capacity, number of PEs, BW, RAM and size of the given VM, but a default CloudletScheduler and no broker.- Parameters:
sourceVm
- the VM to be cloned- See Also:
-
VmSimple
public VmSimple(double mipsCapacity, long numberOfPes) Creates a Vm with 1024 MEGA of RAM, 100 Megabits/s of Bandwidth and 1024 MEGA of Storage Size. To change these values, use the respective setters. While the Vmis being instantiated
, such values can be changed freely.It is not defined an id for the Vm. The id is defined when the Vm is submitted to a
DatacenterBroker
.NOTE: The Vm will use a
CloudletSchedulerTimeShared
by default. If you need to change that, just callsetCloudletScheduler(CloudletScheduler)
.- Parameters:
mipsCapacity
- the mips capacity of each VmPe
numberOfPes
- amount ofPe
(CPU cores)- See Also:
-
setRam(long)
setBw(long)
setStorage(SimpleStorage)
setDefaultRamCapacity(long)
setDefaultBwCapacity(long)
setDefaultStorageCapacity(long)
-
VmSimple
Creates a Vm with 1024 MEGA of RAM, 100 Megabits/s of Bandwidth and 1024 MEGA of Storage Size. To change these values, use the respective setters. While the Vmis being instantiated
, such values can be changed freely.It is not defined an id for the Vm. The id is defined when the Vm is submitted to a
DatacenterBroker
.- Parameters:
mipsCapacity
- the mips capacity of each VmPe
numberOfPes
- amount ofPe
(CPU cores)- See Also:
-
setRam(long)
setBw(long)
setStorage(SimpleStorage)
setDefaultRamCapacity(long)
setDefaultBwCapacity(long)
setDefaultStorageCapacity(long)
-
VmSimple
public VmSimple(long id, double mipsCapacity, long numberOfPes) Creates a Vm with 1024 MEGA of RAM, 100 Megabits/s of Bandwidth and 1024 MEGA of Storage Size.To change these values, use the respective setters. While the Vm
is being instantiated
, such values can be changed freely.It receives the amount of MIPS as a double value but converts it internally to a long. The method is just provided as a handy-way to create a Vm using a double value for MIPS that usually is generated from some computations.
NOTE: The Vm will use a
CloudletSchedulerTimeShared
by default. If you need to change that, just callsetCloudletScheduler(CloudletScheduler)
.- Parameters:
id
- unique ID of the VMmipsCapacity
- the mips capacity of each VmPe
numberOfPes
- amount ofPe
(CPU cores)- See Also:
-
setRam(long)
setBw(long)
setStorage(SimpleStorage)
setDefaultRamCapacity(long)
setDefaultBwCapacity(long)
setDefaultStorageCapacity(long)
-
VmSimple
public VmSimple(long id, long mipsCapacity, long numberOfPes) Creates a Vm with 1024 MEGA of RAM, 100 Megabits/s of Bandwidth and 1024 MEGA of Storage Size.To change these values, use the respective setters. While the Vm
is being instantiated
, such values can be changed freely.NOTE: The Vm will use a
CloudletSchedulerTimeShared
by default. If you need to change that, just callsetCloudletScheduler(CloudletScheduler)
.- Parameters:
id
- unique ID of the VMmipsCapacity
- the mips capacity of each VmPe
numberOfPes
- amount ofPe
(CPU cores)- See Also:
-
setRam(long)
setBw(long)
setStorage(SimpleStorage)
setDefaultRamCapacity(long)
setDefaultBwCapacity(long)
setDefaultStorageCapacity(long)
-
-
Method Details
-
getFreePesNumber
public long getFreePesNumber()Description copied from interface:Vm
Gets the current number of free PEs.- Specified by:
getFreePesNumber
in interfaceVm
- Returns:
- the current free pes number
-
setFreePesNumber
Sets the current number of free PEs.- Returns:
- the new free pes number
-
getExpectedFreePesNumber
public long getExpectedFreePesNumber()Description copied from interface:Vm
Gets the expected free pes number before the VM starts executing. This value is updated as cloudlets are assigned to VMs but not submitted to the broker yet for running.- Specified by:
getExpectedFreePesNumber
in interfaceVm
- Returns:
- the expected free pes number
-
addExpectedFreePesNumber
Adds a given number of expected free PEs to the total number of expected free PEs. This value is updated as cloudlets are assigned to VMs but not submitted to the broker for running yet.- Parameters:
pesToAdd
- the number of expected free PEs to add
-
removeExpectedFreePesNumber
Adds a given number of expected free PEs to the total number of expected free PEs. This value is updated as cloudlets are assigned to VMs but not submitted to the broker for running yet.- Parameters:
pesToRemove
- the number of expected free PEs to remove
-
getCpuPercentUtilization
public double getCpuPercentUtilization()Description copied from interface:Vm
Gets the current percentage of CPU capacity (MIPS %) used by all Cloudlets running on this VM. It represents the actual percentage of MIPS allocated.- Specified by:
getCpuPercentUtilization
in interfaceVm
- Returns:
- total CPU utilization percentage (between [0 and 1]) for the current time
-
getCpuPercentUtilization
public double getCpuPercentUtilization(double time) Description copied from interface:Vm
Gets the percentage of CPU capacity (MIPS %) used by all Cloudlets running on this VM at the given time. It represents the actual percentage of MIPS allocated for that time.- Specified by:
getCpuPercentUtilization
in interfaceVm
- Parameters:
time
- the time to get the CPU utilization percentage- Returns:
- total CPU utilization percentage (between [0 and 1])
-
getCpuPercentRequested
public double getCpuPercentRequested()Description copied from interface:Vm
Gets the percentage of CPU capacity (MIPS %) requested by all Cloudlets running on this VM at the current time. It represents the percentage of MIPS requested, which may be higher than the percentage used (allocated) due to lack of capacity.- Specified by:
getCpuPercentRequested
in interfaceVm
- Returns:
- the percentage (between [0 and 1]) of CPU capacity requested
- See Also:
-
getCpuPercentRequested
public double getCpuPercentRequested(double time) Description copied from interface:Vm
Gets the percentage of CPU capacity (MIPS %) requested by all Cloudlets running on this VM at the given time. It represents the percentage of MIPS requested for that time, which may be higher than the percentage used (allocated) due to lack of capacity.- Specified by:
getCpuPercentRequested
in interfaceVm
- Parameters:
time
- the time to get the CPU requested percentage- Returns:
- the percentage (between [0 and 1]) of CPU capacity requested for the current time
- See Also:
-
getHostCpuUtilization
public double getHostCpuUtilization(double time) Description copied from interface:Vm
Computes the relative percentage of the CPU the VM is using from the Host's total MIPS Capacity for the current simulation time. If the capacity is 1000 MIPS and the VM is using 250 MIPS, it's equivalent to 25% of the Host's capacity.- Specified by:
getHostCpuUtilization
in interfaceVm
- Parameters:
time
- the time to get the relative VM CPU utilization- Returns:
- the relative VM CPU usage percent (from 0 to 1)
-
getExpectedHostCpuUtilization
public double getExpectedHostCpuUtilization(double vmCpuUtilizationPercent) Description copied from interface:Vm
Computes what would be the relative percentage of the CPU the VM is using from a PM's total MIPS Capacity, considering that the VM 's CPU load is at a given percentage.- Specified by:
getExpectedHostCpuUtilization
in interfaceVm
- Parameters:
vmCpuUtilizationPercent
- the VM's CPU utilization percentage for a given time- Returns:
- the relative VM CPU usage percent (from 0 to 1)
-
getHostRamUtilization
public double getHostRamUtilization()Description copied from interface:Vm
Computes the relative percentage of the RAM the VM is using from the Host's total Capacity for the current simulation time.- Specified by:
getHostRamUtilization
in interfaceVm
- Returns:
- the relative VM RAM usage percent (from 0 to 1)
-
getHostBwUtilization
public double getHostBwUtilization()Description copied from interface:Vm
Computes the relative percentage of the Bandwidth the VM is using from the Host's total Capacity for the current simulation time.- Specified by:
getHostBwUtilization
in interfaceVm
- Returns:
- the relative VM BW usage percent (from 0 to 1)
-
getTotalCpuMipsUtilization
public double getTotalCpuMipsUtilization()Description copied from interface:Vm
Gets the current total CPU MIPS utilization of all PEs from all cloudlets running on this VM.- Specified by:
getTotalCpuMipsUtilization
in interfaceVm
- Returns:
- total CPU utilization in MIPS
- See Also:
-
getTotalCpuMipsUtilization
public double getTotalCpuMipsUtilization(double time) Description copied from interface:Vm
Gets the total CPU MIPS utilization of all PEs from all cloudlets running on this VM at the given time.- Specified by:
getTotalCpuMipsUtilization
in interfaceVm
- Parameters:
time
- the time to get the utilization- Returns:
- total CPU utilization in MIPS
- See Also:
-
getTotalCpuMipsRequested
public double getTotalCpuMipsRequested()Description copied from interface:Vm
Gets the current requested total MIPS. It is the sum of MIPS capacity requested for every virtualPe
.- Specified by:
getTotalCpuMipsRequested
in interfaceVm
- Returns:
- the current requested total MIPS
- See Also:
-
getCurrentRequestedMips
Description copied from interface:Vm
Gets a copy list of current requested MIPS of each virtualPe
, avoiding the original list to be changed.- Specified by:
getCurrentRequestedMips
in interfaceVm
- Returns:
- the current requested MIPS of each Pe
-
getCurrentRequestedBw
public long getCurrentRequestedBw()Description copied from interface:Vm
Gets the current requested bw.- Specified by:
getCurrentRequestedBw
in interfaceVm
- Returns:
- the current requested bw
-
getTotalMipsCapacity
public double getTotalMipsCapacity()Description copied from interface:AbstractMachine
Gets total MIPS capacity of all PEs of the machine.- Specified by:
getTotalMipsCapacity
in interfaceAbstractMachine<Resource>
- Returns:
- the total MIPS of all PEs
-
getCurrentRequestedRam
public long getCurrentRequestedRam()Description copied from interface:Vm
Gets the current requested ram (in Megabytes).- Specified by:
getCurrentRequestedRam
in interfaceVm
- Returns:
-
getStartTime
public double getStartTime()Description copied from interface:AbstractMachine
Gets the last time the machine was started up (in seconds). The value -1 means it was not started yet.- Specified by:
getStartTime
in interfaceAbstractMachine<Resource>
- Returns:
-
setStartTime
Description copied from interface:AbstractMachine
Sets the current machine startup time. The value -1 means it was not started yet.- Specified by:
setStartTime
in interfaceAbstractMachine<Resource>
- Parameters:
startTime
- the start time to set (in seconds)- Returns:
-
getStopTime
public double getStopTime()Description copied from interface:Vm
Gets the time the VM was destroyed into the last Host it executed (in seconds). The value -1 means the VM has not stopped or has not even started yet.- Specified by:
getStopTime
in interfaceVm
- Returns:
- See Also:
-
setStopTime
Description copied from interface:Vm
Sets the time the VM was destroyed into the last Host it executed (in seconds). The value -1 means the VM has not stopped or has not even started yet.- Specified by:
setStopTime
in interfaceVm
- Parameters:
stopTime
- the stop time to set (in seconds)- Returns:
- See Also:
-
getLastBusyTime
public double getLastBusyTime()Description copied from interface:AbstractMachine
Gets the last time the Machine was running some process.- Specified by:
getLastBusyTime
in interfaceAbstractMachine<Resource>
- Returns:
- the last busy time (in seconds)
-
hasStartedSomeCloudlet
public boolean hasStartedSomeCloudlet()Checks if the VM has ever started some Cloudlet.- Returns:
-
getTotalExecutionTime
public double getTotalExecutionTime()Description copied from interface:Vm
Gets the total time (in seconds) the Vm spent executing. It considers the entire VM execution even if in different Hosts it has possibly migrated.- Specified by:
getTotalExecutionTime
in interfaceVm
- Returns:
- the VM total execution time if the VM has stopped, the time executed so far if the VM is running yet, or 0 if it hasn't started.
-
getMips
public double getMips()Description copied from interface:AbstractMachine
Gets the individual MIPS capacity of any machine'sPe
, considering that all PEs have the same capacity.- Specified by:
getMips
in interfaceAbstractMachine<Resource>
- Returns:
- the MIPS capacity of a single
Pe
-
setMips
protected final void setMips(double mips) Sets the individual MIPS capacity of any VM's PE, considering that all PEs have the same capacity.- Parameters:
mips
- the new mips for every VM's PE
-
getNumberOfPes
public long getNumberOfPes()Description copied from interface:AbstractMachine
Gets the overall number ofPe
s the machine has, that include PEs of all statuses, including failed PEs.- Specified by:
getNumberOfPes
in interfaceAbstractMachine<Resource>
- Returns:
- the machine's number of PEs
-
getProcessor
Description copied from interface:Vm
- Specified by:
getProcessor
in interfaceVm
- Returns:
-
getRam
Description copied from interface:Vm
Gets the RAM resource assigned to the Vm, allowing to check its capacity (in Megabytes) and usage.- Specified by:
getRam
in interfaceAbstractMachine<Resource>
- Specified by:
getRam
in interfaceVm
- Returns:
- the RAM resource
-
setRam
Description copied from interface:Vm
Sets RAM capacity in Megabytes. -
getBw
Description copied from interface:Vm
Gets bandwidth resource (in Megabits/s) assigned to the Vm, allowing to check its capacity and usage.- Specified by:
getBw
in interfaceAbstractMachine<Resource>
- Specified by:
getBw
in interfaceVm
- Returns:
- bandwidth resource.
-
setBw
Description copied from interface:Vm
Sets the bandwidth capacity (in Megabits/s) -
getStorage
Description copied from interface:Vm
Gets the storage device of the VM, which represents the VM image, allowing to check its capacity (in Megabytes) and usage.- Specified by:
getStorage
in interfaceAbstractMachine<Resource>
- Specified by:
getStorage
in interfaceVm
- Returns:
- the storage resource
-
setSize
Description copied from interface:Vm
Sets the storage size (capacity) of the VM image in Megabytes. -
getVmm
Description copied from interface:Vm
Gets the Virtual Machine Monitor (VMM) that manages the VM. -
setVmm
Sets the Virtual Machine Monitor (VMM) that manages the VM.- Parameters:
vmm
- the new VMM
-
setHost
Description copied from interface:Vm
Sets the PM that hosts the VM. -
getHost
Description copied from interface:Vm
Gets theHost
where the Vm is or will be placed. To know if the Vm was already created inside this Host, call theVm.isCreated()
method. -
getCloudletScheduler
Description copied from interface:Vm
Gets the Cloudlet scheduler the VM uses to schedule cloudlets execution.- Specified by:
getCloudletScheduler
in interfaceVm
- Returns:
- the cloudlet scheduler
-
setCloudletScheduler
Description copied from interface:Vm
Sets the Cloudlet scheduler the Vm uses to schedule cloudlets execution. It also sets the Vm itself to the given scheduler.- Specified by:
setCloudletScheduler
in interfaceVm
- Parameters:
cloudletScheduler
- the cloudlet scheduler to set- Returns:
-
isInMigration
public boolean isInMigration()Description copied from interface:Vm
Checks if the VM is in migration process or not, that is, if it is migrating in or out of a Host.- Specified by:
isInMigration
in interfaceVm
- Returns:
-
setInMigration
public final void setInMigration(boolean migrating) Description copied from interface:Vm
Defines if the VM is in migration process or not.- Specified by:
setInMigration
in interfaceVm
- Parameters:
migrating
- true to indicate the VM is migrating into a Host, false otherwise
-
updateMigrationStartListeners
Notifies the listeners when the VM starts migration to a target Host.- Parameters:
targetHost
- the Host the VM is migrating to
-
updateMigrationFinishListeners
Notifies the listeners when the VM finishes migration to a target Host.- Parameters:
targetHost
- the Host the VM has just migrated to
-
isCreated
public final boolean isCreated()Description copied from interface:Vm
Checks if the VM was created and placed inside theHost
. If so, resources required by the Vm already were provisioned. -
isSuitableForCloudlet
Description copied from interface:Vm
Checks if the VM has enough capacity to run a Cloudlet.- Specified by:
isSuitableForCloudlet
in interfaceVm
- Parameters:
cloudlet
- the candidate Cloudlet to run inside the VM- Returns:
- true if the VM can run the Cloudlet, false otherwise
-
setCreated
public void setCreated(boolean created) Description copied from interface:Vm
Changes the created status of the Vm inside the Host.- Specified by:
setCreated
in interfaceVm
- Parameters:
created
- true to indicate the VM was created inside the Host; false otherwise- See Also:
-
getStateHistory
Description copied from interface:Vm
Gets a read-only list with the history of requests and allocation of MIPS for this VM. The VM state history is just collected and stored if the Host is storing such a data.- Specified by:
getStateHistory
in interfaceVm
- Returns:
- the state history
- See Also:
-
addStateHistoryEntry
Description copied from interface:Vm
Adds a VM state history entry.- Specified by:
addStateHistoryEntry
in interfaceVm
- Parameters:
entry
- the data about the state of the VM at given time
-
getResources
Description copied from interface:Resourceful
Gets a read-only list of resources the machine has.- Specified by:
getResources
in interfaceResourceful
- Returns:
- a read-only list of resources
- See Also:
-
getResource
Description copied from interface:Resourceful
Gets a givenAbstractMachine
Resource
, such asRam
orBandwidth
, from the List of machine resources.- Specified by:
getResource
in interfaceResourceful
- Parameters:
resourceClass
- the class of resource to get- Returns:
- the
Resource
corresponding to the given class
-
addOnHostAllocationListener
Description copied from interface:Vm
Adds a listener object that will be notified when aHost
is allocated to the Vm, that is, when the Vm is placed into a given Host. That happens when the VM is placed for the first time into a Host or when it's migrated to another Host.- Specified by:
addOnHostAllocationListener
in interfaceVm
- Parameters:
listener
- the listener to add- Returns:
- See Also:
-
addOnMigrationStartListener
Description copied from interface:Vm
Adds a listener object that will be notified when a VM starts migrating to a targetHost
. When the listener is notified, it receives aVmHostEventInfo
object informing the target Host where the VM is being migrated.- Specified by:
addOnMigrationStartListener
in interfaceVm
- Parameters:
listener
- the listener to add- Returns:
- See Also:
-
addOnMigrationFinishListener
Description copied from interface:Vm
Adds a listener object that will be notified when a VM finishes migrating to a targetHost
. When the listener is notified, it receives aVmHostEventInfo
object informing the target Host where the VM has just migrated.- Specified by:
addOnMigrationFinishListener
in interfaceVm
- Parameters:
listener
- the listener to add- Returns:
-
addOnHostDeallocationListener
Description copied from interface:Vm
Adds a listener object that will be notified when the Vm is moved/removed from aHost
.- Specified by:
addOnHostDeallocationListener
in interfaceVm
- Parameters:
listener
- the listener to add- Returns:
-
addOnCreationFailureListener
Description copied from interface:Vm
Adds a listener object that will be notified when the Vm fail in being placed for lack of aHost
with enough resources in a specificDatacenter
.The
DatacenterBroker
is accountable for receiving the notification from the Datacenter and notifying the Listeners.- Specified by:
addOnCreationFailureListener
in interfaceVm
- Parameters:
listener
- the listener to add- Returns:
- See Also:
-
addOnUpdateProcessingListener
Description copied from interface:Vm
Adds a listener object that will be notified every time when the processing of the Vm is updated in itsHost
.- Specified by:
addOnUpdateProcessingListener
in interfaceVm
- Parameters:
listener
- the listener to add- Returns:
- See Also:
-
removeOnCreationFailureListener
Description copied from interface:Vm
Removes a listener from the onVmCreationFailureListener List.- Specified by:
removeOnCreationFailureListener
in interfaceVm
- Parameters:
listener
- the listener to remove- Returns:
- true if the listener was found and removed, false otherwise
-
removeOnUpdateProcessingListener
Description copied from interface:Vm
Removes a listener from the onUpdateVmProcessingListener List.- Specified by:
removeOnUpdateProcessingListener
in interfaceVm
- Parameters:
listener
- the listener to remove- Returns:
- true if the listener was found and removed, false otherwise
-
removeOnHostAllocationListener
Description copied from interface:Vm
Removes a listener from the onHostAllocationListener List.- Specified by:
removeOnHostAllocationListener
in interfaceVm
- Parameters:
listener
- the listener to remove- Returns:
- true if the listener was found and removed, false otherwise
-
removeOnHostDeallocationListener
Description copied from interface:Vm
Removes a listener from the onHostDeallocationListener List.- Specified by:
removeOnHostDeallocationListener
in interfaceVm
- Parameters:
listener
- the listener to remove- Returns:
- true if the listener was found and removed, false otherwise
-
toString
-
compareTo
Compare this Vm with another one based ongetTotalMipsCapacity()
.- Specified by:
compareTo
in interfaceComparable<Vm>
- Parameters:
obj
- the Vm to compare to- Returns:
-
setFailed
public void setFailed(boolean failed) Description copied from interface:Vm
Sets the status of VM to FAILED. -
setCloudletsToFailed
public void setCloudletsToFailed() -
isFailed
public boolean isFailed()Description copied from interface:Vm
Checks if the Vm is failed or not. -
isWorking
public boolean isWorking()Description copied from interface:Vm
Checks if the Vm is working or failed. -
getSubmissionDelay
public double getSubmissionDelay()Description copied from interface:Delayable
Gets the time (in seconds) that aDatacenterBroker
will wait to submit the entity to a Datacenter, in order to request the creation of the object. This is a relative time from the current simulation time.- Specified by:
getSubmissionDelay
in interfaceDelayable
- Returns:
- the submission delay (in seconds)
-
setSubmissionDelay
public final void setSubmissionDelay(double submissionDelay) Description copied from interface:Delayable
Sets a relative time (in seconds), from current simulation time, that aDatacenterBroker
will wait to submit the entity to a Datacenter, in order to request the creation of the object. This is a relative time from the current simulation time.- Specified by:
setSubmissionDelay
in interfaceDelayable
- Parameters:
submissionDelay
- the amount of seconds from the current simulation time that the object will wait to be submitted
-
isDelayed
public boolean isDelayed()Description copied from interface:Delayable
Checks if this object has a submission delay or not -
notifyOnHostAllocationListeners
public void notifyOnHostAllocationListeners()Description copied from interface:Vm
Notifies all registered listeners when aHost
is allocated to theVm
.This method is used just internally and must not be called directly.
- Specified by:
notifyOnHostAllocationListeners
in interfaceVm
-
notifyOnHostDeallocationListeners
Description copied from interface:Vm
Notifies all registered listeners when theVm
is moved/removed from aHost
.This method is used just internally and must not be called directly.
- Specified by:
notifyOnHostDeallocationListeners
in interfaceVm
- Parameters:
deallocatedHost
- theHost
theVm
was moved/removed from
-
notifyOnUpdateProcessingListeners
public void notifyOnUpdateProcessingListeners()Notifies all registered listeners when the processing of the Vm is updated in itsHost
. -
notifyOnCreationFailureListeners
Description copied from interface:Vm
Notifies all registered listeners when the Vm fail in being placed for lack of aHost
with enough resources in a specificDatacenter
.This method is used just internally and must not be called directly.
- Specified by:
notifyOnCreationFailureListeners
in interfaceVm
- Parameters:
failedDatacenter
- the Datacenter where the VM creation failed
-
removeOnMigrationStartListener
Description copied from interface:Vm
Removes a listener from the onMigrationStartListener List.- Specified by:
removeOnMigrationStartListener
in interfaceVm
- Parameters:
listener
- the listener to remove- Returns:
- true if the listener was found and removed, false otherwise
-
removeOnMigrationFinishListener
Description copied from interface:Vm
Removes a listener from the onMigrationFinishListener List.- Specified by:
removeOnMigrationFinishListener
in interfaceVm
- Parameters:
listener
- the listener to remove- Returns:
- true if the listener was found and removed, false otherwise
-
getHorizontalScaling
Description copied from interface:Vm
Gets aHorizontalVmScaling
that will check if the Vm is overloaded, based on some conditions defined by aPredicate
given to the HorizontalVmScaling, and then request the creation of new VMs to horizontally scale the Vm.If no HorizontalVmScaling is set, the
Broker
will not dynamically create VMs to balance arrived Cloudlets.- Specified by:
getHorizontalScaling
in interfaceVm
- Returns:
-
setHorizontalScaling
public final Vm setHorizontalScaling(HorizontalVmScaling horizontalScaling) throws IllegalArgumentException Description copied from interface:Vm
Sets aHorizontalVmScaling
that will check if the Vm is overloaded, based on some conditions defined by aPredicate
given to the HorizontalVmScaling, and then request the creation of new VMs to horizontally scale the Vm.- Specified by:
setHorizontalScaling
in interfaceVm
- Parameters:
horizontalScaling
- the HorizontalVmScaling to set- Returns:
- Throws:
IllegalArgumentException
- if the given VmScaling is already linked to a Vm. Each VM must have its own HorizontalVmScaling object or none at all.
-
setRamVerticalScaling
public final Vm setRamVerticalScaling(VerticalVmScaling ramVerticalScaling) throws IllegalArgumentException Description copied from interface:Vm
Sets aVerticalVmScaling
that will check if the Vm'sRam
is under or overloaded, based on some conditions defined byPredicate
s given to the VerticalVmScaling, and then request the RAM up or down scaling.- Specified by:
setRamVerticalScaling
in interfaceVm
- Parameters:
ramVerticalScaling
- the VerticalVmScaling to set- Returns:
- Throws:
IllegalArgumentException
- if the given VmScaling is already linked to a Vm. Each VM must have its own VerticalVmScaling objects or none at all.
-
setBwVerticalScaling
public final Vm setBwVerticalScaling(VerticalVmScaling bwVerticalScaling) throws IllegalArgumentException Description copied from interface:Vm
Sets aVerticalVmScaling
that will check if the Vm'sBandwidth
is under or overloaded, based on some conditions defined byPredicate
s given to the VerticalVmScaling, and then request the Bandwidth up or down scaling.- Specified by:
setBwVerticalScaling
in interfaceVm
- Parameters:
bwVerticalScaling
- the VerticalVmScaling to set- Returns:
- Throws:
IllegalArgumentException
- if the given VmScaling is already linked to a Vm. Each VM must have its own VerticalVmScaling objects or none at all.
-
setPeVerticalScaling
public final Vm setPeVerticalScaling(VerticalVmScaling peVerticalScaling) throws IllegalArgumentException Description copied from interface:Vm
Sets aVerticalVmScaling
that will check if the Vm'sPe
is under or overloaded, based on some conditions defined byPredicate
s given to the VerticalVmScaling, and then request the Pe up or down scaling.The Pe scaling is performed by adding or removing PEs to/from the VM. Added PEs will have the same MIPS than the already existing ones.
- Specified by:
setPeVerticalScaling
in interfaceVm
- Parameters:
peVerticalScaling
- the VerticalVmScaling to set- Returns:
- Throws:
IllegalArgumentException
- if the given VmScaling is already linked to a Vm. Each VM must have its own VerticalVmScaling objects or none at all.
-
getRamVerticalScaling
Description copied from interface:Vm
Gets aVerticalVmScaling
that will check if the Vm's RAM is overloaded, based on some conditions defined by aPredicate
given to the VerticalVmScaling, and then request the RAM up scaling.- Specified by:
getRamVerticalScaling
in interfaceVm
- Returns:
-
getBwVerticalScaling
Description copied from interface:Vm
Gets aVerticalVmScaling
that will check if the Vm's Bandwidth is overloaded, based on some conditions defined by aPredicate
given to the VerticalVmScaling, and then request the BW up scaling.- Specified by:
getBwVerticalScaling
in interfaceVm
- Returns:
-
getPeVerticalScaling
Description copied from interface:Vm
Gets aVerticalVmScaling
that will check if the Vm'sPe
is overloaded, based on some conditions defined by aPredicate
given to the VerticalVmScaling, and then request the RAM up scaling.- Specified by:
getPeVerticalScaling
in interfaceVm
- Returns:
-
getDescription
Description copied from interface:Vm
Gets the Vm description, which is an optional text which one can use to provide details about this of this VM.- Specified by:
getDescription
in interfaceVm
- Returns:
-
setDescription
Description copied from interface:Vm
Sets the VM description, which is an optional text which one can use to provide details about this of this VM.- Specified by:
setDescription
in interfaceVm
- Parameters:
description
- the Vm description to set- Returns:
-
getGroup
Description copied from interface:Vm
Gets thegroup
this Vm belongs to -
setGroup
-
getCpuUtilizationStats
Description copied from interface:ResourceStatsComputer
Gets machine's CPU utilization percentage statistics (between [0 and 1]).WARNING: You need to enable the data collection and computation of statistics by calling
ResourceStatsComputer.enableUtilizationStats()
.The time interval in which utilization is collected is defined by the
Datacenter.getSchedulingInterval()
.- Specified by:
getCpuUtilizationStats
in interfaceResourceStatsComputer<VmResourceStats>
- Returns:
-
enableUtilizationStats
public void enableUtilizationStats()Description copied from interface:Vm
Enables the data collection and computation of utilization statistics. If you enable the statistics for the Host where the VM is placed, that will automatically enable the statistics for every VM on that Host.- Specified by:
enableUtilizationStats
in interfaceResourceStatsComputer<VmResourceStats>
- Specified by:
enableUtilizationStats
in interfaceVm
- See Also:
-
getDefaultRamCapacity
public static long getDefaultRamCapacity()Gets the Default RAM capacity (in MB) for creating VMs. This value is used when the RAM capacity is not given in a VM constructor. -
setDefaultRamCapacity
public static void setDefaultRamCapacity(long defaultCapacity) Sets the Default RAM capacity (in MB) for creating VMs. This value is used when the RAM capacity is not given in a VM constructor. -
getDefaultBwCapacity
public static long getDefaultBwCapacity()Gets the Default Bandwidth capacity (in Mbps) for creating VMs. This value is used when the BW capacity is not given in a VM constructor. -
setDefaultBwCapacity
public static void setDefaultBwCapacity(long defaultCapacity) Sets the Default Bandwidth capacity (in Mbps) for creating VMs. This value is used when the BW capacity is not given in a VM constructor. -
getDefaultStorageCapacity
public static long getDefaultStorageCapacity()Gets the Default Storage capacity (in MB) for creating VMs. This value is used when the Storage capacity is not given in a VM constructor. -
setDefaultStorageCapacity
public static void setDefaultStorageCapacity(long defaultCapacity) Sets the Default Storage capacity (in MB) for creating VMs. This value is used when the Storage capacity is not given in a VM constructor. -
getTimeZone
public double getTimeZone()Description copied from interface:Vm
Gets the time zone offset, a value between [-12 and 12], in which the VM is expected to be placed (if there is aDatacenter
with enough capacity available at that timezone).To know the actual timezone where the VM is placed, check the
timezone of the Datacenter of the Host where this is VM placed
.- Specified by:
getTimeZone
in interfaceTimeZoned
- Specified by:
getTimeZone
in interfaceVm
- Returns:
- the expected timezone to place this VM
-
setTimeZone
Description copied from interface:Vm
Sets the time zone offset, a value between [-12 and 12], in which the VM is expected to be placed (if there is aDatacenter
with enough capacity available at that timezone).- Specified by:
setTimeZone
in interfaceTimeZoned
- Specified by:
setTimeZone
in interfaceVm
- Parameters:
timeZone
- the new expected time zone offset- Returns:
-
getAllocatedMips
-
getRequestedMips