Class VmSimple

All Implemented Interfaces:
Comparable<Vm>, AbstractMachine<Resource>, ChangeableId, CustomerEntity, Delayable, Identifiable, ResourceStatsComputer<VmResourceStats>, UniquelyIdentifiable, TimeZoned, Resourceful, Vm
Direct Known Subclasses:
NetworkVm, VmGroup

public class VmSimple extends CustomerEntityAbstract implements Vm
Implements the basic features of a Virtual Machine (VM) that runs inside a 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
  • Constructor Details

  • Method Details

    • updateProcessing

      public double updateProcessing(MipsShare mipsShare)
      Description copied from interface: Vm
      Updates the processing of cloudlets running on this VM at the current simulation time.
      Specified by:
      updateProcessing in interface Vm
      Parameters:
      mipsShare - list with MIPS share of each Pe available to the scheduler
      Returns:
      the predicted completion time of the earliest finishing cloudlet (which is a relative delay from the current simulation time), or Double.MAX_VALUE if there is no next Cloudlet to execute
    • updateProcessing

      public double updateProcessing(double currentTime, MipsShare mipsShare)
      Description copied from interface: Vm
      Updates the processing of cloudlets running on this VM.
      Specified by:
      updateProcessing in interface Vm
      Parameters:
      currentTime - current simulation time
      mipsShare - list with MIPS share of each Pe available to the scheduler
      Returns:
      the predicted completion time of the earliest finishing cloudlet (which is a relative delay from the current simulation time), or Double.MAX_VALUE if there is no next Cloudlet to execute
    • getFreePesNumber

      public long getFreePesNumber()
      Description copied from interface: Vm
      Gets the current number of free PEs.
      Specified by:
      getFreePesNumber in interface Vm
      Returns:
      the current free pes number
    • setFreePesNumber

      public Vm setFreePesNumber(long freePesNumber)
      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 interface Vm
      Returns:
      the expected free pes number
    • addExpectedFreePesNumber

      public Vm addExpectedFreePesNumber(long pesToAdd)
      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

      public Vm removeExpectedFreePesNumber(long pesToRemove)
      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 interface Vm
      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 interface Vm
      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 interface Vm
      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 interface Vm
      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 interface Vm
      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 interface Vm
      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 interface Vm
      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 interface Vm
      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 interface Vm
      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 interface Vm
      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 virtual Pe.
      Specified by:
      getTotalCpuMipsRequested in interface Vm
      Returns:
      the current requested total MIPS
      See Also:
    • getCurrentRequestedMips

      public MipsShare getCurrentRequestedMips()
      Description copied from interface: Vm
      Gets a copy list of current requested MIPS of each virtual Pe, avoiding the original list to be changed.
      Specified by:
      getCurrentRequestedMips in interface Vm
      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 interface Vm
      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 interface AbstractMachine<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 interface Vm
      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 interface AbstractMachine<Resource>
      Returns:
    • setStartTime

      public Vm setStartTime(double startTime)
      Description copied from interface: AbstractMachine
      Sets the current machine startup time. The value -1 means it was not started yet.
      Specified by:
      setStartTime in interface AbstractMachine<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 interface Vm
      Returns:
      See Also:
    • setStopTime

      public Vm setStopTime(double stopTime)
      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 interface Vm
      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 interface AbstractMachine<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 interface Vm
      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's Pe, considering that all PEs have the same capacity.
      Specified by:
      getMips in interface AbstractMachine<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 of Pes the machine has, that include PEs of all statuses, including failed PEs.
      Specified by:
      getNumberOfPes in interface AbstractMachine<Resource>
      Returns:
      the machine's number of PEs
    • getProcessor

      public Processor getProcessor()
      Description copied from interface: Vm
      Gets the Processor of this VM. It is its Virtual CPU which may be compounded of multiple Pes.
      Specified by:
      getProcessor in interface Vm
      Returns:
    • getRam

      public ResourceManageable 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 interface AbstractMachine<Resource>
      Specified by:
      getRam in interface Vm
      Returns:
      the RAM resource
    • setRam

      public final Vm setRam(long ramCapacity)
      Description copied from interface: Vm
      Sets RAM capacity in Megabytes.
      Specified by:
      setRam in interface Vm
      Parameters:
      ramCapacity - new RAM capacity
      Returns:
    • getBw

      public ResourceManageable 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 interface AbstractMachine<Resource>
      Specified by:
      getBw in interface Vm
      Returns:
      bandwidth resource.
    • setBw

      public final Vm setBw(long bwCapacity)
      Description copied from interface: Vm
      Sets the bandwidth capacity (in Megabits/s)
      Specified by:
      setBw in interface Vm
      Parameters:
      bwCapacity - new BW capacity (in Megabits/s)
      Returns:
    • getStorage

      public Resource 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 interface AbstractMachine<Resource>
      Specified by:
      getStorage in interface Vm
      Returns:
      the storage resource
    • setSize

      public final Vm setSize(long size)
      Description copied from interface: Vm
      Sets the storage size (capacity) of the VM image in Megabytes.
      Specified by:
      setSize in interface Vm
      Parameters:
      size - new storage size
      Returns:
    • getVmm

      public String getVmm()
      Description copied from interface: Vm
      Gets the Virtual Machine Monitor (VMM) that manages the VM.
      Specified by:
      getVmm in interface Vm
      Returns:
      VMM
    • setVmm

      protected final void setVmm(String vmm)
      Sets the Virtual Machine Monitor (VMM) that manages the VM.
      Parameters:
      vmm - the new VMM
    • setHost

      public Vm setHost(Host host)
      Description copied from interface: Vm
      Sets the PM that hosts the VM.
      Specified by:
      setHost in interface Vm
      Parameters:
      host - Host to run the VM
      Returns:
    • getHost

      public Host getHost()
      Description copied from interface: Vm
      Gets the Host where the Vm is or will be placed. To know if the Vm was already created inside this Host, call the Vm.isCreated() method.
      Specified by:
      getHost in interface Vm
      Returns:
      the Host
      See Also:
    • getCloudletScheduler

      public CloudletScheduler getCloudletScheduler()
      Description copied from interface: Vm
      Gets the Cloudlet scheduler the VM uses to schedule cloudlets execution.
      Specified by:
      getCloudletScheduler in interface Vm
      Returns:
      the cloudlet scheduler
    • setCloudletScheduler

      public final Vm setCloudletScheduler(CloudletScheduler cloudletScheduler)
      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 interface Vm
      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 interface Vm
      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 interface Vm
      Parameters:
      migrating - true to indicate the VM is migrating into a Host, false otherwise
    • updateMigrationStartListeners

      public void updateMigrationStartListeners(Host targetHost)
      Notifies the listeners when the VM starts migration to a target Host.
      Parameters:
      targetHost - the Host the VM is migrating to
    • updateMigrationFinishListeners

      public void updateMigrationFinishListeners(Host targetHost)
      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 the Host. If so, resources required by the Vm already were provisioned.
      Specified by:
      isCreated in interface Vm
      Returns:
      true, if it was created inside the Host, false otherwise
    • isSuitableForCloudlet

      public boolean isSuitableForCloudlet(Cloudlet cloudlet)
      Description copied from interface: Vm
      Checks if the VM has enough capacity to run a Cloudlet.
      Specified by:
      isSuitableForCloudlet in interface Vm
      Parameters:
      cloudlet - the candidate Cloudlet to run inside the VM
      Returns:
      true if the VM can run the Cloudlet, false otherwise TODO the Method is not being called anywhere to check if a VM has enough capacity to run a Cloudlet
    • 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 interface Vm
      Parameters:
      created - true to indicate the VM was created inside the Host; false otherwise
      See Also:
    • getStateHistory

      public List<VmStateHistoryEntry> 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 interface Vm
      Returns:
      the state history
      See Also:
    • addStateHistoryEntry

      public void addStateHistoryEntry(VmStateHistoryEntry entry)
      Description copied from interface: Vm
      Adds a VM state history entry.
      Specified by:
      addStateHistoryEntry in interface Vm
      Parameters:
      entry - the data about the state of the VM at given time
    • getResources

      public List<ResourceManageable> getResources()
      Description copied from interface: Resourceful
      Gets a read-only list of resources the machine has.
      Specified by:
      getResources in interface Resourceful
      Returns:
      a read-only list of resources
      See Also:
    • getResource

      public ResourceManageable getResource(Class<? extends ResourceManageable> resourceClass)
      Description copied from interface: Resourceful
      Gets a given AbstractMachine Resource, such as Ram or Bandwidth, from the List of machine resources.
      Specified by:
      getResource in interface Resourceful
      Parameters:
      resourceClass - the class of resource to get
      Returns:
      the Resource corresponding to the given class
    • addOnHostAllocationListener

      public Vm addOnHostAllocationListener(EventListener<VmHostEventInfo> listener)
      Description copied from interface: Vm
      Adds a listener object that will be notified when a Host 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 interface Vm
      Parameters:
      listener - the listener to add
      Returns:
      See Also:
    • addOnMigrationStartListener

      public Vm addOnMigrationStartListener(EventListener<VmHostEventInfo> listener)
      Description copied from interface: Vm
      Adds a listener object that will be notified when a VM starts migrating to a target Host. When the listener is notified, it receives a VmHostEventInfo object informing the target Host where the VM is being migrated.
      Specified by:
      addOnMigrationStartListener in interface Vm
      Parameters:
      listener - the listener to add
      Returns:
      See Also:
    • addOnMigrationFinishListener

      public Vm addOnMigrationFinishListener(EventListener<VmHostEventInfo> listener)
      Description copied from interface: Vm
      Adds a listener object that will be notified when a VM finishes migrating to a target Host. When the listener is notified, it receives a VmHostEventInfo object informing the target Host where the VM has just migrated.
      Specified by:
      addOnMigrationFinishListener in interface Vm
      Parameters:
      listener - the listener to add
      Returns:
    • addOnHostDeallocationListener

      public Vm addOnHostDeallocationListener(EventListener<VmHostEventInfo> listener)
      Description copied from interface: Vm
      Adds a listener object that will be notified when the Vm is moved/removed from a Host.
      Specified by:
      addOnHostDeallocationListener in interface Vm
      Parameters:
      listener - the listener to add
      Returns:
    • addOnCreationFailureListener

      public Vm addOnCreationFailureListener(EventListener<VmDatacenterEventInfo> listener)
      Description copied from interface: Vm
      Adds a listener object that will be notified when the Vm fail in being placed for lack of a Host with enough resources in a specific Datacenter.

      The DatacenterBroker is accountable for receiving the notification from the Datacenter and notifying the Listeners.

      Specified by:
      addOnCreationFailureListener in interface Vm
      Parameters:
      listener - the listener to add
      Returns:
      See Also:
    • addOnUpdateProcessingListener

      public Vm addOnUpdateProcessingListener(EventListener<VmHostEventInfo> listener)
      Description copied from interface: Vm
      Adds a listener object that will be notified every time when the processing of the Vm is updated in its Host.
      Specified by:
      addOnUpdateProcessingListener in interface Vm
      Parameters:
      listener - the listener to add
      Returns:
      See Also:
    • removeOnCreationFailureListener

      public boolean removeOnCreationFailureListener(EventListener<VmDatacenterEventInfo> listener)
      Description copied from interface: Vm
      Removes a listener from the onVmCreationFailureListener List.
      Specified by:
      removeOnCreationFailureListener in interface Vm
      Parameters:
      listener - the listener to remove
      Returns:
      true if the listener was found and removed, false otherwise
    • removeOnUpdateProcessingListener

      public boolean removeOnUpdateProcessingListener(EventListener<VmHostEventInfo> listener)
      Description copied from interface: Vm
      Removes a listener from the onUpdateVmProcessingListener List.
      Specified by:
      removeOnUpdateProcessingListener in interface Vm
      Parameters:
      listener - the listener to remove
      Returns:
      true if the listener was found and removed, false otherwise
    • removeOnHostAllocationListener

      public boolean removeOnHostAllocationListener(EventListener<VmHostEventInfo> listener)
      Description copied from interface: Vm
      Removes a listener from the onHostAllocationListener List.
      Specified by:
      removeOnHostAllocationListener in interface Vm
      Parameters:
      listener - the listener to remove
      Returns:
      true if the listener was found and removed, false otherwise
    • removeOnHostDeallocationListener

      public boolean removeOnHostDeallocationListener(EventListener<VmHostEventInfo> listener)
      Description copied from interface: Vm
      Removes a listener from the onHostDeallocationListener List.
      Specified by:
      removeOnHostDeallocationListener in interface Vm
      Parameters:
      listener - the listener to remove
      Returns:
      true if the listener was found and removed, false otherwise
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • compareTo

      public int compareTo(Vm obj)
      Compare this Vm with another one based on getTotalMipsCapacity().
      Specified by:
      compareTo in interface Comparable<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.
      Specified by:
      setFailed in interface Vm
      Parameters:
      failed - true to indicate that the VM is failed, false to indicate it is working
    • setCloudletsToFailed

      public void setCloudletsToFailed()
    • isFailed

      public boolean isFailed()
      Description copied from interface: Vm
      Checks if the Vm is failed or not.
      Specified by:
      isFailed in interface Vm
      Returns:
      See Also:
    • isWorking

      public boolean isWorking()
      Description copied from interface: Vm
      Checks if the Vm is working or failed.
      Specified by:
      isWorking in interface Vm
      Returns:
      See Also:
    • getSubmissionDelay

      public double getSubmissionDelay()
      Description copied from interface: Delayable
      Gets the time (in seconds) that a DatacenterBroker 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 interface Delayable
      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 a DatacenterBroker 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 interface Delayable
      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
      Specified by:
      isDelayed in interface Delayable
      Returns:
    • notifyOnHostAllocationListeners

      public void notifyOnHostAllocationListeners()
      Description copied from interface: Vm
      Notifies all registered listeners when a Host is allocated to the Vm.

      This method is used just internally and must not be called directly.

      Specified by:
      notifyOnHostAllocationListeners in interface Vm
    • notifyOnHostDeallocationListeners

      public void notifyOnHostDeallocationListeners(Host deallocatedHost)
      Description copied from interface: Vm
      Notifies all registered listeners when the Vm is moved/removed from a Host.

      This method is used just internally and must not be called directly.

      Specified by:
      notifyOnHostDeallocationListeners in interface Vm
      Parameters:
      deallocatedHost - the Host the Vm was moved/removed from
    • notifyOnUpdateProcessingListeners

      public void notifyOnUpdateProcessingListeners()
      Notifies all registered listeners when the processing of the Vm is updated in its Host.
    • notifyOnCreationFailureListeners

      public void notifyOnCreationFailureListeners(Datacenter failedDatacenter)
      Description copied from interface: Vm
      Notifies all registered listeners when the Vm fail in being placed for lack of a Host with enough resources in a specific Datacenter.

      This method is used just internally and must not be called directly.

      Specified by:
      notifyOnCreationFailureListeners in interface Vm
      Parameters:
      failedDatacenter - the Datacenter where the VM creation failed
    • removeOnMigrationStartListener

      public boolean removeOnMigrationStartListener(EventListener<VmHostEventInfo> listener)
      Description copied from interface: Vm
      Removes a listener from the onMigrationStartListener List.
      Specified by:
      removeOnMigrationStartListener in interface Vm
      Parameters:
      listener - the listener to remove
      Returns:
      true if the listener was found and removed, false otherwise
    • removeOnMigrationFinishListener

      public boolean removeOnMigrationFinishListener(EventListener<VmHostEventInfo> listener)
      Description copied from interface: Vm
      Removes a listener from the onMigrationFinishListener List.
      Specified by:
      removeOnMigrationFinishListener in interface Vm
      Parameters:
      listener - the listener to remove
      Returns:
      true if the listener was found and removed, false otherwise
    • getHorizontalScaling

      public HorizontalVmScaling getHorizontalScaling()
      Description copied from interface: Vm
      Gets a HorizontalVmScaling that will check if the Vm is overloaded, based on some conditions defined by a Predicate 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 interface Vm
      Returns:
    • setHorizontalScaling

      public final Vm setHorizontalScaling(HorizontalVmScaling horizontalScaling) throws IllegalArgumentException
      Description copied from interface: Vm
      Sets a HorizontalVmScaling that will check if the Vm is overloaded, based on some conditions defined by a Predicate given to the HorizontalVmScaling, and then request the creation of new VMs to horizontally scale the Vm.
      Specified by:
      setHorizontalScaling in interface 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

      public final Vm setRamVerticalScaling(VerticalVmScaling ramVerticalScaling) throws IllegalArgumentException
      Description copied from interface: Vm
      Sets a VerticalVmScaling that will check if the Vm's Ram is under or overloaded, based on some conditions defined by Predicates given to the VerticalVmScaling, and then request the RAM up or down scaling.
      Specified by:
      setRamVerticalScaling in interface Vm
      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 a VerticalVmScaling that will check if the Vm's Bandwidth is under or overloaded, based on some conditions defined by Predicates given to the VerticalVmScaling, and then request the Bandwidth up or down scaling.
      Specified by:
      setBwVerticalScaling in interface Vm
      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 a VerticalVmScaling that will check if the Vm's Pe is under or overloaded, based on some conditions defined by Predicates 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 interface Vm
      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

      public VerticalVmScaling getRamVerticalScaling()
      Description copied from interface: Vm
      Gets a VerticalVmScaling that will check if the Vm's RAM is overloaded, based on some conditions defined by a Predicate given to the VerticalVmScaling, and then request the RAM up scaling.
      Specified by:
      getRamVerticalScaling in interface Vm
      Returns:
    • getBwVerticalScaling

      public VerticalVmScaling getBwVerticalScaling()
      Description copied from interface: Vm
      Gets a VerticalVmScaling that will check if the Vm's Bandwidth is overloaded, based on some conditions defined by a Predicate given to the VerticalVmScaling, and then request the BW up scaling.
      Specified by:
      getBwVerticalScaling in interface Vm
      Returns:
    • getPeVerticalScaling

      public VerticalVmScaling getPeVerticalScaling()
      Description copied from interface: Vm
      Gets a VerticalVmScaling that will check if the Vm's Pe is overloaded, based on some conditions defined by a Predicate given to the VerticalVmScaling, and then request the RAM up scaling.
      Specified by:
      getPeVerticalScaling in interface Vm
      Returns:
    • getDescription

      public String 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 interface Vm
      Returns:
    • setDescription

      public Vm setDescription(String description)
      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 interface Vm
      Parameters:
      description - the Vm description to set
      Returns:
    • getGroup

      public VmGroup getGroup()
      Description copied from interface: Vm
      Gets the group this Vm belongs to
      Specified by:
      getGroup in interface Vm
      Returns:
      the VmGroup or NULL if the VM doesn't belong to a group
    • setGroup

      public void setGroup(VmGroup group)
    • getCpuUtilizationStats

      public VmResourceStats 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 interface ResourceStatsComputer<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 interface ResourceStatsComputer<VmResourceStats>
      Specified by:
      enableUtilizationStats in interface Vm
      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 [TimeZoned.MIN_TIME_ZONE_OFFSET and TimeZoned.MAX_TIME_ZONE_OFFSET], in which the object is physically located. That is the timezone in which the VM is expected to be placed (if there is a Datacenter 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 interface TimeZoned
      Specified by:
      getTimeZone in interface Vm
      Returns:
      the expected timezone to place this VM
    • setTimeZone

      public Vm setTimeZone(double timeZone)
      Description copied from interface: Vm
      Sets the time zone offset between [TimeZoned.MIN_TIME_ZONE_OFFSET and TimeZoned.MAX_TIME_ZONE_OFFSET]. That is the timezone in which the VM is expected to be placed (if there is a Datacenter with enough capacity available at that timezone).
      Specified by:
      setTimeZone in interface TimeZoned
      Specified by:
      setTimeZone in interface Vm
      Parameters:
      timeZone - the new expected time zone offset
      Returns:
    • getAllocatedMips

      public MipsShare getAllocatedMips()
    • setAllocatedMips

      public void setAllocatedMips(MipsShare allocatedMips)
    • getRequestedMips

      public MipsShare getRequestedMips()
    • setRequestedMips

      public void setRequestedMips(MipsShare requestedMips)