Package org.cloudbus.cloudsim.hosts
Class HostSimple
java.lang.Object
org.cloudbus.cloudsim.hosts.HostSimple
- All Implemented Interfaces:
Comparable<Host>
,AbstractMachine<FileStorage>
,ChangeableId
,Identifiable
,Machine
,ResourceStatsComputer<HostResourceStats>
,Host
,PowerAware<PowerModelHost>
,Resourceful
- Direct Known Subclasses:
NetworkHost
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
FieldsFields inherited from interface org.cloudbus.cloudsim.hosts.Host
DEF_IDLE_SHUTDOWN_DEADLINE, LOGGER, NULL
-
Constructor Summary
ConstructorsConstructorDescriptionHostSimple
(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
(long ram, long bw, HarddriveStorage storage, List<Pe> peList) 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 TypeMethodDescriptionboolean
addMigratingInVm
(Vm vm) Try to add a VM migrating into the current host if there is enough resources for it.addOnShutdownListener
(EventListener<HostEventInfo> listener) Adds a listener object that will be notified every time the host is powered off.addOnStartupListener
(EventListener<HostEventInfo> listener) Adds a listener object that will be notified every time the host is powered on.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
createTemporaryVm
(Vm vm) Try to allocate resources to a new temporary VM in the Host.Try to allocate resources to a new VM in the Host.protected void
Deallocate all resources that a VM was using.void
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
Destroys a VM running in the host and removes it from theHost.getVmList()
.void
Disable storing Host state history.void
Enables storing Host state history.void
Enables the data collection and computation of utilization statistics.boolean
protected MipsShare
Gets the MIPS share of each Pe that is allocated to a given VM.long
Gets the total free storage available at the host in Megabytes.Gets the list of working Processing Elements (PEs) of the host, which excludes failed PEs.int
Gets the number of PEs that arePe.Status.BUSY
.double
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
.getBw()
Gets a resource representing the machine bandwidth (bw) in Megabits/s.Gets the bandwidth (BW) provisioner with capacity in Megabits/s.long
Gets the current utilization of bw (in Megabits/s).double
Gets the current total utilization of CPU in MIPS, considering the usage of all its PEs.double
Gets the percentage of CPU capacity (MIPS %) requested by all running VMs at the current time.double
Gets the current percentage of CPU capacity (MIPS %) used by all running VMs.Gets machine's CPU utilization percentage statistics (between [0 and 1]).Gets the Datacenter where the host is placed.static long
Gets the Default Bandwidth capacity (in Mbps) for creating Hosts.static long
Gets the Default RAM capacity (in MB) for creating Hosts.static long
Gets the Default Storage capacity (in MB) for creating Hosts.int
Gets the number of PEs that have failed.Gets the List of VMs that have finished executing.double
Gets the first time the Host was powered-on (in seconds).Gets the list of Free Processing Elements (PEs) of the host, which excludes failed PEs.int
Gets the number of PEs that are free to be used by any VM.long
getId()
double
Gets the deadline to shut down the Host when it becomes idle.double
Gets the last time the Machine was running some process.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
Gets the overall number ofPe
s the machine has, that include PEs of all statuses, including failed PEs.Gets the list of all Processing Elements (PEs) of the host, including failed PEs.Gets thePowerModelHost
used by the host to define how it consumes power.getProvisioner
(Class<? extends ResourceManageable> resourceClass) getRam()
Gets a resource representing the machine memory in Megabytes.Gets the ram provisioner with capacity in Megabytes.long
Gets the current utilization of memory (in Megabytes).Gets a read-only list of resources the machine has.double
Gets the last time the Host was shut down (in seconds).Gets the CloudSim instance that represents the simulation the Entity belongs to.double
Gets the last time the machine was started up (in seconds).Gets a read-only host state history.Gets the storage device of the machine with capacity in Megabytes.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
Gets the total allocated MIPS at the host.double
Gets the total allocated MIPS for a VM along all its PEs.double
Gets the current total amount of available MIPS at the host.double
Gets total MIPS capacity of PEs which are notPe.Status.FAILED
.double
Gets the total time the Host stayed active (powered on).double
Gets the total time the Host stayed active (powered on).double
Gets the elapsed time since the last power on.double
Gets the elapsed time in hours since the last power on.Gets a read-only list of all VMs which have been created into the host during the entire simulation.Gets as list of VMs currently assigned to the host.Gets the policy for allocation of host PEs to VMs in order to schedule VM execution.Gets the list of VMs migrating into this host.Gets a read-only list of VMs migrating out from the Host.Gets the list of working Processing Elements (PEs) of the host.int
Gets the number of PEs that are working.boolean
Checks if the Host has ever started sometime, i.e., if it was active sometime in the simulation execution.int
hashCode()
boolean
Checks if there is any VMs migrating in or out this host.protected void
incBusyPesNumber
(int inc) Updates the number of busy PEs, decreasing it if a negative number of given, or increasing otherwise.protected void
incFailedPesNumber
(int inc) Updates the number of failed (and working) PEs, decreasing it if a negative number of given, or increasing otherwise.protected void
incFreePesNumber
(int inc) Updates the number of free PEs, decreasing it if a negative number of given, or increasing otherwise.boolean
Indicates if the Host must be automatically started up when the assigned Datacenter is started up.boolean
isActive()
Checks if the Host is powered-on or not.boolean
isFailed()
Checks if the host is working properly or has failed.boolean
Checks if the suitability evaluation of this Host for a given Vm is to be performed lazily by methods such asHost.isSuitableForVm(Vm)
.boolean
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
processActivation
(boolean activate) Process an event for actually powering theHost
on or off after any defined start up/shutdown delay (if some delay is set).void
Reallocate VMs migrating into the host.void
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
Removes a Listener object from the registered List.boolean
Adds aVm
to the list of VMs migrating out from the Host.final Host
setActive
(boolean activate) Requests the Host to be powered on or off.final Host
setBwProvisioner
(ResourceProvisioner bwProvisioner) Sets the bandwidth (BW) provisioner with capacity in Megabits/s.final 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.final boolean
setFailed
(boolean failed) Sets the Host state to "failed" or "working".final void
setId
(long id) Sets the id of the object.setIdleShutdownDeadline
(double deadline) Sets the deadline to shutdown the Host when it becomes idle.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)
.final void
setPeStatus
(List<Pe> peList, Pe.Status newStatus) Sets the status of a given (sub)list ofPe
to a new status.final void
setPowerModel
(PowerModelHost powerModel) Sets thePowerModelHost
used by the host to define how it consumes power.final Host
setRamProvisioner
(ResourceProvisioner ramProvisioner) Sets the ram provisioner with capacity in Megabytes.void
setShutdownTime
(double shutdownTime) Sets the the Host shut down time.final Host
setSimulation
(Simulation simulation) Sets the CloudSim instance that represents the simulation the Entity belongs Such attribute has to be set by theDatacenter
that the host belongs to.setStartTime
(double startTime) Sets the current machine startup time.final Host
setVmScheduler
(VmScheduler vmScheduler) Sets the policy for allocation of host PEs to VMs in order to schedule VM execution.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.protected double
updateVmProcessing
(Vm vm, double currentTime, double nextSimulationDelay) 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:
-
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:
-
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:
-
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:
-
HostSimple
-
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:
-
-
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
-
updateVmProcessing
-
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 Hosts are being chosen 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, if 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) TODO: https://github.com/manoelcampos/cloudsim-plus/issues/94
-
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:
-
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:
-
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
Requests the Host to be powered on or off. If there is noPowerModelHost.getStartupDelay()
orPowerModelHost.getShutDownDelay()
(which is the default), those operations will happen immediately.If the Host is set to be powered off while it has running VMs, it is simulated a scheduled shutdown, so that those VMs will finish, but new ones won't be submitted to this Host.
-
processActivation
public void processActivation(boolean activate) Process an event for actually powering theHost
on or off after any defined start up/shutdown delay (if some delay is set).- Parameters:
activate
- true to start the Host up, false to shut it down- See Also:
-
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:
-
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
-
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<FileStorage>
- Returns:
- the machine's number of PEs
- See Also:
-
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<FileStorage>
- 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<FileStorage>
- 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 a resource representing the machine bandwidth (bw) in Megabits/s.- Specified by:
getBw
in interfaceAbstractMachine<FileStorage>
- Returns:
- the machine bw resource
-
getRam
Description copied from interface:AbstractMachine
Gets a resource representing the machine memory in Megabytes.- Specified by:
getRam
in interfaceAbstractMachine<FileStorage>
- 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<FileStorage>
- Returns:
- the machine storage device
-
getId
public long getId()- Specified by:
getId
in interfaceIdentifiable
-
setId
public final void setId(long id) Description copied from interface:ChangeableId
Sets the id of the object. -1 indicates the object has no id.- Specified by:
setId
in interfaceChangeableId
- Parameters:
id
- the id to set
-
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<FileStorage>
- 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:
-
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<FileStorage>
- 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:
-
getUpTime
public double getUpTime()Description copied from interface:Host
Gets the elapsed time since the last power on. -
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 uptime (in seconds)
- See Also:
-
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:
-
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 uptime (in hours)
- See Also:
-
getIdleShutdownDeadline
public double getIdleShutdownDeadline()Description copied from interface:Host
Gets the deadline to shut down the Host when it becomes 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:
-
setIdleShutdownDeadline
Description copied from interface:Host
Sets the deadline to shutdown the Host when it becomes 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 shut down the Host after it becoming idle (in seconds). A negative value disables idle host shutdown.- Returns:
- See Also:
-
getPeList
Description copied from interface:Host
Gets the list of all Processing Elements (PEs) of the host, including failed PEs. -
getVmList
Description copied from interface:Host
Gets as 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
-
incFailedPesNumber
protected void incFailedPesNumber(int inc) Updates the number of failed (and working) PEs, decreasing it if a negative number of given, or increasing otherwise.- Parameters:
inc
- the value to sum (positive or negative) to the number of busy PEs
-
incFreePesNumber
protected void incFreePesNumber(int inc) Updates the number of free PEs, decreasing it if a negative number of given, or increasing otherwise.- Parameters:
inc
- the value to sum (positive or negative) to the number of busy PEs
-
incBusyPesNumber
protected void incBusyPesNumber(int inc) Updates the number of busy PEs, decreasing it if a negative number of given, or increasing otherwise.- Parameters:
inc
- the value to sum (positive or negative) to the number of busy PEs
-
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:
-
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:
-
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:
-
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:
-
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 belongs to.- Specified by:
getSimulation
in interfaceAbstractMachine<FileStorage>
- 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<FileStorage>
- Returns:
- the last busy time (in seconds)
-
setSimulation
Description copied from interface:Host
Sets the CloudSim instance that represents the simulation the Entity belongs 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 belongs- Returns:
-
compareTo
- Specified by:
compareTo
in interfaceComparable<Host>
-
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:
-
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 the current percentage of CPU capacity (MIPS %) used by all running VMs. It represents the actual percentage of MIPS allocated.- Specified by:
getCpuPercentUtilization
in interfaceHost
- Returns:
- total CPU utilization percentage (between [0 and 1]) for the current time
-
getCpuPercentRequested
public double getCpuPercentRequested()Description copied from interface:Host
Gets the percentage of CPU capacity (MIPS %) requested by all running VMs at the current time. It represents the percentage of MIPS requested, which may be higher than the percentage used (allocated) due to lack of capacity.- Specified by:
getCpuPercentRequested
in interfaceHost
- Returns:
- the percentage (between [0 and 1]) of CPU capacity requested
-
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:
-
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:
-
disableStateHistory
public void disableStateHistory()Description copied from interface:Host
Disable storing Host state history.- Specified by:
disableStateHistory
in interfaceHost
- See Also:
-
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:
-
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
-
isActivateOnDatacenterStartup
public boolean isActivateOnDatacenterStartup()Indicates if the Host must be automatically started up when the assigned Datacenter is started up.- Returns:
-