public class Host
extends java.lang.Object
| Constructor and Description |
|---|
Host(int id,
RamProvisioner ramProvisioner,
BwProvisioner bwProvisioner,
long storage,
java.util.List<? extends Pe> peList,
VmScheduler vmScheduler)
Instantiates a new host.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addMigratingInVm(Vm vm)
Adds the migrating in vm.
|
boolean |
allocatePesForVm(Vm vm,
java.util.List<java.lang.Double> mipsShare)
Allocates PEs for a VM.
|
void |
deallocatePesForVm(Vm vm)
Releases PEs allocated to a VM.
|
java.util.List<java.lang.Double> |
getAllocatedMipsForVm(Vm vm)
Returns the MIPS share of each Pe that is allocated to a given VM.
|
double |
getAvailableMips()
Gets the free mips.
|
long |
getBw()
Gets the machine bw.
|
BwProvisioner |
getBwProvisioner()
Gets the bw provisioner.
|
Datacenter |
getDatacenter()
Gets the data center.
|
int |
getId()
Gets the id.
|
double |
getMaxAvailableMips()
Returns maximum available MIPS among all the PEs.
|
int |
getNumberOfFreePes()
Gets the free pes number.
|
int |
getNumberOfPes()
Gets the pes number.
|
<T extends Pe> |
getPeList()
Gets the pe list.
|
int |
getRam()
Gets the machine memory.
|
RamProvisioner |
getRamProvisioner()
Gets the ram provisioner.
|
long |
getStorage()
Gets the machine storage.
|
double |
getTotalAllocatedMipsForVm(Vm vm)
Gets the total allocated MIPS for a VM over all the PEs.
|
int |
getTotalMips()
Gets the total mips.
|
Vm |
getVm(int vmId,
int userId)
Returns a VM object.
|
<T extends Vm> |
getVmList()
Gets the vm list.
|
VmScheduler |
getVmScheduler()
Gets the VM scheduler.
|
java.util.List<Vm> |
getVmsMigratingIn()
Gets the vms migrating in.
|
boolean |
isFailed()
Checks if is failed.
|
boolean |
isSuitableForVm(Vm vm)
Checks if is suitable for vm.
|
void |
reallocateMigratingInVms()
Reallocate migrating in vms.
|
void |
removeMigratingInVm(Vm vm)
Removes the migrating in vm.
|
protected void |
setBwProvisioner(BwProvisioner bwProvisioner)
Sets the bw provisioner.
|
void |
setDatacenter(Datacenter datacenter)
Sets the data center.
|
boolean |
setFailed(boolean failed)
Sets the PEs of this machine to a FAILED status.
|
boolean |
setFailed(java.lang.String resName,
boolean failed)
Sets the PEs of this machine to a FAILED status.
|
protected void |
setId(int id)
Sets the id.
|
protected <T extends Pe> |
setPeList(java.util.List<T> peList)
Sets the pe list.
|
boolean |
setPeStatus(int peId,
int status)
Sets the particular Pe status on this Machine.
|
protected void |
setRamProvisioner(RamProvisioner ramProvisioner)
Sets the ram provisioner.
|
protected void |
setStorage(long storage)
Sets the storage.
|
protected void |
setVmScheduler(VmScheduler vmScheduler)
Sets the VM scheduler.
|
double |
updateVmsProcessing(double currentTime)
Requests updating of processing of cloudlets in the VMs running in this host.
|
boolean |
vmCreate(Vm vm)
Allocates PEs and memory to a new VM in the Host.
|
protected void |
vmDeallocate(Vm vm)
Deallocate all hostList for the VM.
|
protected void |
vmDeallocateAll()
Deallocate all hostList for the VM.
|
void |
vmDestroy(Vm vm)
Destroys a VM running in the host.
|
void |
vmDestroyAll()
Destroys all VMs running in the host.
|
public Host(int id,
RamProvisioner ramProvisioner,
BwProvisioner bwProvisioner,
long storage,
java.util.List<? extends Pe> peList,
VmScheduler vmScheduler)
id - the idramProvisioner - the ram provisionerbwProvisioner - the bw provisionerstorage - the storagepeList - the pe listvmScheduler - the vm schedulerpublic double updateVmsProcessing(double currentTime)
currentTime - the current timepublic void addMigratingInVm(Vm vm)
vm - the vmpublic void removeMigratingInVm(Vm vm)
vm - the vmpublic void reallocateMigratingInVms()
public boolean isSuitableForVm(Vm vm)
vm - the vmpublic boolean vmCreate(Vm vm)
vm - Vm being startedpublic void vmDestroy(Vm vm)
vm - the VMpublic void vmDestroyAll()
protected void vmDeallocate(Vm vm)
vm - the VMprotected void vmDeallocateAll()
public Vm getVm(int vmId, int userId)
vmId - the vm iduserId - ID of VM's ownerpublic int getNumberOfPes()
public int getNumberOfFreePes()
public int getTotalMips()
public boolean allocatePesForVm(Vm vm, java.util.List<java.lang.Double> mipsShare)
vm - the vmmipsShare - the mips sharepublic void deallocatePesForVm(Vm vm)
vm - the vmpublic java.util.List<java.lang.Double> getAllocatedMipsForVm(Vm vm)
vm - the vmpublic double getTotalAllocatedMipsForVm(Vm vm)
vm - the vmpublic double getMaxAvailableMips()
public double getAvailableMips()
public long getBw()
public int getRam()
public long getStorage()
public int getId()
protected void setId(int id)
id - the new idpublic RamProvisioner getRamProvisioner()
protected void setRamProvisioner(RamProvisioner ramProvisioner)
ramProvisioner - the new ram provisionerpublic BwProvisioner getBwProvisioner()
protected void setBwProvisioner(BwProvisioner bwProvisioner)
bwProvisioner - the new bw provisionerpublic VmScheduler getVmScheduler()
protected void setVmScheduler(VmScheduler vmScheduler)
vmScheduler - the vm schedulerpublic <T extends Pe> java.util.List<T> getPeList()
T - the generic typeprotected <T extends Pe> void setPeList(java.util.List<T> peList)
T - the generic typepeList - the new pe listpublic <T extends Vm> java.util.List<T> getVmList()
T - the generic typeprotected void setStorage(long storage)
storage - the new storagepublic boolean isFailed()
public boolean setFailed(java.lang.String resName,
boolean failed)
setFailed(boolean) if you do not want
this information.resName - the name of the resourcefailed - the failedpublic boolean setFailed(boolean failed)
failed - the failedpublic boolean setPeStatus(int peId,
int status)
peId - the pe idstatus - Pe status, either Pe.FREE or Pe.BUSYpublic java.util.List<Vm> getVmsMigratingIn()
public Datacenter getDatacenter()
public void setDatacenter(Datacenter datacenter)
datacenter - the data center from this host