protected void VmDeallocate(Vm vm) { RamProvisioner.DeallocateRamForVm(vm); BwProvisioner.DeallocateBwForVm(vm); VmScheduler.DeallocatePesForVm(vm); Storage += vm.Size; }
public bool IsSuitableForVm(Vm vm) { return(VmScheduler.GetPeCapacity() >= vm.GetCurrentRequestedMaxMips() && VmScheduler.AvailableMips >= vm.GetCurrentRequestedTotalMips() && RamProvisioner.IsSuitableForVm(vm, vm.GetCurrentRequestedRam()) && BwProvisioner.IsSuitableForVm(vm, vm.GetCurrentRequestedBw())); }
public Host( int id, RamProvisioner ramProvisioner, BwProvisioner bwProvisioner, long storage, List <Pe> peList, VmScheduler vmScheduler) { }
public void ReallocateMigratingInVms() { foreach (Vm vm in VmsMigratingIn) { if (!VmList.Contains(vm)) { VmList.Add(vm); } if (!VmScheduler.VmsMigratingIn.Contains(vm.Uid)) { VmScheduler.VmsMigratingIn.Add(vm.Uid); } RamProvisioner.AllocateRamForVm(vm, vm.GetCurrentRequestedRam()); BwProvisioner.AllocateBwForVm(vm, vm.GetCurrentRequestedBw()); VmScheduler.AllocatePesForVm(vm, vm.GetCurrentRequestedMips()); Storage = Storage - vm.Size; } }
public void AddMigratingInVm(Vm vm) { vm.InMigration = true; if (!VmsMigratingIn.Contains(vm)) { if (Storage < vm.Size) { Log.WriteConcatLine("[VmScheduler.addMigratingInVm] Allocation of VM #", vm.Id, " to Host #", Id, " failed by storage"); Environment.Exit(0); } if (!RamProvisioner.AllocateRamForVm(vm, vm.GetCurrentRequestedRam())) { Log.WriteConcatLine("[VmScheduler.addMigratingInVm] Allocation of VM #", vm.Id, " to Host #", Id, " failed by RAM"); Environment.Exit(0); } if (!BwProvisioner.AllocateBwForVm(vm, vm.GetCurrentRequestedBw())) { Log.WriteLine("[VmScheduler.addMigratingInVm] Allocation of VM #" + vm.Id + " to Host #" + Id + " failed by BW"); Environment.Exit(0); } VmScheduler.VmsMigratingIn.Add(vm.Uid); if (!VmScheduler.AllocatePesForVm(vm, vm.GetCurrentRequestedMips())) { Log.WriteLine("[VmScheduler.addMigratingInVm] Allocation of VM #" + vm.Id + " to Host #" + Id + " failed by MIPS"); Environment.Exit(0); } Storage = Storage - vm.Size; VmsMigratingIn.Add(vm); VmList.Add(vm); UpdateVmsProcessing(Core.CloudSim.Clock); vm.Host.UpdateVmsProcessing(Core.CloudSim.Clock); } }
public bool VmCreate(Vm vm) { if (Storage < vm.Size) { Log.WriteConcatLine( "[VmScheduler.vmCreate] Allocation of VM #", vm.Id, " to Host #", Id, " failed by storage"); return(false); } if (!RamProvisioner.AllocateRamForVm(vm, vm.GetCurrentRequestedRam())) { Log.WriteConcatLine("[VmScheduler.vmCreate] Allocation of VM #", vm.Id, " to Host #", Id, " failed by RAM"); return(false); } if (!BwProvisioner.AllocateBwForVm(vm, vm.GetCurrentRequestedBw())) { Log.WriteConcatLine("[VmScheduler.vmCreate] Allocation of VM #", vm.Id, " to Host #", Id, " failed by BW"); RamProvisioner.DeallocateRamForVm(vm); return(false); } if (!VmScheduler.AllocatePesForVm(vm, vm.GetCurrentRequestedMips())) { Log.WriteConcatLine("[VmScheduler.vmCreate] Allocation of VM #", vm.Id, " to Host #", Id, " failed by MIPS"); RamProvisioner.DeallocateRamForVm(vm); BwProvisioner.DeallocateBwForVm(vm); return(false); } Storage = Storage - vm.Size; VmList.Add(vm); vm.Host = this; return(true); }
protected void VmDeallocateAll() { RamProvisioner.DeallocateRamForAllVms(); BwProvisioner.DeallocateBwForAllVms(); VmScheduler.DeallocatePesForAllVms(); }