HostSimple

public class HostSimple 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.

Author:Rodrigo N. Calheiros, Anton Beloglazov

Constructors

HostSimple

public HostSimple(List<Pe> peList)

Creates a Host without a pre-defined ID, 10GB of RAM, 1000Mbps of Bandwidth and 500GB of Storage. It creates a ResourceProvisionerSimple for RAM and Bandwidth. Finally, it sets a VmSchedulerSpaceShared as default. The ID is automatically set when a List of Hosts is attached to a Datacenter.

Parameters:
  • peList – the host’s Pe list

See also: ChangeableId.setId(long), .setRamProvisioner(ResourceProvisioner), .setBwProvisioner(ResourceProvisioner), .setStorage(long), .setVmScheduler(VmScheduler), .setDefaultRamCapacity(long), .setDefaultBwCapacity(long), .setDefaultStorageCapacity(long)

HostSimple

public HostSimple(ResourceProvisioner ramProvisioner, ResourceProvisioner bwProvisioner, long storage, List<Pe> peList)

Creates a Host with the given parameters and a VmSchedulerSpaceShared as default.

Parameters:
  • ramProvisioner – the ram provisioner with capacity in Megabytes
  • bwProvisioner – the bw provisioner with capacity in Megabits/s
  • storage – the storage capacity in Megabytes
  • peList – the host’s PEs list

See also: .setVmScheduler(VmScheduler)

HostSimple

public HostSimple(long ram, long bw, long storage, List<Pe> peList)

Creates a Host without a pre-defined ID. It uses a ResourceProvisionerSimple for RAM and Bandwidth and also sets a VmSchedulerSpaceShared as default. The ID is automatically set when a List of Hosts is attached to a Datacenter.

Parameters:
  • ram – the RAM capacity in Megabytes
  • bw – the Bandwidth (BW) capacity in Megabits/s
  • storage – the storage capacity in Megabytes
  • peList – the host’s Pe list

See also: ChangeableId.setId(long), .setRamProvisioner(ResourceProvisioner), .setBwProvisioner(ResourceProvisioner), .setVmScheduler(VmScheduler)

Methods

addMigratingInVm

public boolean addMigratingInVm(Vm vm)

addOnUpdateProcessingListener

public Host addOnUpdateProcessingListener(EventListener<HostUpdatesVmsProcessingEventInfo> listener)

addVmMigratingOut

public boolean addVmMigratingOut(Vm vm)

addVmToCreatedList

protected void addVmToCreatedList(Vm vm)

addVmToList

protected void addVmToList(Vm vm)

compareTo

public int compareTo(Host o)

Compare this Host with another one based on getTotalMipsCapacity().

Parameters:
  • o – the Host to compare to
Returns:

{@inheritDoc}

createTemporaryVm

public boolean createTemporaryVm(Vm vm)

createVm

public boolean createVm(Vm vm)

deallocateResourcesOfAllVms

protected void deallocateResourcesOfAllVms()

Deallocate all resources that all VMs were using.

deallocateResourcesOfVm

protected void deallocateResourcesOfVm(Vm vm)

Deallocate all resources that a VM was using.

Parameters:
  • vm – the VM

destroyAllVms

public void destroyAllVms()

destroyTemporaryVm

public void destroyTemporaryVm(Vm vm)

destroyVm

public void destroyVm(Vm vm)

disableStateHistory

public void disableStateHistory()

enableStateHistory

public void enableStateHistory()

equals

public boolean equals(Object o)

getAllocatedMipsForVm

protected List<Double> getAllocatedMipsForVm(Vm vm)

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

getAvailableMips

public double getAvailableMips()

getAvailableStorage

public long getAvailableStorage()

getBusyPeList

public List<Pe> getBusyPeList()

getBw

public Resource getBw()

getBwProvisioner

public ResourceProvisioner getBwProvisioner()

getDatacenter

public Datacenter getDatacenter()

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.

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.

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.

getFailedPesNumber

public long getFailedPesNumber()

getFinishedVms

public List<Vm> getFinishedVms()

