Class VmSchedulerAbstract
java.lang.Object
org.cloudsimplus.schedulers.vm.VmSchedulerAbstract
- All Implemented Interfaces:
VmScheduler
- Direct Known Subclasses:
VmSchedulerSpaceShared,VmSchedulerTimeShared
An abstract class for implementation of
VmSchedulers.- Since:
- CloudSim Toolkit 1.0
- Author:
- Rodrigo N. Calheiros, Anton Beloglazov, Manoel Campos da Silva Filho
-
Field Summary
Fields inherited from interface org.cloudsimplus.schedulers.vm.VmScheduler
DEF_VM_MIGRATION_CPU_OVERHEAD, LOGGER, NULL -
Constructor Summary
ConstructorsConstructorDescriptionVmSchedulerAbstract(double vmMigrationCpuOverhead) Creates a VmScheduler, defining a CPU overhead for VM migration. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanallocatePesForVm(@NonNull Vm vm, @NonNull MipsShare requestedMips) Requests the allocation of PEs for a VM.final booleanallocatePesForVm(Vm vm) Requests the allocation of PEs for a VM, according to the number of PEs and MIPS defined by VM attributes.protected abstract booleanallocatePesForVmInternal(Vm vm, MipsShare mipsShareRequested) voidReleases all PEs allocated to a VM.voiddeallocatePesFromVm(Vm vm, int pesToRemove) Releases a given number of PEs from a VM.protected abstract longdeallocatePesFromVmInternal(Vm vm, int pesToRemove) getAllocatedMips(@NonNull Vm vm) Gets the MIPS share of each Host's Pe that is allocated to a given VM.doubleGets the max percentage of CPU a VM migrating out of this Host can use.protected MipsSharegetMipsShareRequestedReduced(Vm vm, MipsShare mipsShareRequested) Gets an adjusted MIPS share requested by a VM, reducing every MIPS which is higher than the capacity of each physical PE to that value.longgetRequestedMips(Vm vm) Gets the MIPS share requested by a VMdoubleReturns the actual total allocated MIPS for a VM along all its allocated PEs.doubleReturns the total amount of MIPS that is currently free.final booleanisSuitableForVm(@NonNull Vm vm, @NonNull MipsShare requestedMips) Checks if the MIPS share requested by a VM can be allocated or not.final booleanisSuitableForVm(Vm vm) Checks if the PM using this scheduler has enough MIPS capacity to host a given VM.protected abstract booleanisSuitableForVmInternal(Vm vm, MipsShare requestedMips) protected doubleGets the percentage of the MIPS requested by a VM that will be in fact requested to the Host, according to the VM migration status:protected final longremovePesFromVm(Vm vm, MipsShare mipsShare, long pesToRemove) Tries to remove a given number of PEs allocated to a VMfinal VmSchedulerSets the Host that the VmScheduler get the list of PEs to allocate to VMs.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.cloudsimplus.schedulers.vm.VmScheduler
getHost, getVmMigrationCpuOverhead
-
Constructor Details
-
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 the Host. The value is in scale from 0 to 1 (where 1 is 100%).
-
-
Method Details
-
isSuitableForVm
Description copied from interface:VmSchedulerChecks if the PM using this scheduler has enough MIPS capacity to host a given VM.- Specified by:
isSuitableForVmin interfaceVmScheduler- Parameters:
vm- the VM to check if there is enough available resource capacity on the PM to host it- Returns:
- true, if it is possible to allocate the VM into the host; false otherwise
- See Also:
-
allocatePesForVm
Description copied from interface:VmSchedulerRequests the allocation of PEs for a VM, according to the number of PEs and MIPS defined by VM attributes.- Specified by:
allocatePesForVmin interfaceVmScheduler- Parameters:
vm- the VM to allocate PEs to- Returns:
- true if the PEs were allocated to the VM, false otherwise
-
deallocatePesFromVm
Description copied from interface:VmSchedulerReleases all PEs allocated to a VM. After that, the PEs may be used on demand by other VMs.- Specified by:
deallocatePesFromVmin interfaceVmScheduler- Parameters:
vm- the VM to deallocate PEs from
-
deallocatePesFromVm
Description copied from interface:VmSchedulerReleases a given number of PEs from a VM. After that, the PEs may be used on demand by other VMs.- Specified by:
deallocatePesFromVmin interfaceVmScheduler- Parameters:
vm- the VM to deallocate PEs frompesToRemove- number of PEs to deallocate
-
deallocatePesFromVmInternal
-
getAllocatedMips
Description copied from interface:VmSchedulerGets the MIPS share of each Host's Pe that is allocated to a given VM.- Specified by:
getAllocatedMipsin interfaceVmScheduler- Parameters:
vm- the vm to get the MIPS share- Returns:
- the VM allocated MIPS share
-
getTotalAllocatedMipsForVm
Description copied from interface:VmSchedulerReturns the actual total allocated MIPS for a VM along all its allocated PEs. If the VM is migrating into the Host, then just a fraction of the requested MIPS is actually allocated, representing the overhead of the migration process.The MIPS requested by the VM are just actually allocated after the migration is completed.
- Specified by:
getTotalAllocatedMipsForVmin interfaceVmScheduler- Parameters:
vm- the VM to get the total allocated MIPS- Returns:
- the actual total allocated MIPS for a VM along all its allocated PEs
- See Also:
-
getPeCapacity
public long getPeCapacity()- Returns:
- PE capacity in MIPS.
- To do something:
- It considers that all PEs have the same capacity, which has been shown it isn't assured. The peList received by the VmScheduler can have heterogeneous PEs.
-
getWorkingPeList
-
getRequestedMips
Description copied from interface:VmSchedulerGets the MIPS share requested by a VM- Specified by:
getRequestedMipsin interfaceVmScheduler- Parameters:
vm- the VM to get the List of requested MIPS- Returns:
- VM requested MIPS share
-
getTotalAvailableMips
public double getTotalAvailableMips()Description copied from interface:VmSchedulerReturns the total amount of MIPS that is currently free. If there are VMs migrating into the Host, their requested MIPS will already be allocated, reducing the total available MIPS.- Specified by:
getTotalAvailableMipsin interfaceVmScheduler- Returns:
- the total amount of MIPS that is currently free
-
mipsPercentToRequest
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 the VM will be reduced according to the CPU migration overhead. The Host uses the number of MIPS corresponding to the CPU overhead 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%)
-
getMaxCpuUsagePercentDuringOutMigration
public double getMaxCpuUsagePercentDuringOutMigration()Description copied from interface:VmSchedulerGets the max percentage of CPU a VM migrating out of this Host can use. Since there may be an overhead associated with the migration process (if the CPU overhead for VM migration is greater than 0), during the migration, the amount of MIPS the VM can use is reduced due to this overhead.- Specified by:
getMaxCpuUsagePercentDuringOutMigrationin interfaceVmScheduler- Returns:
- the max percentage of CPU usage during migration (in scale from [0 to 1], where 1 is 100%)
-
setHost
Description copied from interface:VmSchedulerSets the Host that the VmScheduler get the list of PEs to allocate to VMs. A Host for the VmScheduler is defined when the VmScheduler is set to a given Host. Thus, the Host is in charge to set itself to a VmScheduler.- Specified by:
setHostin interfaceVmScheduler- Parameters:
host- the Host to be set- Returns:
- this scheduler
-