Package org.cloudbus.cloudsim.vms
Interface Vm
- All Superinterfaces:
AbstractMachine
,ChangeableId
,Comparable<Vm>
,CustomerEntity
,Delayable
,Identifiable
,Resourceful
,ResourceStatsComputer<VmResourceStats>
,TimeZoned
,UniquelyIdentifiable
public interface Vm extends AbstractMachine, UniquelyIdentifiable, Comparable<Vm>, CustomerEntity, TimeZoned, ResourceStatsComputer<VmResourceStats>
An interface to be implemented by each class that provides basic
features of Virtual Machines (VMs).
The interface implements the Null Object
Design Pattern in order to start avoiding
NullPointerException
when
using the NULL
object instead of attributing null
to
Vm
variables.- Since:
- CloudSim Plus 1.0
- Author:
- Rodrigo N. Calheiros, Anton Beloglazov, Manoel Campos da Silva Filho
-
Field Summary
-
Method Summary
Modifier and Type Method Description Vm
addOnCreationFailureListener(EventListener<VmDatacenterEventInfo> listener)
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
.Vm
addOnHostAllocationListener(EventListener<VmHostEventInfo> listener)
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.Vm
addOnHostDeallocationListener(EventListener<VmHostEventInfo> listener)
Adds a listener object that will be notified when the Vm is moved/removed from aHost
.Vm
addOnMigrationFinishListener(EventListener<VmHostEventInfo> listener)
Adds a listener object that will be notified when a VM finishes migrating to a targetHost
.Vm
addOnMigrationStartListener(EventListener<VmHostEventInfo> listener)
Adds a listener object that will be notified when a VM starts migrating to a targetHost
.Vm
addOnUpdateProcessingListener(EventListener<VmHostEventInfo> listener)
Adds a listener object that will be notified every time when the processing of the Vm is updated in itsHost
.void
addStateHistoryEntry(VmStateHistoryEntry entry)
Adds a VM state history entry.void
allocateResource(Class<? extends ResourceManageable> resourceClass, long newTotalResourceAmount)
Changes the allocation of a given resource for a VM.void
deallocateResource(Class<? extends ResourceManageable> resourceClass)
Removes the entire amount of a given resource allocated to VM.void
enableUtilizationStats()
Enables the data collection and computation of utilization statistics.DatacenterBroker
getBroker()
Gets theDatacenterBroker
that represents the owner of this Vm.Resource
getBw()
Gets bandwidth resource (in Megabits/s) assigned to the Vm, allowing to check its capacity and usage.VerticalVmScaling
getBwVerticalScaling()
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.CloudletScheduler
getCloudletScheduler()
Gets the the Cloudlet scheduler the VM uses to schedule cloudlets execution.double
getCpuPercentUtilization()
Gets the current CPU utilization percentage (in scale from 0 to 1) of all Cloudlets running on this VM.double
getCpuPercentUtilization(double time)
Gets the CPU utilization percentage of all Cloudlets running on this VM at the given time.long
getCurrentRequestedBw()
Gets the current requested bw.MipsShare
getCurrentRequestedMips()
Gets a copy list of current requested MIPS of each virtualPe
, avoiding the original list to be changed.long
getCurrentRequestedRam()
Gets the current requested ram.double
getCurrentRequestedTotalMips()
Gets the current requested total MIPS.String
getDescription()
Gets the Vm description, which is an optional text which one can use to provide details about this of this VM.long
getExpectedFreePesNumber()
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
getFreePesNumber()
Gets the current number of free PEs.VmGroup
getGroup()
Gets thegroup
this Vm belongs toHorizontalVmScaling
getHorizontalScaling()
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.Host
getHost()
Gets theHost
where the Vm is or will be placed.double
getHostBwUtilization()
Computes the relative percentage of the Bandwidth the VM is using from the Host's total Capacity for the current simulation time.default double
getHostCpuUtilization()
Computes the current relative percentage of the CPU the VM is using from the Host's total MIPS Capacity.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
getHostRamUtilization()
Computes the relative percentage of the RAM the VM is using from the Host's total Capacity for the current simulation time.VerticalVmScaling
getPeVerticalScaling()
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.Processor
getProcessor()
Gets theProcessor
of this VM.Resource
getRam()
Gets the RAM resource assigned to the Vm, allowing to check its capacity (in Megabytes) and usage.VerticalVmScaling
getRamVerticalScaling()
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.List<ResourceManageable>
getResources()
Gets a read-only list of resources the machine has.double
getStartTime()
Gets the time the VM was created into some Host for the first time (in seconds).List<VmStateHistoryEntry>
getStateHistory()
Gets a read-only list with the history of requests and allocation of MIPS for this VM.double
getStopTime()
Gets the time the VM was destroyed into the last Host it executed (in seconds).Resource
getStorage()
Gets the storage device of the VM, which represents the VM image, allowing to check its capacity (in Megabytes) and usage.double
getTimeZone()
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
getTotalCpuMipsUtilization()
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
getTotalExecutionTime()
Gets the total time (in seconds) the Vm spent executing.String
getVmm()
Gets the Virtual Machine Monitor (VMM) that manages the VM.boolean
isCreated()
Checks if the VM was created and placed inside theHost
.boolean
isFailed()
Checks if the Vm is failed or not.default boolean
isIdleEnough(double time)
Checks if the Machine has been idle for a given amount of time (in seconds).boolean
isInMigration()
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
isWorking()
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
notifyOnHostAllocationListeners()
void
notifyOnHostDeallocationListeners(Host deallocatedHost)
boolean
removeOnCreationFailureListener(EventListener<VmDatacenterEventInfo> listener)
Removes a listener from the onVmCreationFailureListener List.boolean
removeOnHostAllocationListener(EventListener<VmHostEventInfo> listener)
Removes a listener from the onHostAllocationListener List.boolean
removeOnHostDeallocationListener(EventListener<VmHostEventInfo> listener)
Removes a listener from the onHostDeallocationListener List.boolean
removeOnMigrationFinishListener(EventListener<VmHostEventInfo> listener)
Removes a listener from the onMigrationFinishListener List.boolean
removeOnMigrationStartListener(EventListener<VmHostEventInfo> listener)
Removes a listener from the onMigrationStartListener List.boolean
removeOnUpdateProcessingListener(EventListener<VmHostEventInfo> listener)
Removes a listener from the onUpdateVmProcessingListener List.void
setBroker(DatacenterBroker broker)
Sets aDatacenterBroker
that represents the owner of this Vm.Vm
setBw(long bwCapacity)
Sets the bandwidth capacity (in Megabits/s)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.Vm
setCloudletScheduler(CloudletScheduler cloudletScheduler)
Sets the Cloudlet scheduler the Vm uses to schedule cloudlets execution.void
setCreated(boolean created)
Changes the created status of the Vm inside the Host.Vm
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.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.void
setHost(Host host)
Sets the PM that hosts the VM.void
setInMigration(boolean migrating)
Defines if the VM is in migration process or not.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.Vm
setRam(long ramCapacity)
Sets RAM capacity in Megabytes.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.Vm
setSize(long size)
Sets the storage size (capacity) of the VM image in Megabytes.Vm
setStartTime(double startTime)
Sets the time the VM was created into some Host for the first time.Vm
setStopTime(double stopTime)
Sets the time the VM was destroyed into the last Host it executed (in seconds).Vm
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).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 interface org.cloudbus.cloudsim.core.AbstractMachine
getIdleInterval, getLastBusyTime, getMips, getNumberOfPes, getSimulation, getTotalMipsCapacity, isIdle
Methods inherited from interface org.cloudbus.cloudsim.core.ChangeableId
setId
Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface org.cloudbus.cloudsim.core.CustomerEntity
getLastTriedDatacenter, getSimulation, setLastTriedDatacenter
Methods inherited from interface org.cloudbus.cloudsim.core.Delayable
getSubmissionDelay, setSubmissionDelay
Methods inherited from interface org.cloudbus.cloudsim.core.Identifiable
getId
Methods inherited from interface org.cloudbus.cloudsim.resources.Resourceful
getResource
Methods inherited from interface org.cloudbus.cloudsim.core.ResourceStatsComputer
getCpuUtilizationStats
Methods inherited from interface org.cloudbus.cloudsim.datacenters.TimeZoned
distance, validateTimeZone
Methods inherited from interface org.cloudbus.cloudsim.core.UniquelyIdentifiable
getUid
-
Field Details
-
LOGGER
static final org.slf4j.Logger LOGGER -
NULL
An attribute that implements the Null Object Design Pattern forVm
objects.
-
-
Method Details
-
getDescription
String getDescription()Gets the Vm description, which is an optional text which one can use to provide details about this of this VM.- Returns:
-
setDescription
Sets the VM description, which is an optional text which one can use to provide details about this of this VM.- Parameters:
description
- the Vm description to set- Returns:
-
getGroup
VmGroup getGroup()Gets thegroup
this Vm belongs to- Returns:
- the
VmGroup
or NULL if the VM doesn't belong to a group
-
addStateHistoryEntry
Adds a VM state history entry.- Parameters:
entry
- the data about the state of the VM at given time
-
getCloudletScheduler
CloudletScheduler getCloudletScheduler()Gets the the Cloudlet scheduler the VM uses to schedule cloudlets execution.- Returns:
- the cloudlet scheduler
-
getFreePesNumber
long getFreePesNumber()Gets the current number of free PEs.- Returns:
- the current free pes number
-
getExpectedFreePesNumber
long getExpectedFreePesNumber()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.- Returns:
- the expected free pes number
-
getCurrentRequestedBw
long getCurrentRequestedBw()Gets the current requested bw.- Returns:
- the current requested bw
-
getCurrentRequestedMips
MipsShare getCurrentRequestedMips()Gets a copy list of current requested MIPS of each virtualPe
, avoiding the original list to be changed.- Returns:
- the current requested MIPS of each Pe
-
getCurrentRequestedRam
long getCurrentRequestedRam()Gets the current requested ram.- Returns:
- the current requested ram
-
getCurrentRequestedTotalMips
double getCurrentRequestedTotalMips()Gets the current requested total MIPS. It is the sum of MIPS capacity requested for every virtualPe
.- Returns:
- the current requested total MIPS
- See Also:
getCurrentRequestedMips()
-
getHost
Host getHost()Gets theHost
where the Vm is or will be placed. To know if the Vm was already created inside this Host, call theisCreated()
method.- Returns:
- the Host
- See Also:
isCreated()
-
allocateResource
void allocateResource(Class<? extends ResourceManageable> resourceClass, long newTotalResourceAmount)Changes the allocation of a given resource for a VM. The old allocated amount will be changed to the new given amount.- Parameters:
resourceClass
- the class of the resource to change the allocationnewTotalResourceAmount
- the new amount to change the current allocation to
-
deallocateResource
Removes the entire amount of a given resource allocated to VM.- Parameters:
resourceClass
- the class of the resource to deallocate from the VM
-
addOnHostAllocationListener
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.- Parameters:
listener
- the listener to add- Returns:
- See Also:
addOnMigrationStartListener(EventListener)
-
addOnMigrationStartListener
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.- Parameters:
listener
- the listener to add- Returns:
- See Also:
addOnHostAllocationListener(EventListener)
-
addOnMigrationFinishListener
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.- Parameters:
listener
- the listener to add- Returns:
-
addOnHostDeallocationListener
Adds a listener object that will be notified when the Vm is moved/removed from aHost
.- Parameters:
listener
- the listener to add- Returns:
-
addOnCreationFailureListener
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.- Parameters:
listener
- the listener to add- Returns:
- See Also:
updateProcessing(double, MipsShare)
-
addOnUpdateProcessingListener
Adds a listener object that will be notified every time when the processing of the Vm is updated in itsHost
.- Parameters:
listener
- the listener to add- Returns:
- See Also:
updateProcessing(double, MipsShare)
-
notifyOnHostAllocationListeners
void notifyOnHostAllocationListeners() -
notifyOnHostDeallocationListeners
-
notifyOnCreationFailureListeners
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.
- Parameters:
failedDatacenter
- the Datacenter where the VM creation failed
-
removeOnMigrationStartListener
Removes a listener from the onMigrationStartListener List.- Parameters:
listener
- the listener to remove- Returns:
- true if the listener was found and removed, false otherwise
-
removeOnMigrationFinishListener
Removes a listener from the onMigrationFinishListener List.- Parameters:
listener
- the listener to remove- Returns:
- true if the listener was found and removed, false otherwise
-
removeOnUpdateProcessingListener
Removes a listener from the onUpdateVmProcessingListener List.- Parameters:
listener
- the listener to remove- Returns:
- true if the listener was found and removed, false otherwise
-
removeOnHostAllocationListener
Removes a listener from the onHostAllocationListener List.- Parameters:
listener
- the listener to remove- Returns:
- true if the listener was found and removed, false otherwise
-
removeOnHostDeallocationListener
Removes a listener from the onHostDeallocationListener List.- Parameters:
listener
- the listener to remove- Returns:
- true if the listener was found and removed, false otherwise
-
removeOnCreationFailureListener
Removes a listener from the onVmCreationFailureListener List.- Parameters:
listener
- the listener to remove- Returns:
- true if the listener was found and removed, false otherwise
-
getBw
Resource getBw()Gets bandwidth resource (in Megabits/s) assigned to the Vm, allowing to check its capacity and usage.- Specified by:
getBw
in interfaceAbstractMachine
- Returns:
- bandwidth resource.
-
getRam
Resource getRam()Gets the RAM resource assigned to the Vm, allowing to check its capacity (in Megabytes) and usage.- Specified by:
getRam
in interfaceAbstractMachine
- Returns:
- the RAM resource
-
getStorage
Resource getStorage()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
- Returns:
- the storage resource
-
getStateHistory
List<VmStateHistoryEntry> getStateHistory()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.- Returns:
- the state history
- See Also:
Host.enableStateHistory()
-
getCpuPercentUtilization
double getCpuPercentUtilization(double time)Gets the CPU utilization percentage of all Cloudlets running on this VM at the given time.- Parameters:
time
- the time- Returns:
- total utilization percentage
-
getCpuPercentUtilization
double getCpuPercentUtilization()Gets the current CPU utilization percentage (in scale from 0 to 1) of all Cloudlets running on this VM.- Returns:
- total utilization percentage for the current time, in scale from 0 to 1
-
enableUtilizationStats
void enableUtilizationStats()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>
- See Also:
ResourceStatsComputer.getCpuUtilizationStats()
-
getHostRamUtilization
double getHostRamUtilization()Computes the relative percentage of the RAM the VM is using from the Host's total Capacity for the current simulation time.- Returns:
- the relative VM RAM usage percent (from 0 to 1)
-
getHostBwUtilization
double getHostBwUtilization()Computes the relative percentage of the Bandwidth the VM is using from the Host's total Capacity for the current simulation time.- Returns:
- the relative VM BW usage percent (from 0 to 1)
-
getHostCpuUtilization
default double getHostCpuUtilization()Computes the current relative percentage of the CPU the VM is using from the Host's total MIPS Capacity. If the capacity is 1000 MIPS and the VM is using 250 MIPS, it's equivalent to 25% of the Host's capacity.- Returns:
- the relative VM CPU usage percent (from 0 to 1)
- See Also:
getHostCpuUtilization(double)
-
getHostCpuUtilization
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. If the capacity is 1000 MIPS and the VM is using 250 MIPS, it's equivalent to 25% of the Host's capacity.- Parameters:
time
- the time to get the relative VM CPU utilization- Returns:
- the relative VM CPU usage percent (from 0 to 1)
-
getExpectedHostCpuUtilization
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.- Parameters:
vmCpuUtilizationPercent
- the VM's CPU utilization percentage for a given time- Returns:
- the relative VM CPU usage percent (from 0 to 1)
-
getTotalCpuMipsUtilization
double getTotalCpuMipsUtilization()Gets the current total CPU MIPS utilization of all PEs from all cloudlets running on this VM.- Returns:
- total CPU utilization in MIPS
- See Also:
getCpuPercentUtilization(double)
-
getTotalCpuMipsUtilization
double getTotalCpuMipsUtilization(double time)Gets the total CPU MIPS utilization of all PEs from all cloudlets running on this VM at the given time.- Parameters:
time
- the time to get the utilization- Returns:
- total CPU utilization in MIPS
- See Also:
getCpuPercentUtilization(double)
-
getVmm
String getVmm()Gets the Virtual Machine Monitor (VMM) that manages the VM.- Returns:
- VMM
-
isCreated
boolean isCreated()Checks if the VM was created and placed inside theHost
. If so, resources required by the Vm already were provisioned.- Returns:
- true, if it was created inside the Host, false otherwise
-
isSuitableForCloudlet
Checks if the VM has enough capacity to run a Cloudlet.- Parameters:
cloudlet
- the candidate Cloudlet to run inside the VM- Returns:
- true if the VM can run the Cloudlet, false otherwise
- To do something:
- the Method is not being called anywhere to check if a VM has enough capacity to run a Cloudlet
-
setCreated
void setCreated(boolean created)Changes the created status of the Vm inside the Host.- Parameters:
created
- true to indicate the VM was created inside the Host; false otherwise- See Also:
isCreated()
-
isInMigration
boolean isInMigration()Checks if the VM is in migration process or not, that is, if it is migrating in or out of a Host.- Returns:
-
setInMigration
void setInMigration(boolean migrating)Defines if the VM is in migration process or not.- Parameters:
migrating
- true to indicate the VM is migrating into a Host, false otherwise
-
setBw
Sets the bandwidth capacity (in Megabits/s)- Parameters:
bwCapacity
- new BW capacity (in Megabits/s)- Returns:
-
setHost
Sets the PM that hosts the VM.- Parameters:
host
- Host to run the VM
-
setRam
Sets RAM capacity in Megabytes.- Parameters:
ramCapacity
- new RAM capacity- Returns:
-
setSize
Sets the storage size (capacity) of the VM image in Megabytes.- Parameters:
size
- new storage size- Returns:
-
setCloudletScheduler
Sets the Cloudlet scheduler the Vm uses to schedule cloudlets execution. It also sets the Vm itself to the given scheduler.- Parameters:
cloudletScheduler
- the cloudlet scheduler to set- Returns:
-
setFailed
void setFailed(boolean failed)Sets the status of VM to FAILED.- Parameters:
failed
- true to indicate that the VM is failed, false to indicate it is working
-
isFailed
boolean isFailed()Checks if the Vm is failed or not.- Returns:
- See Also:
isWorking()
-
isWorking
boolean isWorking()Checks if the Vm is working or failed.- Returns:
- See Also:
isFailed()
-
isIdleEnough
default boolean isIdleEnough(double time)Description copied from interface:AbstractMachine
Checks if the Machine has been idle for a given amount of time (in seconds).- Specified by:
isIdleEnough
in interfaceAbstractMachine
- Parameters:
time
- the time interval to check if the Machine has been idle (in seconds). If time is zero, it will be checked if the Machine is currently idle. If it's negative, even if the Machine is idle, it's considered that it isn't idle enough. This is useful if you don't want to perform any operation when the machine becomes idle (for instance, if idle machines might be shut down and a negative value is given, they won't).- Returns:
- true if the Machine has been idle as long as the given time, false if it's active of isn't idle long enough
-
getResources
List<ResourceManageable> getResources()Gets a read-only list of resources the machine has. Such resources represent virtual resources corresponding to physical resources from the Host where the VM is placed.- Specified by:
getResources
in interfaceResourceful
- Returns:
- a read-only list of resources
- See Also:
Resourceful.getResource(Class)
-
getHorizontalScaling
HorizontalVmScaling getHorizontalScaling()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.- Returns:
-
setHorizontalScaling
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.- 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
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.- 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
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.- 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
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.
- 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
VerticalVmScaling getRamVerticalScaling()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.- Returns:
-
getBwVerticalScaling
VerticalVmScaling getBwVerticalScaling()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.- Returns:
-
getPeVerticalScaling
VerticalVmScaling getPeVerticalScaling()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.- Returns:
-
getProcessor
Processor getProcessor()- Returns:
-
getBroker
DatacenterBroker getBroker()Gets theDatacenterBroker
that represents the owner of this Vm.- Specified by:
getBroker
in interfaceCustomerEntity
- Returns:
- the broker or
DatacenterBroker.NULL
if a broker has not been set yet
-
setBroker
Sets aDatacenterBroker
that represents the owner of this Vm.- Specified by:
setBroker
in interfaceCustomerEntity
- Parameters:
broker
- theDatacenterBroker
to set
-
getStartTime
double getStartTime()Gets the time the VM was created into some Host for the first time (in seconds). The value -1 means the VM was not created yet.- Returns:
-
setStartTime
Sets the time the VM was created into some Host for the first time. The value -1 means the VM was not created yet.- Parameters:
startTime
- the start time to set (in seconds)- Returns:
-
getStopTime
double getStopTime()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.- Returns:
- See Also:
isCreated()
-
getTotalExecutionTime
double getTotalExecutionTime()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.- 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.
-
setStopTime
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.- Parameters:
stopTime
- the stop time to set (in seconds)- Returns:
- See Also:
isCreated()
-
getTimeZone
double getTimeZone()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
- Returns:
- the expected timezone to place this VM
-
setTimeZone
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
- Parameters:
timeZone
- the new expected time zone offset- Returns:
-