getFreePeList

public List<Pe> getFreePeList()

getFreePesNumber

public int getFreePesNumber()

getId

public long getId()

getMaxAvailableMips

protected double getMaxAvailableMips()

Returns the maximum available MIPS among all the PEs of the host.

Returns:max mips

getMigratableVms

public List<Vm> getMigratableVms()

getMips

public double getMips()

getNumberOfPes

public long getNumberOfPes()

{@inheritDoc}

Returns:{@inheritDoc}

See also: .getWorkingPesNumber(), .getFreePesNumber(), .getFailedPesNumber()

getPeList

public List<Pe> getPeList()

getPowerModel

public PowerModel getPowerModel()

getPreviousUtilizationOfCpu

public double getPreviousUtilizationOfCpu()

getProvisioner

public ResourceProvisioner getProvisioner(Class<? extends ResourceManageable> resourceClass)

getRam

public Resource getRam()

getRamProvisioner

public ResourceProvisioner getRamProvisioner()

getResources

public List<ResourceManageable> getResources()

getShutdownTime

public double getShutdownTime()

getSimulation

public Simulation getSimulation()

getStartTime

public double getStartTime()

getStateHistory

public List<HostStateHistoryEntry> getStateHistory()

getStorage

public Resource getStorage()

getTotalAllocatedMipsForVm

public double getTotalAllocatedMipsForVm(Vm vm)

getTotalMipsCapacity

public double getTotalMipsCapacity()

getUtilizationHistory

public SortedMap<Double, DoubleSummaryStatistics> getUtilizationHistory()

getUtilizationHistorySum

public SortedMap<Double, Double> getUtilizationHistorySum()

getUtilizationOfBw

public long getUtilizationOfBw()

getUtilizationOfCpu

public double getUtilizationOfCpu()

getUtilizationOfCpuMips

public double getUtilizationOfCpuMips()

getUtilizationOfRam

public long getUtilizationOfRam()

getVmCreatedList

public <T extends Vm> List<T> getVmCreatedList()

getVmList

public <T extends Vm> List<T> getVmList()

getVmScheduler

public VmScheduler getVmScheduler()

getVmsMigratingIn

public <T extends Vm> Set<T> getVmsMigratingIn()

getVmsMigratingOut

public Set<Vm> getVmsMigratingOut()

getWorkingPeList

public List<Pe> getWorkingPeList()

getWorkingPesNumber

public long getWorkingPesNumber()

hashCode

public int hashCode()

isActive

public boolean isActive()

isFailed

public boolean isFailed()

isStateHistoryEnabled

public boolean isStateHistoryEnabled()

isSuitableForVm

public boolean isSuitableForVm(Vm vm)

reallocateMigratingInVms

public void reallocateMigratingInVms()

removeMigratingInVm

public void removeMigratingInVm(Vm vm)

removeOnUpdateProcessingListener

public boolean removeOnUpdateProcessingListener(EventListener<HostUpdatesVmsProcessingEventInfo> listener)

removeVmMigratingOut

public boolean removeVmMigratingOut(Vm vm)

setActive

public final Host setActive(boolean active)

setBwProvisioner

public final Host setBwProvisioner(ResourceProvisioner bwProvisioner)

setDatacenter

public final void setDatacenter(Datacenter datacenter)

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.

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.

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.

setFailed

public final boolean setFailed(boolean failed)

setId

public final void setId(long id)

setPeList

protected final Host setPeList(List<Pe> peList)

Sets the pe list.

Parameters:
  • peList – the new pe list

setPowerModel

public Host setPowerModel(PowerModel powerModel)

setRamProvisioner

public final Host setRamProvisioner(ResourceProvisioner ramProvisioner)

setShutdownTime

public void setShutdownTime(double shutdownTime)

setSimulation

public final Host setSimulation(Simulation simulation)

setStartTime

public void setStartTime(double startTime)

setVmScheduler

public final Host setVmScheduler(VmScheduler vmScheduler)

toString

public String toString()

updateProcessing

public double updateProcessing(double currentTime)