Package org.cloudbus.cloudsim.hosts
Class HostSimple
java.lang.Object
org.cloudbus.cloudsim.hosts.HostSimple
- All Implemented Interfaces:
Comparable<Host>
,AbstractMachine
,ChangeableId
,Identifiable
,Machine
,ResourceStatsComputer<HostResourceStats>
,Host
,PowerAware<PowerModelHost>
,Resourceful
- Direct Known Subclasses:
NetworkHost
public class HostSimple extends Object implements Host
A Host class that implements the most basic features of a Physical Machine
(PM) inside a
Datacenter
. It executes actions related to management
of virtual machines (e.g., creation and destruction). A host has a defined
policy for provisioning memory and bw, as well as an allocation policy for
PEs to virtual machines
. A host is associated to a Datacenter and
can host virtual machines.- Since:
- CloudSim Toolkit 1.0
- Author:
- Rodrigo N. Calheiros, Anton Beloglazov
-
Field Summary
Fields Modifier and Type Field Description protected HostResourceStats
cpuUtilizationStats
Fields inherited from interface org.cloudbus.cloudsim.hosts.Host
DEF_IDLE_SHUTDOWN_DEADLINE, LOGGER, NULL
-
Constructor Summary
Constructors Constructor Description HostSimple(long ram, long bw, long storage, List<Pe> peList)
Creates and powers on a Host without a pre-defined ID.HostSimple(long ram, long bw, long storage, List<Pe> peList, boolean activate)
Creates a Host without a pre-defined ID.HostSimple(List<Pe> peList)
Creates and powers on a Host without a pre-defined ID, 10GB of RAM, 1000Mbps of Bandwidth and 500GB of Storage.HostSimple(List<Pe> peList, boolean activate)
Creates a Host without a pre-defined ID, 10GB of RAM, 1000Mbps of Bandwidth and 500GB of Storage and enabling the host to be powered on or not.HostSimple(ResourceProvisioner ramProvisioner, ResourceProvisioner bwProvisioner, long storage, List<Pe> peList)
Creates and powers on a Host with the given parameters and aVmSchedulerSpaceShared
as default. -
Method Summary
Modifier and Type Method Description boolean
addMigratingInVm(Vm vm)
Try to add a VM migrating into the current host if there is enough resources for it.Host
addOnShutdownListener(EventListener<HostEventInfo> listener)
Adds a listener object that will be notified every time the host is powered off.Host
addOnStartupListener(EventListener<HostEventInfo> listener)
Adds a listener object that will be notified every time the host is powered on.Host
addOnUpdateProcessingListener(EventListener<HostUpdatesVmsProcessingEventInfo> listener)
Adds a listener object that will be notified every time the host updates the processing of all itsVMs
.boolean
addVmMigratingOut(Vm vm)
Adds aVm
to the list of VMs migrating out from the Host.protected void
addVmToCreatedList(Vm vm)
protected void
addVmToList(Vm vm)
int
compareTo(Host o)
Compare this Host with another one based ongetTotalMipsCapacity()
.HostSuitability
createTemporaryVm(Vm vm)
Try to allocate resources to a new temporary VM in the Host.HostSuitability
createVm(Vm vm)
Try to allocate resources to a new VM in the Host.protected void
deallocateResourcesOfAllVms()
Deallocate all resources that all VMs were using.protected void
deallocateResourcesOfVm(Vm vm)
Deallocate all resources that a VM was using.void
destroyAllVms()
Destroys all VMs running in the host and remove them from theHost.getVmList()
.void
destroyTemporaryVm(Vm vm)
Destroys a temporary VM created into the Host to book resources.void
destroyVm(Vm vm)
Destroys a VM running in the host and removes it from theHost.getVmList()
.void
disableStateHistory()
Disable storing Host state history.void
enableStateHistory()
Enables storing Host state history.void
enableUtilizationStats()
Enables the data collection and computation of utilization statistics.boolean
equals(Object o)
protected MipsShare
getAllocatedMipsForVm(Vm vm)
Gets the MIPS share of each Pe that is allocated to a given VM.long
getAvailableStorage()
Gets the total free storage available at the host in Megabytes.List<Pe>
getBusyPeList()
Gets the list of working Processing Elements (PEs) of the host, which excludes failed PEs.int
getBusyPesNumber()
Gets the number of PEs that arePe.Status.BUSY
.double
getBusyPesPercent()
Gets the current percentage (from 0..1) of used (busy) PEs, according to thetotal number of PEs
.double
getBusyPesPercent(boolean hundredScale)
Gets the current percentage of used (busy) PEs, according to thetotal number of PEs
.Resource
getBw()
Gets the machine bandwidth (bw) capacity in Megabits/s.ResourceProvisioner
getBwProvisioner()
Gets the bandwidth (BW) provisioner with capacity in Megabits/s.long
getBwUtilization()
Gets the current utilization of bw (in Megabits/s).double
getCpuMipsUtilization()
Gets the current total utilization of CPU in MIPS, considering the usage of all its PEs.double
getCpuPercentUtilization()
Gets current utilization of CPU in percentage (between [0 and 1]), considering the usage of all its PEs..HostResourceStats
getCpuUtilizationStats()
Gets machine's CPU utilization percentage statistics (between [0 and 1]).Datacenter
getDatacenter()
Gets the Datacenter where the host is placed.static long
getDefaultBwCapacity()
Gets the Default Bandwidth capacity (in Mbps) for creating Hosts.static long
getDefaultRamCapacity()
Gets the Default RAM capacity (in MB) for creating Hosts.static long
getDefaultStorageCapacity()
Gets the Default Storage capacity (in MB) for creating Hosts.int
getFailedPesNumber()
Gets the number of PEs that have failed.List<Vm>
getFinishedVms()
Gets the List of VMs that have finished executing.double
getFirstStartTime()
Gets the first time the Host was powered-on (in seconds).List<Pe>
getFreePeList()
Gets the list of Free Processing Elements (PEs) of the host, which excludes failed PEs.int
getFreePesNumber()
Gets the number of PEs that are free to be used by any VM.long
getId()
double
getIdleShutdownDeadline()
Gets the deadline to shutdown the Host when it become idle.double
getLastBusyTime()
Gets the last time the Machine was running some process.List<Vm>
getMigratableVms()
Gets the list of migratable VMs from a given host.double
getMips()
Gets the individual MIPS capacity of any machine'sPe
, considering that all PEs have the same capacity.long
getNumberOfPes()
Gets the overall number ofPe
s the machine has, that include PEs of all statuses, including failed PEs.List<Pe>
getPeList()
Gets the list of all Processing Elements (PEs) of the host, including failed PEs.PowerModelHost
getPowerModel()
Gets thePowerModelHost
used by the host to define how it consumes power.ResourceProvisioner
getProvisioner(Class<? extends ResourceManageable> resourceClass)
Resource
getRam()
Gets the machine memory resource in Megabytes.ResourceProvisioner
getRamProvisioner()
Gets the ram provisioner with capacity in Megabytes.long
getRamUtilization()
Gets the current utilization of memory (in Megabytes).List<ResourceManageable>
getResources()
Gets a read-only list of resources the machine has.double
getShutdownTime()
Gets the last time the Host was shut down (in seconds).Simulation
getSimulation()
Gets the CloudSim instance that represents the simulation the Entity is related to.double
getStartTime()
Gets the last time the machine was started up (in seconds).List<HostStateHistoryEntry>
getStateHistory()
Gets a read-only host state history.Resource
getStorage()
Gets the storage device of the machine with capacity in Megabytes.HostSuitability
getSuitabilityFor(Vm vm)
Checks if the host is suitable for a Vm (if it has enough resources to attend the Vm) and the Host is not failed, providing fine-grained information about each individual Host's resource suitability.double
getTotalAllocatedMips()
Gets the total allocated MIPS at the host.double
getTotalAllocatedMipsForVm(Vm vm)
Gets the total allocated MIPS for a VM along all its PEs.double
getTotalAvailableMips()
Gets the current total amount of available MIPS at the host.double
getTotalMipsCapacity()
Gets total MIPS capacity of PEs which are notPe.Status.FAILED
.double
getTotalUpTime()
Gets the total time the Host stayed active (powered on).double
getTotalUpTimeHours()
Gets the total time the Host stayed active (powered on).double
getUpTime()
Gets the elapsed time since the last power on.double
getUpTimeHours()
Gets the elapsed time in hours since the last power on.<T extends Vm>
List<T>getVmCreatedList()
Gets a read-only list of all VMs which have been created into the host during the entire simulation.<T extends Vm>
List<T>getVmList()
Gets a read-only list of VMs currently assigned to the host.VmScheduler
getVmScheduler()
Gets the policy for allocation of host PEs to VMs in order to schedule VM execution.<T extends Vm>
Set<T>getVmsMigratingIn()
Gets the list of VMs migrating into this host.Set<Vm>
getVmsMigratingOut()
Gets a read-only list of VMs migrating out from the Host.List<Pe>
getWorkingPeList()
Gets the list of working Processing Elements (PEs) of the host.int
getWorkingPesNumber()
Gets the number of PEs that are working.boolean
hasEverStarted()
Checks if the Host has ever started sometime, i.e., if it was active sometime in the simulation execution.int
hashCode()
boolean
hasMigratingVms()
Checks if there is any VMs migrating in or out this host.boolean
isActive()
Checks if the Host is powered-on or not.boolean
isFailed()
Checks if the host is working properly or has failed.boolean
isLazySuitabilityEvaluation()
Checks if the suitability evaluation of this Host for a given Vm is to be performed lazily by methods such asHost.isSuitableForVm(Vm)
.boolean
isStateHistoryEnabled()
Checks if Host state history is being collected and stored.boolean
isSuitableForVm(Vm vm)
Checks if the host is suitable for a Vm (if it has enough resources to attend the Vm) and the Host is not failed.void
reallocateMigratingInVms()
Reallocate VMs migrating into the host.void
removeMigratingInVm(Vm vm)
Removes a VM migrating into this Host from the migrating-in list, so that the VM can be actually placed into the Host and the migration process finished.boolean
removeOnShutdownListener(EventListener<HostEventInfo> listener)
Removes a Listener object from the registered List.boolean
removeOnStartupListener(EventListener<HostEventInfo> listener)
Removes a Listener object from the registered List.boolean
removeOnUpdateProcessingListener(EventListener<HostUpdatesVmsProcessingEventInfo> listener)
Removes a Listener object from the registered List.boolean
removeVmMigratingOut(Vm vm)
Adds aVm
to the list of VMs migrating out from the Host.Host
setActive(boolean activate)
Sets the powered state of the Host, to indicate if it's powered on or off.Host
setBwProvisioner(ResourceProvisioner bwProvisioner)
Sets the bandwidth (BW) provisioner with capacity in Megabits/s.void
setDatacenter(Datacenter datacenter)
Sets the Datacenter where the host is placed.static void
setDefaultBwCapacity(long defaultCapacity)
Sets the Default Bandwidth capacity (in Mbps) for creating Hosts.static void
setDefaultRamCapacity(long defaultCapacity)
Sets the Default RAM capacity (in MB) for creating Hosts.static void
setDefaultStorageCapacity(long defaultCapacity)
Sets the Default Storage capacity (in MB) for creating Hosts.boolean
setFailed(boolean failed)
Sets the Host state to "failed" or "working".void
setId(long id)
Host
setIdleShutdownDeadline(double deadline)
Sets the deadline to shutdown the Host when it become idle.Host
setLazySuitabilityEvaluation(boolean lazySuitabilityEvaluation)
Defines if the suitability evaluation of this Host for a given Vm is to be performed lazily by methods such asHost.isSuitableForVm(Vm)
.void
setPeStatus(List<Pe> peList, Pe.Status newStatus)
Sets the status of a given (sub)list ofPe
to a new status.void
setPowerModel(PowerModelHost powerModel)
Sets thePowerModelHost
used by the host to define how it consumes power.Host
setRamProvisioner(ResourceProvisioner ramProvisioner)
Sets the ram provisioner with capacity in Megabytes.void
setShutdownTime(double shutdownTime)
Sets the the Host shut down time.Host
setSimulation(Simulation simulation)
Sets the CloudSim instance that represents the simulation the Entity is related to.Host
setStartTime(double startTime)
Sets the current machine startup time.Host
setVmScheduler(VmScheduler vmScheduler)
Sets the policy for allocation of host PEs to VMs in order to schedule VM execution.String
toString()
double
updateProcessing(double currentTime)
Updates the processing of VMs running on this Host, that makes the processing of cloudlets inside such VMs to be updated.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.cloudbus.cloudsim.core.AbstractMachine
getIdleInterval, isIdle, isIdleEnough
Methods inherited from interface org.cloudbus.cloudsim.core.Machine
getExpectedRelativeCpuUtilization, getRelativeBwUtilization, getRelativeCpuUtilization, getRelativeMipsCapacityPercent, getRelativeRamUtilization
Methods inherited from interface org.cloudbus.cloudsim.resources.Resourceful
getResource
-
Field Details
-
cpuUtilizationStats
-
-
Constructor Details
-
HostSimple
Creates and powers on a Host without a pre-defined ID, 10GB of RAM, 1000Mbps of Bandwidth and 500GB of Storage. It creates aResourceProvisionerSimple
for RAM and Bandwidth. Finally, it sets aVmSchedulerSpaceShared
as default. The ID is automatically set when a List of Hosts is attached to aDatacenter
.- Parameters:
peList
- the host'sPe
list- See Also:
ChangeableId.setId(long)
,setRamProvisioner(ResourceProvisioner)
,setBwProvisioner(ResourceProvisioner)
,setVmScheduler(VmScheduler)
,setDefaultRamCapacity(long)
,setDefaultBwCapacity(long)
,setDefaultStorageCapacity(long)
-
HostSimple
Creates a Host without a pre-defined ID, 10GB of RAM, 1000Mbps of Bandwidth and 500GB of Storage and enabling the host to be powered on or not.It creates a
ResourceProvisionerSimple
for RAM and Bandwidth. Finally, it sets aVmSchedulerSpaceShared
as default. The ID is automatically set when a List of Hosts is attached to aDatacenter
.- Parameters:
peList
- the host'sPe
listactivate
- define the Host activation status: true to power on, false to power off- See Also:
ChangeableId.setId(long)
,setRamProvisioner(ResourceProvisioner)
,setBwProvisioner(ResourceProvisioner)
,setVmScheduler(VmScheduler)
,setDefaultRamCapacity(long)
,setDefaultBwCapacity(long)
,setDefaultStorageCapacity(long)
-
HostSimple
public HostSimple(ResourceProvisioner ramProvisioner, ResourceProvisioner bwProvisioner, long storage, List<Pe> peList)Creates and powers on a Host with the given parameters and aVmSchedulerSpaceShared
as default.- Parameters:
ramProvisioner
- the ram provisioner with capacity in MegabytesbwProvisioner
- the bw provisioner with capacity in Megabits/sstorage
- the storage capacity in MegabytespeList
- the host's PEs list- See Also:
setVmScheduler(VmScheduler)
-
HostSimple
Creates and powers on a Host without a pre-defined ID. It uses aResourceProvisionerSimple
for RAM and Bandwidth and also sets aVmSchedulerSpaceShared
as default. The ID is automatically set when a List of Hosts is attached to aDatacenter
.- Parameters:
ram
- the RAM capacity in Megabytesbw
- the Bandwidth (BW) capacity in Megabits/sstorage
- the storage capacity in MegabytespeList
- the host'sPe
list- See Also:
ChangeableId.setId(long)
,setRamProvisioner(ResourceProvisioner)
,setBwProvisioner(ResourceProvisioner)
,setVmScheduler(VmScheduler)
-
HostSimple
Creates a Host without a pre-defined ID. It uses aResourceProvisionerSimple
for RAM and Bandwidth and also sets aVmSchedulerSpaceShared
as default. The ID is automatically set when a List of Hosts is attached to aDatacenter
.- Parameters:
ram
- the RAM capacity in Megabytesbw
- the Bandwidth (BW) capacity in Megabits/sstorage
- the storage capacity in MegabytespeList
- the host'sPe
listactivate
- define the Host activation status: true to power on, false to power off- See Also:
ChangeableId.setId(long)
,setRamProvisioner(ResourceProvisioner)
,setBwProvisioner(ResourceProvisioner)
,setVmScheduler(VmScheduler)
-
-
Method Details
-
getDefaultRamCapacity
public static long getDefaultRamCapacity()Gets the Default RAM capacity (in MB) for creating Hosts. This value is used when the RAM capacity is not given in a Host constructor. -
setDefaultRamCapacity
public static void setDefaultRamCapacity(long defaultCapacity)Sets the Default RAM capacity (in MB) for creating Hosts. This value is used when the RAM capacity is not given in a Host constructor. -
getDefaultBwCapacity
public static long getDefaultBwCapacity()Gets the Default Bandwidth capacity (in Mbps) for creating Hosts. This value is used when the BW capacity is not given in a Host constructor. -
setDefaultBwCapacity
public static void setDefaultBwCapacity(long defaultCapacity)Sets the Default Bandwidth capacity (in Mbps) for creating Hosts. This value is used when the BW capacity is not given in a Host constructor. -
getDefaultStorageCapacity
public static long getDefaultStorageCapacity()Gets the Default Storage capacity (in MB) for creating Hosts. This value is used when the Storage capacity is not given in a Host constructor. -
setDefaultStorageCapacity
public static void setDefaultStorageCapacity(long defaultCapacity)Sets the Default Storage capacity (in MB) for creating Hosts. This value is used when the Storage capacity is not given in a Host constructor. -
updateProcessing
public double updateProcessing(double currentTime)Description copied from interface:Host
Updates the processing of VMs running on this Host, that makes the processing of cloudlets inside such VMs to be updated.- Specified by:
updateProcessing
in interfaceHost
- Parameters:
currentTime
- the current time- 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
-
createVm
Description copied from interface:Host
Try to allocate resources to a new VM in the Host.- Specified by:
createVm
in interfaceHost
- Parameters:
vm
- Vm being started- Returns:
- a
HostSuitability
to indicate if the Vm was placed into the host or not (if the Host doesn't have enough resources to allocate the Vm)
-
createTemporaryVm
Description copied from interface:Host
Try to allocate resources to a new temporary VM in the Host. The method is used only to book resources for a given VM. For instance, if is being chosen Hosts to migrate a set of VMs, when a Host is selected for a given VM, using this method, the resources are reserved and then, when the next VM is selected for the same Host, the reserved resources already were reduced from the available amount. This way, it it was possible to place just one Vm into that Host, with the booking, no other VM will be selected to that Host.- Specified by:
createTemporaryVm
in interfaceHost
- Parameters:
vm
- Vm being started- Returns:
- a
HostSuitability
to indicate if the Vm was placed into the host or not (if the Host doesn't have enough resources to allocate the Vm)
-
reallocateMigratingInVms
public void reallocateMigratingInVms()Description copied from interface:Host
Reallocate VMs migrating into the host. Gets the VM in the migrating in queue and allocate them on the host.- Specified by:
reallocateMigratingInVms
in interfaceHost
-
isSuitableForVm
Description copied from interface:Host
Checks if the host is suitable for a Vm (if it has enough resources to attend the Vm) and the Host is not failed.- Specified by:
isSuitableForVm
in interfaceHost
- Parameters:
vm
- the Vm to check- Returns:
- true if is suitable for Vm, false otherwise
- See Also:
Host.getSuitabilityFor(Vm)
-
getSuitabilityFor
Description copied from interface:Host
Checks if the host is suitable for a Vm (if it has enough resources to attend the Vm) and the Host is not failed, providing fine-grained information about each individual Host's resource suitability.- Specified by:
getSuitabilityFor
in interfaceHost
- Parameters:
vm
- the Vm to check- Returns:
- a
HostSuitability
object containing indicating the Host's resources that are suitable or not for the given Vm. - See Also:
Host.setLazySuitabilityEvaluation(boolean)
-
isActive
public boolean isActive()Description copied from interface:Host
Checks if the Host is powered-on or not. -
hasEverStarted
public boolean hasEverStarted()Description copied from interface:Host
Checks if the Host has ever started sometime, i.e., if it was active sometime in the simulation execution.- Specified by:
hasEverStarted
in interfaceHost
- Returns:
-
setActive
Description copied from interface:Host
Sets the powered state of the Host, to indicate if it's powered on or off. When a Host is powered off, no VMs will be submitted to it.If it is set to powered off while VMs are running inside it, it is simulated a scheduled shutdown, so that, all running VMs will finish, but not more VMs will be submitted to this Host.
-
destroyVm
Description copied from interface:Host
Destroys a VM running in the host and removes it from theHost.getVmList()
. If the VM was not created yet, this method has no effect. -
destroyTemporaryVm
Description copied from interface:Host
Destroys a temporary VM created into the Host to book resources.- Specified by:
destroyTemporaryVm
in interfaceHost
- Parameters:
vm
- the VM- See Also:
Host.createTemporaryVm(Vm)
-
deallocateResourcesOfVm
Deallocate all resources that a VM was using.- Parameters:
vm
- the VM
-
destroyAllVms
public void destroyAllVms()Description copied from interface:Host
Destroys all VMs running in the host and remove them from theHost.getVmList()
.- Specified by:
destroyAllVms
in interfaceHost
-
addOnStartupListener
Description copied from interface:Host
Adds a listener object that will be notified every time the host is powered on.- Specified by:
addOnStartupListener
in interfaceHost
- Parameters:
listener
- the Listener to add- Returns:
-
removeOnStartupListener
Description copied from interface:Host
Removes a Listener object from the registered List.- Specified by:
removeOnStartupListener
in interfaceHost
- Parameters:
listener
- the Listener to remove- Returns:
- true if the Listener was removed, false otherwise
-
addOnShutdownListener
Description copied from interface:Host
Adds a listener object that will be notified every time the host is powered off.- Specified by:
addOnShutdownListener
in interfaceHost
- Parameters:
listener
- the Listener to add- Returns:
-
removeOnShutdownListener
Description copied from interface:Host
Removes a Listener object from the registered List.- Specified by:
removeOnShutdownListener
in interfaceHost
- Parameters:
listener
- the Listener to remove- Returns:
- true if the Listener was removed, false otherwise
-
deallocateResourcesOfAllVms
protected void deallocateResourcesOfAllVms()Deallocate all resources that all VMs were using. -
getNumberOfPes
public long getNumberOfPes()Gets the overall number ofPe
s the machine has, that include PEs of all statuses, including failed PEs.- Specified by:
getNumberOfPes
in interfaceAbstractMachine
- Returns:
- the machine's number of PEs
- See Also:
getWorkingPesNumber()
,getFreePesNumber()
,getFailedPesNumber()
-
getAllocatedMipsForVm
Gets the MIPS share of each Pe that is allocated to a given VM.- Parameters:
vm
- the vm- Returns:
- an array containing the amount of MIPS of each pe that is available to the VM
-
getMips
public double getMips()Description copied from interface:AbstractMachine
Gets the individual MIPS capacity of any machine'sPe
, considering that all PEs have the same capacity.- Specified by:
getMips
in interfaceAbstractMachine
- Returns:
- the MIPS capacity of a single
Pe
-
getTotalMipsCapacity
public double getTotalMipsCapacity()Description copied from interface:Host
Gets total MIPS capacity of PEs which are notPe.Status.FAILED
.- Specified by:
getTotalMipsCapacity
in interfaceAbstractMachine
- Specified by:
getTotalMipsCapacity
in interfaceHost
- Returns:
- the total MIPS of working PEs
-
getTotalAvailableMips
public double getTotalAvailableMips()Description copied from interface:Host
Gets the current total amount of available MIPS at the host.- Specified by:
getTotalAvailableMips
in interfaceHost
- Returns:
- the total available amount of MIPS
-
getTotalAllocatedMips
public double getTotalAllocatedMips()Description copied from interface:Host
Gets the total allocated MIPS at the host.- Specified by:
getTotalAllocatedMips
in interfaceHost
- Returns:
- the total allocated amount of MIPS
-
getTotalAllocatedMipsForVm
Description copied from interface:Host
Gets the total allocated MIPS for a VM along all its PEs.- Specified by:
getTotalAllocatedMipsForVm
in interfaceHost
- Parameters:
vm
- the vm- Returns:
- the allocated mips for vm
-
getBw
Description copied from interface:AbstractMachine
Gets the machine bandwidth (bw) capacity in Megabits/s.- Specified by:
getBw
in interfaceAbstractMachine
- Returns:
- the machine bw capacity
-
getRam
Description copied from interface:AbstractMachine
Gets the machine memory resource in Megabytes.- Specified by:
getRam
in interfaceAbstractMachine
- Returns:
- the machine memory
-
getStorage
Description copied from interface:AbstractMachine
Gets the storage device of the machine with capacity in Megabytes.- Specified by:
getStorage
in interfaceAbstractMachine
- Returns:
- the machine storage device
-
getId
public long getId()- Specified by:
getId
in interfaceIdentifiable
-
setId
public final void setId(long id)- Specified by:
setId
in interfaceChangeableId
-
getRamProvisioner
Description copied from interface:Host
Gets the ram provisioner with capacity in Megabytes.- Specified by:
getRamProvisioner
in interfaceHost
- Returns:
- the ram provisioner
-
setRamProvisioner
Description copied from interface:Host
Sets the ram provisioner with capacity in Megabytes.- Specified by:
setRamProvisioner
in interfaceHost
- Parameters:
ramProvisioner
- the new ram provisioner
-
getBwProvisioner
Description copied from interface:Host
Gets the bandwidth (BW) provisioner with capacity in Megabits/s.- Specified by:
getBwProvisioner
in interfaceHost
- Returns:
- the bw provisioner
-
setBwProvisioner
Description copied from interface:Host
Sets the bandwidth (BW) provisioner with capacity in Megabits/s.- Specified by:
setBwProvisioner
in interfaceHost
- Parameters:
bwProvisioner
- the new bw provisioner
-
getVmScheduler
Description copied from interface:Host
Gets the policy for allocation of host PEs to VMs in order to schedule VM execution.- Specified by:
getVmScheduler
in interfaceHost
- Returns:
- the
VmScheduler
-
setVmScheduler
Description copied from interface:Host
Sets the policy for allocation of host PEs to VMs in order to schedule VM execution. The host also sets itself to the given scheduler. It also sets the Host itself to the given scheduler.- Specified by:
setVmScheduler
in interfaceHost
- Parameters:
vmScheduler
- the vm scheduler to set- 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 interfaceAbstractMachine
- Returns:
-
getFirstStartTime
public double getFirstStartTime()Description copied from interface:Host
Gets the first time the Host was powered-on (in seconds).- Specified by:
getFirstStartTime
in interfaceHost
- Returns:
- the first Host startup time or -1 if the Host has never been powered on
- See Also:
AbstractMachine.getStartTime()
,Host.setActive(boolean)
-
setStartTime
Description copied from interface:AbstractMachine
Sets the current machine startup time. The value -1 means it was not started yet.- Specified by:
setStartTime
in interfaceAbstractMachine
- Parameters:
startTime
- the start time to set (in seconds)- Returns:
-
getShutdownTime
public double getShutdownTime()Description copied from interface:Host
Gets the last time the Host was shut down (in seconds).- Specified by:
getShutdownTime
in interfaceHost
- Returns:
- the last shut downtime or -1 if the Host is active
-
setShutdownTime
public void setShutdownTime(double shutdownTime)Description copied from interface:Host
Sets the the Host shut down time.- Specified by:
setShutdownTime
in interfaceHost
- Parameters:
shutdownTime
- the time to set (in seconds)- See Also:
Host.getShutdownTime()
-
getUpTime
public double getUpTime()Description copied from interface:Host
Gets the elapsed time since the last power on.- Specified by:
getUpTime
in interfaceHost
- Returns:
- the elapsed time (in seconds)
- See Also:
Host.getUpTimeHours()
,Host.getTotalUpTime()
,Host.getTotalUpTimeHours()
-
getTotalUpTime
public double getTotalUpTime()Description copied from interface:Host
Gets the total time the Host stayed active (powered on). Since the Host can be powered on and off according to demand, this method returns the sum of all intervals the Host was active (in seconds).- Specified by:
getTotalUpTime
in interfaceHost
- Returns:
- the total up time (in seconds)
- See Also:
Host.setActive(boolean)
,Host.setIdleShutdownDeadline(double)
,Host.getTotalUpTimeHours()
,Host.getUpTime()
,Host.getUpTimeHours()
-
getUpTimeHours
public double getUpTimeHours()Description copied from interface:Host
Gets the elapsed time in hours since the last power on.- Specified by:
getUpTimeHours
in interfaceHost
- Returns:
- the elapsed time (in hours)
- See Also:
Host.getUpTime()
,Host.getTotalUpTime()
,Host.getTotalUpTimeHours()
-
getTotalUpTimeHours
public double getTotalUpTimeHours()Description copied from interface:Host
Gets the total time the Host stayed active (powered on). Since the Host can be powered on and off according to demand, this method returns the sum of all intervals the Host was active (in hours).- Specified by:
getTotalUpTimeHours
in interfaceHost
- Returns:
- the total up time (in hours)
- See Also:
Host.setActive(boolean)
,Host.setIdleShutdownDeadline(double)
,Host.getTotalUpTime()
,Host.getUpTime()
,Host.getUpTimeHours()
-
getIdleShutdownDeadline
public double getIdleShutdownDeadline()Description copied from interface:Host
Gets the deadline to shutdown the Host when it become idle. This is the time interval after the Host becoming idle that it will be shutdown.- Specified by:
getIdleShutdownDeadline
in interfaceHost
- Returns:
- the idle shutdown deadline (in seconds)
- See Also:
Host.DEF_IDLE_SHUTDOWN_DEADLINE
-
setIdleShutdownDeadline
Description copied from interface:Host
Sets the deadline to shutdown the Host when it become idle. This is the time interval after the Host becoming idle that it will be shutdown.- Specified by:
setIdleShutdownDeadline
in interfaceHost
- Parameters:
deadline
- the deadline to shutdown the Host after it becoming idle (in seconds). A negative value disables idle host shutdown.- Returns:
- See Also:
Host.DEF_IDLE_SHUTDOWN_DEADLINE
,Host.getIdleShutdownDeadline()
-
getPeList
Description copied from interface:Host
Gets the list of all Processing Elements (PEs) of the host, including failed PEs.- Specified by:
getPeList
in interfaceHost
- Returns:
- the list of all Host PEs
- See Also:
Host.getWorkingPeList()
-
getVmList
Description copied from interface:Host
Gets a read-only list of VMs currently assigned to the host. -
getVmCreatedList
Description copied from interface:Host
Gets a read-only list of all VMs which have been created into the host during the entire simulation. This way, this method returns a historic list of created VMs, including those ones already destroyed.- Specified by:
getVmCreatedList
in interfaceHost
- Type Parameters:
T
- The generic type- Returns:
- the read-only vm created historic list
-
addVmToList
-
addVmToCreatedList
-
isFailed
public boolean isFailed()Description copied from interface:Host
Checks if the host is working properly or has failed. -
setFailed
public final boolean setFailed(boolean failed)Description copied from interface:Host
Sets the Host state to "failed" or "working". -
setPeStatus
Sets the status of a given (sub)list ofPe
to a new status.- Parameters:
peList
- the (sub)list ofPe
to change the statusnewStatus
- the new status
-
getVmsMigratingIn
Description copied from interface:Host
Gets the list of VMs migrating into this host.- Specified by:
getVmsMigratingIn
in interfaceHost
- Type Parameters:
T
- the generic type- Returns:
- the vms migrating in
-
hasMigratingVms
public boolean hasMigratingVms()Description copied from interface:Host
Checks if there is any VMs migrating in or out this host.- Specified by:
hasMigratingVms
in interfaceHost
- Returns:
-
addMigratingInVm
Description copied from interface:Host
Try to add a VM migrating into the current host if there is enough resources for it. In this case, the resources are allocated and the VM added to theHost.getVmsMigratingIn()
List. Otherwise, the VM is not added.- Specified by:
addMigratingInVm
in interfaceHost
- Parameters:
vm
- the vm- Returns:
- true if the Vm was migrated in, false if the Host doesn't have enough resources to place the Vm
-
removeMigratingInVm
Description copied from interface:Host
Removes a VM migrating into this Host from the migrating-in list, so that the VM can be actually placed into the Host and the migration process finished.- Specified by:
removeMigratingInVm
in interfaceHost
- Parameters:
vm
- the vm
-
getVmsMigratingOut
Description copied from interface:Host
Gets a read-only list of VMs migrating out from the Host.- Specified by:
getVmsMigratingOut
in interfaceHost
- Returns:
-
addVmMigratingOut
Description copied from interface:Host
Adds aVm
to the list of VMs migrating out from the Host.- Specified by:
addVmMigratingOut
in interfaceHost
- Parameters:
vm
- the vm to be added- Returns:
- true if the VM wasn't into the list and was added, false otherwise
-
removeVmMigratingOut
Description copied from interface:Host
Adds aVm
to the list of VMs migrating out from the Host.- Specified by:
removeVmMigratingOut
in interfaceHost
- Parameters:
vm
- the vm to be added- Returns:
-
getDatacenter
Description copied from interface:Host
Gets the Datacenter where the host is placed.- Specified by:
getDatacenter
in interfaceHost
- Returns:
- the data center of the host
-
setDatacenter
Description copied from interface:Host
Sets the Datacenter where the host is placed.- Specified by:
setDatacenter
in interfaceHost
- Parameters:
datacenter
- the new data center to move the host
-
toString
-
removeOnUpdateProcessingListener
public boolean removeOnUpdateProcessingListener(EventListener<HostUpdatesVmsProcessingEventInfo> listener)Description copied from interface:Host
Removes a Listener object from the registered List.- Specified by:
removeOnUpdateProcessingListener
in interfaceHost
- Parameters:
listener
- the listener to remove- Returns:
- true if the listener was found and removed, false otherwise
- See Also:
Host.updateProcessing(double)
-
addOnUpdateProcessingListener
public Host addOnUpdateProcessingListener(EventListener<HostUpdatesVmsProcessingEventInfo> listener)Description copied from interface:Host
Adds a listener object that will be notified every time the host updates the processing of all itsVMs
.- Specified by:
addOnUpdateProcessingListener
in interfaceHost
- Parameters:
listener
- the OnUpdateProcessingListener to add- Returns:
- See Also:
Host.updateProcessing(double)
-
getAvailableStorage
public long getAvailableStorage()Description copied from interface:Host
Gets the total free storage available at the host in Megabytes.- Specified by:
getAvailableStorage
in interfaceHost
- Returns:
- the free storage
-
getFreePesNumber
public int getFreePesNumber()Description copied from interface:Host
Gets the number of PEs that are free to be used by any VM.- Specified by:
getFreePesNumber
in interfaceHost
- Returns:
- the free pes number
-
getWorkingPesNumber
public int getWorkingPesNumber()Description copied from interface:Host
Gets the number of PEs that are working. That is, the number of PEs that aren't FAIL.- Specified by:
getWorkingPesNumber
in interfaceHost
- Returns:
- the number of working pes
-
getBusyPesNumber
public int getBusyPesNumber()Description copied from interface:Host
Gets the number of PEs that arePe.Status.BUSY
. That is, the number of PEs that aren't FAIL.- Specified by:
getBusyPesNumber
in interfaceHost
- Returns:
- the number of working pes
-
getBusyPesPercent
public double getBusyPesPercent()Description copied from interface:Host
Gets the current percentage (from 0..1) of used (busy) PEs, according to thetotal number of PEs
.- Specified by:
getBusyPesPercent
in interfaceHost
- Returns:
- See Also:
Host.getBusyPesPercent(boolean)
-
getBusyPesPercent
public double getBusyPesPercent(boolean hundredScale)Description copied from interface:Host
Gets the current percentage of used (busy) PEs, according to thetotal number of PEs
.- Specified by:
getBusyPesPercent
in interfaceHost
- Parameters:
hundredScale
- if true, result is provided from 0..100 scale; otherwise, it's returned in scale from 0..1.- Returns:
- the percentage of busy PEs in the defined scale
- See Also:
Host.getBusyPesPercent()
-
getFailedPesNumber
public int getFailedPesNumber()Description copied from interface:Host
Gets the number of PEs that have failed.- Specified by:
getFailedPesNumber
in interfaceHost
- Returns:
- the number of failed pes
-
getSimulation
Description copied from interface:AbstractMachine
Gets the CloudSim instance that represents the simulation the Entity is related to.- Specified by:
getSimulation
in interfaceAbstractMachine
- Returns:
-
getLastBusyTime
public double getLastBusyTime()Description copied from interface:AbstractMachine
Gets the last time the Machine was running some process.- Specified by:
getLastBusyTime
in interfaceAbstractMachine
- Returns:
- the last busy time (in seconds)
-
setSimulation
Description copied from interface:Host
Sets the CloudSim instance that represents the simulation the Entity is related to. Such attribute has to be set by theDatacenter
that the host belongs to.- Specified by:
setSimulation
in interfaceHost
- Parameters:
simulation
- The CloudSim instance that represents the simulation the Entity is related to- Returns:
-
compareTo
Compare this Host with another one based ongetTotalMipsCapacity()
.- Specified by:
compareTo
in interfaceComparable<Host>
- Parameters:
o
- the Host to compare to- Returns:
-
equals
-
hashCode
public int hashCode() -
getResources
Description copied from interface:Resourceful
Gets a read-only list of resources the machine has.- Specified by:
getResources
in interfaceResourceful
- Returns:
- a read-only list of resources
- See Also:
Resourceful.getResource(Class)
-
getProvisioner
Description copied from interface:Host
- Specified by:
getProvisioner
in interfaceHost
- Parameters:
resourceClass
- the class of the resource to get its provisioner- Returns:
- the
ResourceProvisioner
for the given resource class
-
getWorkingPeList
Description copied from interface:Host
Gets the list of working Processing Elements (PEs) of the host. It's the list of all PEs which are not FAILEd.- Specified by:
getWorkingPeList
in interfaceHost
- Returns:
- the list working (non-failed) Host PEs
-
getBusyPeList
Description copied from interface:Host
Gets the list of working Processing Elements (PEs) of the host, which excludes failed PEs.- Specified by:
getBusyPeList
in interfaceHost
- Returns:
- the list working (non-failed) Host PEs
-
getFreePeList
Description copied from interface:Host
Gets the list of Free Processing Elements (PEs) of the host, which excludes failed PEs.- Specified by:
getFreePeList
in interfaceHost
- Returns:
- the list free (non-failed) Host PEs
-
getCpuPercentUtilization
public double getCpuPercentUtilization()Description copied from interface:Host
Gets current utilization of CPU in percentage (between [0 and 1]), considering the usage of all its PEs..- Specified by:
getCpuPercentUtilization
in interfaceHost
- Returns:
-
getCpuMipsUtilization
public double getCpuMipsUtilization()Description copied from interface:Host
Gets the current total utilization of CPU in MIPS, considering the usage of all its PEs.- Specified by:
getCpuMipsUtilization
in interfaceHost
- Returns:
-
getRamUtilization
public long getRamUtilization()Description copied from interface:Host
Gets the current utilization of memory (in Megabytes).- Specified by:
getRamUtilization
in interfaceHost
- Returns:
-
getBwUtilization
public long getBwUtilization()Description copied from interface:Host
Gets the current utilization of bw (in Megabits/s).- Specified by:
getBwUtilization
in interfaceHost
- Returns:
-
getCpuUtilizationStats
Description copied from interface:Host
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
It uses the utilization statistics from its VMs to provide the overall Host's CPU utilization. However, for this method to return any data, you need to enable the statistics computation for every VM it owns.Datacenter.getSchedulingInterval()
.- Specified by:
getCpuUtilizationStats
in interfaceHost
- Specified by:
getCpuUtilizationStats
in interfaceResourceStatsComputer<HostResourceStats>
- Returns:
-
enableUtilizationStats
public void enableUtilizationStats()Description copied from interface:Host
Enables the data collection and computation of utilization statistics. It iterates over all existing VMs enabling the statistics computation on every one. But keep in mind that when a Host is created, it has no VM. Therefore, you need to call this method for every VM if you are enabling the computation before the simulation starts and VM placement is performed.- Specified by:
enableUtilizationStats
in interfaceHost
- Specified by:
enableUtilizationStats
in interfaceResourceStatsComputer<HostResourceStats>
- See Also:
ResourceStatsComputer.getCpuUtilizationStats()
-
getPowerModel
Description copied from interface:Host
Gets thePowerModelHost
used by the host to define how it consumes power. A Host just provides power usage data if a PowerModel is set.- Specified by:
getPowerModel
in interfaceHost
- Specified by:
getPowerModel
in interfacePowerAware<PowerModelHost>
- Returns:
- the Host's
PowerModelHost
-
setPowerModel
Description copied from interface:Host
Sets thePowerModelHost
used by the host to define how it consumes power. A Host just provides power usage data if a PowerModel is set.- Specified by:
setPowerModel
in interfaceHost
- Specified by:
setPowerModel
in interfacePowerAware<PowerModelHost>
- Parameters:
powerModel
- thePowerModelHost
to set
-
enableStateHistory
public void enableStateHistory()Description copied from interface:Host
Enables storing Host state history.- Specified by:
enableStateHistory
in interfaceHost
- See Also:
Host.getStateHistory()
-
disableStateHistory
public void disableStateHistory()Description copied from interface:Host
Disable storing Host state history.- Specified by:
disableStateHistory
in interfaceHost
- See Also:
Host.getStateHistory()
-
isStateHistoryEnabled
public boolean isStateHistoryEnabled()Description copied from interface:Host
Checks if Host state history is being collected and stored.- Specified by:
isStateHistoryEnabled
in interfaceHost
- Returns:
-
getFinishedVms
Description copied from interface:Host
Gets the List of VMs that have finished executing.- Specified by:
getFinishedVms
in interfaceHost
- Returns:
-
getStateHistory
Description copied from interface:Host
Gets a read-only host state history. This List is just populated ifHost.isStateHistoryEnabled()
- Specified by:
getStateHistory
in interfaceHost
- Returns:
- the state history
- See Also:
Host.enableStateHistory()
-
getMigratableVms
Description copied from interface:Host
Gets the list of migratable VMs from a given host.- Specified by:
getMigratableVms
in interfaceHost
- Returns:
- the list of migratable VMs
-
isLazySuitabilityEvaluation
public boolean isLazySuitabilityEvaluation()Checks if the suitability evaluation of this Host for a given Vm is to be performed lazily by methods such asHost.isSuitableForVm(Vm)
. It means that the method will return as soon as some resource requirement is not met and the suitability for other VM requirements is not evaluated. This laziness improves performance but provides less information when callingHost.getSuitabilityFor(Vm)
.It's enabled by default.
- Specified by:
isLazySuitabilityEvaluation
in interfaceHost
- Returns:
- true if the lazy evaluation is enabled, false otherwise
-
setLazySuitabilityEvaluation
Description copied from interface:Host
Defines if the suitability evaluation of this Host for a given Vm is to be performed lazily by methods such asHost.isSuitableForVm(Vm)
. It means that the method will return as soon as some resource requirement is not met and the suitability for other VM requirements is not evaluated. This laziness improves performance but provides less information when callingHost.getSuitabilityFor(Vm)
.- Specified by:
setLazySuitabilityEvaluation
in interfaceHost
-