private void HanleAddContainerRequest(AddContainerRequest addContainerRequest)
        {
            Task t = new Task(async() => {
                var table     = ContainerTable as DockerContainerTable;
                var dockerCon = addContainerRequest.NewContainer as DockerContainer;
                await table.LoadImage(dockerCon.ImageId);
                ContainerTable.AddContainer(addContainerRequest.NewContainer.ContainerId, addContainerRequest.NewContainer);
            });

            t.Start();
        }
 public void AddContainer(Container container, List <Image> images = null)
 {
     if (container.ContainerType == ContainersType.D)
     {
         //var dockerCon = container as DockerContainer;
         var table = _containerTable as DockerContainerTable;
         //await table.LoadImage(dockerCon.ImageId);
         table.AddImages(images);
     }
     _containerTable.AddContainer(container.ContainerId, container);
 }
Example #3
0
        private void HandleMigrateContainerRequest(MigrateContainerRequest message)
        {
            Task t = new Task(() =>
            {
                ContainerTable.AddContainer(message.MigratedContainer.ContainerId, message.MigratedContainer);
                message.MigratedContainer.Restore(this.MachineId);
                var responce =
                    new MigrateContainerResponse(message.SenderId, this.MachineId, message.MigratedContainer.ContainerId,
                                                 true);
                CommunicationModule.SendMessage(responce);
                BidLock = -1;
                ResetBackOff();
            });

            t.Start();
        }
        private void HandleMigrateContainerRequest(MigrateContainerRequest message)
        {
            message.MigratedContainer.Restore(this.MachineId);
            if (message.MigratedContainer.ContainerType == ContainersType.D)
            {
                var table     = ContainerTable as DockerContainerTable;
                var container = message.MigratedContainer as DockerContainer;
                var t         = table.LoadImage(container.ImageId);
                t.Wait();
            }
            ContainerTable.AddContainer(message.MigratedContainer.ContainerId, message.MigratedContainer);
            var responce =
                new MigrateContainerResponse(message.SenderId, this.MachineId, message.MigratedContainer.ContainerId,
                                             true);

            CommunicationModule.SendMessage(responce);
        }
        private void HandleMigrateContainerRequest(MigrateContainerRequest message)
        {
            Task t = new Task(() =>
            {
                ContainerTable.AddContainer(message.MigratedContainer.ContainerId, message.MigratedContainer);
                //var nd = Global.GetNetworkDelay(message.MessageSize);
                //await Task.Delay(nd*Global.Second);
                message.MigratedContainer.Restore(this.MachineId);
                var responce =
                    new MigrateContainerResponse(message.SenderId, this.MachineId, message.MigratedContainer.ContainerId,
                                                 true);
                CommunicationModule.SendMessage(responce);
                _hostState.CurrentAction = HostCurrentAction.None;
                ResetBackOff();
            });

            t.Start();
        }