VmSimple

public class VmSimple 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.

Author:Rodrigo N. Calheiros, Anton Beloglazov

Constructors

VmSimple

public VmSimple(int id, long mipsCapacity, long numberOfPes)

Creates a Vm with 1024 MEGA of RAM, 1000 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.

Parameters:
  • id – unique ID of the VM
  • mipsCapacity – the mips capacity of each Vm Pe
  • numberOfPes – amount of Pe (CPU cores)

VmSimple

public VmSimple(long mipsCapacity, long numberOfPes)

Creates a Vm with 1024 MEGA of RAM, 1000 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 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 Vm Pe
  • numberOfPes – amount of Pe (CPU cores)

VmSimple

public VmSimple(int id, double mipsCapacity, long numberOfPes)

Creates a Vm with 1024 MEGA of RAM, 1000 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.

Parameters:
  • id – unique ID of the VM
  • mipsCapacity – the mips capacity of each Vm Pe
  • numberOfPes – amount of Pe (CPU cores)

Methods

addOnCreationFailureListener

public Vm addOnCreationFailureListener(EventListener<VmDatacenterEventInfo> listener)

addOnHostAllocationListener

public Vm addOnHostAllocationListener(EventListener<VmHostEventInfo> listener)

addOnHostDeallocationListener

public Vm addOnHostDeallocationListener(EventListener<VmHostEventInfo> listener)

addOnUpdateProcessingListener

public Vm addOnUpdateProcessingListener(EventListener<VmHostEventInfo> listener)

addStateHistoryEntry

public void addStateHistoryEntry(VmStateHistoryEntry entry)

allocateResource

public void allocateResource(Class<? extends ResourceManageable> resourceClass, long newTotalResourceAmount)

compareTo

public int compareTo(Vm o)

Compare this Vm with another one based on getTotalMipsCapacity().

Parameters:
  • o – the Vm to compare to
Returns:

{@inheritDoc}

deallocateResource

public void deallocateResource(Class<? extends ResourceManageable> resourceClass)

equals

public boolean equals(Object o)

getBroker

public DatacenterBroker getBroker()

getBw

public Resource getBw()

getBwVerticalScaling

public VerticalVmScaling getBwVerticalScaling()

getCloudletScheduler

public CloudletScheduler getCloudletScheduler()

getCpuPercentUsage

public double getCpuPercentUsage()

getCpuPercentUsage

public double getCpuPercentUsage(double time)

getCurrentRequestedBw

public long getCurrentRequestedBw()

getCurrentRequestedMaxMips

public double getCurrentRequestedMaxMips()

getCurrentRequestedMips

public List<Double> getCurrentRequestedMips()

getCurrentRequestedRam

public long getCurrentRequestedRam()

getCurrentRequestedTotalMips

public double getCurrentRequestedTotalMips()

getDescription

public String getDescription()

getHorizontalScaling

public HorizontalVmScaling getHorizontalScaling()

getHost

public Host getHost()

getId

public long getId()

getIdleInterval

public double getIdleInterval()

getLastBusyTime

public double getLastBusyTime()

getMips

public double getMips()

getNumberOfPes

public long getNumberOfPes()

getPeVerticalScaling

public VerticalVmScaling getPeVerticalScaling()

getProcessor

public Processor getProcessor()

getRam

public Resource getRam()

getRamVerticalScaling

public VerticalVmScaling getRamVerticalScaling()

getResources

public List<ResourceManageable> getResources()

getSimulation

public Simulation getSimulation()

getStartTime

public double getStartTime()

getStateHistory

public List<VmStateHistoryEntry> getStateHistory()

getStopTime

public double getStopTime()

getStorage

public Resource getStorage()

getSubmissionDelay

public double getSubmissionDelay()

getTotalCpuMipsUsage

public double getTotalCpuMipsUsage()

getTotalCpuMipsUsage

public double getTotalCpuMipsUsage(double time)

getTotalExecutionTime

public double getTotalExecutionTime()

getTotalMipsCapacity

public double getTotalMipsCapacity()

getUid

public String getUid()

getUtilizationHistory

public UtilizationHistory getUtilizationHistory()

getVmm

public String getVmm()

hashCode

public int hashCode()

isCreated

public final boolean isCreated()

isFailed

public boolean isFailed()

isIdle

public boolean isIdle()

isIdleEnough

public boolean isIdleEnough(double time)

isInMigration

public boolean isInMigration()

isSuitableForCloudlet

public boolean isSuitableForCloudlet(Cloudlet cloudlet)

isWorking

public boolean isWorking()

notifyOnCreationFailureListeners

public void notifyOnCreationFailureListeners(Datacenter failedDatacenter)

notifyOnHostAllocationListeners

public void notifyOnHostAllocationListeners()

notifyOnHostDeallocationListeners

public void notifyOnHostDeallocationListeners(Host deallocatedHost)

notifyOnUpdateProcessingListeners

public void notifyOnUpdateProcessingListeners()

Notifies all registered listeners when the processing of the Vm is updated in its Host.

removeOnCreationFailureListener

public boolean removeOnCreationFailureListener(EventListener<VmDatacenterEventInfo> listener)

removeOnHostAllocationListener

public boolean removeOnHostAllocationListener(EventListener<VmHostEventInfo> listener)

removeOnHostDeallocationListener

public boolean removeOnHostDeallocationListener(EventListener<VmHostEventInfo> listener)

removeOnUpdateProcessingListener

public boolean removeOnUpdateProcessingListener(EventListener<VmHostEventInfo> listener)

setBroker

public final Vm setBroker(DatacenterBroker broker)

setBw

public final Vm setBw(long bwCapacity)

setBwVerticalScaling

public final Vm setBwVerticalScaling(VerticalVmScaling bwVerticalScaling)

setCloudletScheduler

public final Vm setCloudletScheduler(CloudletScheduler cloudletScheduler)

setCreated

public final void setCreated(boolean created)

setDescription

public Vm setDescription(String description)

setFailed

public void setFailed(boolean failed)

setHorizontalScaling

public final Vm setHorizontalScaling(HorizontalVmScaling horizontalScaling)

setHost

public final void setHost(Host host)

setId

public final void setId(long id)

Sets the VM id.

Parameters:
  • id – the new VM id, that has to be unique for the current broker

setInMigration

public final void setInMigration(boolean migrating)

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

setPeVerticalScaling

public final Vm setPeVerticalScaling(VerticalVmScaling peVerticalScaling)

setRam

public final Vm setRam(long ramCapacity)

setRamVerticalScaling

public final Vm setRamVerticalScaling(VerticalVmScaling ramVerticalScaling)

setSize

public final Vm setSize(long size)

setStartTime

public Vm setStartTime(double startTime)

setStopTime

public Vm setStopTime(double stopTime)

setSubmissionDelay

public final void setSubmissionDelay(double submissionDelay)

setVmm

protected final void setVmm(String vmm)

Sets the Virtual Machine Monitor (VMM) that manages the VM.

Parameters:
  • vmm – the new VMM

toString

public String toString()

updateProcessing

public double updateProcessing(double currentTime, List<Double> mipsShare)