コード例 #1
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;
     }
 }
コード例 #2
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);
            }
        }
コード例 #3
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);
        }