VmSimple

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.

Author:Rodrigo N. Calheiros, Anton Beloglazov

Constructors

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 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.

NOTE: The Vm will use a CloudletSchedulerTimeShared by default. If you need to change that, just call setCloudletScheduler(CloudletScheduler).

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

See also: .setRam(long), .setBw(long), .setStorage(Storage), .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 call setCloudletScheduler(CloudletScheduler).

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

See also: .setRam(long), .setBw(long), .setStorage(Storage), .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 call setCloudletScheduler(CloudletScheduler).

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

See also: .setRam(long), .setBw(long), .setStorage(Storage), .setDefaultRamCapacity(long), .setDefaultBwCapacity(long), .setDefaultStorageCapacity(long)

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)

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()

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.

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.

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.

getDescription

public String getDescription()

getHorizontalScaling

public HorizontalVmScaling getHorizontalScaling()

getHost

public Host getHost()

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()

getRelativeMipsCapacityPercent

public double getRelativeMipsCapacityPercent()

getResources

public List<ResourceManageable> getResources()

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()

getUtilizationHistory

public UtilizationHistory getUtilizationHistory()

getVmm

public String getVmm()

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)

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)

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.

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.

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.

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)

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(List<Double> mipsShare)

updateProcessing

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