Esempio n. 1
0
 protected void VmDeallocate(Vm vm)
 {
     RamProvisioner.DeallocateRamForVm(vm);
     BwProvisioner.DeallocateBwForVm(vm);
     VmScheduler.DeallocatePesForVm(vm);
     Storage += vm.Size;
 }
Esempio n. 2
0
 public bool IsSuitableForVm(Vm vm)
 {
     return(VmScheduler.GetPeCapacity() >= vm.GetCurrentRequestedMaxMips() &&
            VmScheduler.AvailableMips >= vm.GetCurrentRequestedTotalMips() &&
            RamProvisioner.IsSuitableForVm(vm, vm.GetCurrentRequestedRam()) &&
            BwProvisioner.IsSuitableForVm(vm, vm.GetCurrentRequestedBw()));
 }
Esempio n. 3
0
 public Host(
     int id,
     RamProvisioner ramProvisioner,
     BwProvisioner bwProvisioner,
     long storage,
     List <Pe> peList,
     VmScheduler vmScheduler)
 {
 }
Esempio n. 4
0
 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;
     }
 }
Esempio n. 5
0
        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);
            }
        }
Esempio n. 6
0
        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);
        }
Esempio n. 7
0
 protected void VmDeallocateAll()
 {
     RamProvisioner.DeallocateRamForAllVms();
     BwProvisioner.DeallocateBwForAllVms();
     VmScheduler.DeallocatePesForAllVms();
 }