private void CollectImagePull() { lock (_lock) { if (MeasureHolder.ContainerType == ContainersType.D) { var dockerRegistry = _machineTable.GetMachineById(int.MaxValue) as DockerRegistryMachine; MeasureHolder.PullsPerImage = dockerRegistry.GetPullsPerImage(); } } }
public void StartSimulation() { lock (_lock) { //NetworkSwitch.Started = true; foreach (var machine in MachineTable.GetAllMachines().Skip(1).Where(x => x.MachineId < int.MaxValue)) { DataHolder.SetUtilization(machine.MachineId, UtilizationStates.Normal); machine.StartMachine(); } MachineTable.GetMachineById(0).StartMachine(); if (ContainerTypes == ContainersType.D) { MachineTable.GetMachineById(int.MaxValue).StartMachine(); } } }
//public int GetMachinesCount() //{ // lock (_lock) // { // return MachineTable.GetMachinesCount(); // } //} public void PowerOffHost(int machineId) { lock (_lock) { var machine = MachineTable.GetMachineById(machineId); if ((machine as HostMachine).GetContainersCount() != 0) { //return false; throw new NotImplementedException(); } else { machine.StopMachine(); //PoweredOffMachinesTable.AddMachine(machine.MachineId, machine); MachineTable.RemoveMachine(machineId); DataHolder.RemoveUtilization(machineId); ReadyMachineTable.AddMachine(machineId, machine); //Console.WriteLine($"( ) Power off Host #{machineId}"); //return true; } } }