Interface Datacenter
-
- All Superinterfaces:
java.lang.Cloneable
,java.lang.Comparable<SimEntity>
,Identifiable
,Nameable
,PowerAware
,java.lang.Runnable
,SimEntity
- All Known Implementing Classes:
DatacenterSimple
,NetworkDatacenter
public interface Datacenter extends SimEntity, PowerAware
An interface to be implemented by each class that provides Datacenter features. The interface implements the Null Object Design Pattern in order to start avoidingNullPointerException
when using theNULL
object instead of attributingnull
toDatacenter
variables.- Since:
- CloudSim Plus 1.0
- Author:
- Rodrigo N. Calheiros, Anton Beloglazov, Manoel Campos da Silva Filho
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.cloudbus.cloudsim.core.SimEntity
SimEntity.State
-
-
Field Summary
Fields Modifier and Type Field Description static double
DEF_BW_PERCENT_FOR_MIGRATION
The default percentage of bandwidth allocated for VM migration, is a value is not set.static Datacenter
NULL
A property that implements the Null Object Design Pattern forDatacenter
objects.
-
Method Summary
Modifier and Type Method Description <T extends Host>
DatacenteraddHost(T host)
Physically expands the Datacenter by adding a new Host (physical machine) to it.<T extends Host>
DatacenteraddHostList(java.util.List<T> hostList)
Physically expands the Datacenter by adding a List of new Hosts (physical machines) to it.Datacenter
addOnHostAvailableListener(EventListener<HostEventInfo> listener)
Adds aEventListener
object that will be notified every time when the a new Hosts is available for the Datacenter during simulation runtime.double
getBandwidthPercentForMigration()
Gets the percentage of the bandwidth allocated to a Host to migrate VMs.DatacenterCharacteristics
getCharacteristics()
Gets the Datacenter characteristics.DatacenterStorage
getDatacenterStorage()
Gets the storage of the Datacenter.Host
getHost(int index)
Gets a Host in a given position inside the Host List.Host
getHostById(long id)
Gets a Host from its id.<T extends Host>
java.util.List<T>getHostList()
Gets an unmodifiable host list.double
getPower()
Gets an estimation of Datacenter power consumption in Watt-Second (Ws).double
getSchedulingInterval()
Gets the scheduling interval to process each event received by the Datacenter (in seconds).VmAllocationPolicy
getVmAllocationPolicy()
Gets the policy to be used by the Datacenter to allocate VMs into hosts.<T extends Host>
DatacenterremoveHost(T host)
Removes a Host from its Datacenter.void
setBandwidthPercentForMigration(double bandwidthPercentForMigration)
Sets the percentage of the bandwidth allocated to a Host to migrate VMs.void
setDatacenterStorage(DatacenterStorage datacenterStorage)
Sets the storage of the Datacenter.Datacenter
setSchedulingInterval(double schedulingInterval)
Sets the scheduling delay to process each event received by the Datacenter (in seconds).-
Methods inherited from interface org.cloudbus.cloudsim.core.Identifiable
getId
-
Methods inherited from interface org.cloudbus.cloudsim.power.models.PowerAware
getPowerInKWattsHour
-
Methods inherited from interface org.cloudbus.cloudsim.core.SimEntity
getSimulation, getState, isAlive, isFinished, isStarted, processEvent, run, schedule, schedule, schedule, schedule, schedule, setName, setSimulation, setState, shutdownEntity, start
-
-
-
-
Field Detail
-
NULL
static final Datacenter NULL
A property that implements the Null Object Design Pattern forDatacenter
objects.
-
DEF_BW_PERCENT_FOR_MIGRATION
static final double DEF_BW_PERCENT_FOR_MIGRATION
The default percentage of bandwidth allocated for VM migration, is a value is not set.
-
-
Method Detail
-
getHostList
<T extends Host> java.util.List<T> getHostList()
Gets an unmodifiable host list.- Type Parameters:
T
- The generic type- Returns:
- the host list
-
getHost
Host getHost(int index)
Gets a Host in a given position inside the Host List.- Parameters:
index
- the position of the List to get the Host- Returns:
-
getHostById
Host getHostById(long id)
Gets a Host from its id.- Parameters:
id
- the ID of the Host to get from the List.- Returns:
- the Host if found or
Host.NULL
otherwise
-
addHostList
<T extends Host> Datacenter addHostList(java.util.List<T> hostList)
Physically expands the Datacenter by adding a List of new Hosts (physical machines) to it. Hosts can be added before or after the simulation has started. If a Host is added during simulation execution, in case VMs are added dynamically too, they may be allocated to this new Host, depending on theVmAllocationPolicy
.If an ID is not assigned to a Host, the method assigns one.
- Parameters:
hostList
- the List of new hosts to be added- Returns:
- See Also:
getVmAllocationPolicy()
-
addHost
<T extends Host> Datacenter addHost(T host)
Physically expands the Datacenter by adding a new Host (physical machine) to it. Hosts can be added before or after the simulation has started. If a Host is added during simulation execution, in case VMs are added dynamically too, they may be allocated to this new Host, depending on theVmAllocationPolicy
.If an ID is not assigned to the given Host, the method assigns one.
- Parameters:
host
- the new host to be added- Returns:
- See Also:
getVmAllocationPolicy()
-
removeHost
<T extends Host> Datacenter removeHost(T host)
Removes a Host from its Datacenter.- Parameters:
host
- the new host to be removed from its assigned Datacenter- Returns:
-
getVmAllocationPolicy
VmAllocationPolicy getVmAllocationPolicy()
Gets the policy to be used by the Datacenter to allocate VMs into hosts.- Returns:
- the VM allocation policy
- See Also:
VmAllocationPolicy
-
getSchedulingInterval
double getSchedulingInterval()
Gets the scheduling interval to process each event received by the Datacenter (in seconds). This value defines the interval in which processing of Cloudlets will be updated. The interval doesn't affect the processing of such cloudlets, it only defines in which interval the processing will be updated. For instance, if it is set a interval of 10 seconds, the processing of cloudlets will be updated at every 10 seconds. By this way, trying to get the amount of instructions the cloudlet has executed after 5 seconds, by means ofCloudlet.getFinishedLengthSoFar(Datacenter)
, it will not return an updated value. By this way, one should set the scheduling interval to 5 to get an updated result. As longer is the interval, faster will be the simulation execution.- Returns:
- the scheduling interval (in seconds)
-
setSchedulingInterval
Datacenter setSchedulingInterval(double schedulingInterval)
Sets the scheduling delay to process each event received by the Datacenter (in seconds).- Parameters:
schedulingInterval
- the new scheduling interval (in seconds)- Returns:
- See Also:
getSchedulingInterval()
-
getCharacteristics
DatacenterCharacteristics getCharacteristics()
Gets the Datacenter characteristics.- Returns:
- the Datacenter characteristics
-
getDatacenterStorage
DatacenterStorage getDatacenterStorage()
Gets the storage of the Datacenter.- Returns:
- the storage
-
setDatacenterStorage
void setDatacenterStorage(DatacenterStorage datacenterStorage)
Sets the storage of the Datacenter.- Parameters:
datacenterStorage
- the new storage
-
getBandwidthPercentForMigration
double getBandwidthPercentForMigration()
Gets the percentage of the bandwidth allocated to a Host to migrate VMs. It's a value between [0 and 1] (where 1 is 100%). The default value is 0.5, meaning only 50% of the bandwidth will be allowed for migration, while the remaining will be used for VM services.- Returns:
- See Also:
DEF_BW_PERCENT_FOR_MIGRATION
-
setBandwidthPercentForMigration
void setBandwidthPercentForMigration(double bandwidthPercentForMigration)
Sets the percentage of the bandwidth allocated to a Host to migrate VMs. It's a value between [0 and 1] (where 1 is 100%). The default value is 0.5, meaning only 50% of the bandwidth will be allowed for migration, while the remaining will be used for VM services.- Parameters:
bandwidthPercentForMigration
- the bandwidth migration percentage to set
-
getPower
double getPower()
Gets an estimation of Datacenter power consumption in Watt-Second (Ws).To get actual power consumption, it's required to enable
Host's StateHistory
by callingHost.enableStateHistory()
and use each HostPowerModel
to compute power usage based on the CPU utilization got form the StateHistory.- Specified by:
getPower
in interfacePowerAware
- Returns:
- th estimated power consumption in Watt-Second (Ws)
- See Also:
PowerAware.getPowerInKWattsHour()
-
addOnHostAvailableListener
Datacenter addOnHostAvailableListener(EventListener<HostEventInfo> listener)
Adds aEventListener
object that will be notified every time when the a new Hosts is available for the Datacenter during simulation runtime. If theaddHost(Host)
oraddHostList(List)
is called before the simulation starts, the listeners will not be notified.- Parameters:
listener
- the event listener to add- Returns:
-
-