VmSchedulerAbstract

public abstract class VmSchedulerAbstract implements VmScheduler

An abstract class for implementation of VmSchedulers.

Author:Rodrigo N. Calheiros, Anton Beloglazov, Manoel Campos da Silva Filho

Fields

DEFAULT_VM_MIGRATION_CPU_OVERHEAD

public static final double DEFAULT_VM_MIGRATION_CPU_OVERHEAD

The default percentage to define the CPU overhead of VM migration if one is not explicitly set.

See also: .getVmMigrationCpuOverhead()

Constructors

VmSchedulerAbstract

public VmSchedulerAbstract(double vmMigrationCpuOverhead)

Creates a VmScheduler, defining a CPU overhead for VM migration.

Parameters:
  • vmMigrationCpuOverhead – the percentage of Host’s CPU usage increase when a VM is migrating in or out of the Host. The value is in scale from 0 to 1 (where 1 is 100%).

Methods

allocatePesForVm

public final boolean allocatePesForVm(Vm vm)

allocatePesForVm

public final boolean allocatePesForVm(Vm vm, List<Double> requestedMips)

allocatePesForVmInternal

protected abstract boolean allocatePesForVmInternal(Vm vm, List<Double> mipsShareRequested)

deallocatePesForAllVms

public void deallocatePesForAllVms()

deallocatePesFromVm

public void deallocatePesFromVm(Vm vm)

deallocatePesFromVm

public void deallocatePesFromVm(Vm vm, int pesToRemove)

deallocatePesFromVmInternal

protected abstract void deallocatePesFromVmInternal(Vm vm, int pesToRemove)

getAllocatedMips

public List<Double> getAllocatedMips(Vm vm)

getAllocatedMipsMap

protected Map<Vm, List<Double>> getAllocatedMipsMap()

Gets a map of MIPS allocated to each VM, were each key is a VM and each value is the List of currently allocated MIPS from the respective physical PEs which are being used by such a VM.

When VM is in migration, the allocated MIPS in the source Host is reduced due to migration overhead, according to the getVmMigrationCpuOverhead(). This is a situation that the allocated MIPS will be lower than the requested MIPS.

Returns:the allocated MIPS map

See also: .getAllocatedMips(Vm), .getRequestedMipsMap()

getAvailableMips

public double getAvailableMips()

getHost

public Host getHost()

getMaxAvailableMips

public double getMaxAvailableMips()

getMaxCpuUsagePercentDuringOutMigration

public double getMaxCpuUsagePercentDuringOutMigration()

getMipsShareRequestedReduced

protected List<Double> getMipsShareRequestedReduced(Vm vm, List<Double> mipsShareRequested)

Gets an adjusted List of MIPS requested by a VM, reducing every MIPS which is higher than the capacity of each physical PE to that value.

Parameters:
  • vm – the VM to get the MIPS requested
  • mipsShareRequested – the VM requested MIPS List
Returns:

the VM requested MIPS List without MIPS higher than the PE capacity.

getPeCapacity

public long getPeCapacity()

getRequestedMips

public List<Double> getRequestedMips(Vm vm)

getRequestedMipsMap

protected Map<Vm, List<Double>> getRequestedMipsMap()

Gets a map of MIPS requested by each VM, where each key is a VM and each value is a list of MIPS requested by that VM. When a VM is going to be placed into a Host, its requested MIPS is a list where each element is the MIPS capacity of each VM Pe and the list size is the number of PEs.

Returns:the requested MIPS map

getTotalAllocatedMipsForVm

public double getTotalAllocatedMipsForVm(Vm vm)

getVmMigrationCpuOverhead

public double getVmMigrationCpuOverhead()

getWorkingPeList

public final List<Pe> getWorkingPeList()

isSuitableForVm

public final boolean isSuitableForVm(Vm vm, boolean showLog)

isSuitableForVm

public boolean isSuitableForVm(Vm vm, List<Double> requestedMips, boolean showLog)

isSuitableForVmInternal

protected abstract boolean isSuitableForVmInternal(Vm vm, List<Double> requestedMips, boolean showLog)

percentOfMipsToRequest

protected double percentOfMipsToRequest(Vm vm)

Gets the percentage of the MIPS requested by a VM that will be in fact requested to the Host, according to the VM migration status:

  • VM is migrating out of this Host: the MIPS requested by VM will be reduced according to the CPU migration overhead. The number of MIPS corresponding to the CPU overhead is used by the Host to perform the migration;
  • VM is migrating into this Host: only a fraction of its requested MIPS will be in fact requested to the Host. This amount is computed by reducing the CPU migration overhead;
  • VM is not in migration: 100% of its requested MIPS will be in fact requested to the Host
Parameters:
  • vm – the VM that is requesting MIPS from the Host
Returns:

the percentage of MIPS requested by the VM that will be in fact requested to the Host (in scale from [0 to 1], where is 100%)

removePesFromMap

protected <T> int removePesFromMap(Vm vm, Map<Vm, List<T>> map, int pesToRemove)

Remove a given number of PEs from a given Vm -> List<PE> Map, where each PE in the List associated to each Vm may be an actual Pe object or just its capacity in MIPS (Double).

In other words, the map can be Map<Vm, List<Double>> or Map<Vm, List<Pe>>.

Parameters:
  • <T> – the type of the elements into the List associated to each map key, which can be a MIPS number (Double) or an actual Pe object.
  • vm – the VM to remove PEs from
  • map – the map where the PEs will be removed
  • pesToRemove – the number of PEs to remove from the List of PEs associated to the Vm
Returns:

the number of removed PEs

setHost

public final VmScheduler setHost(Host host)