Exemplo n.º 1
0
        protected override void Execute()
        {
            MigrationParameters migrationParameters = new MigrationParameters
            {
                ContainerName           = this.ContainerToMigrate.ContainerName,
                DestinationShareUncPath = this.DestinationShareUncPath,
                StorageAccountName      = this.ContainerToMigrate.StorageAccountName
            };

            this.WriteVerbose(String.Format(
                                  "Input Parameters : ContainerName = {0}, DestinationShareUncPath = {1}, StorageAccountName = {2}",
                                  this.ContainerToMigrate.ContainerName,
                                  this.DestinationShareUncPath,
                                  this.ContainerToMigrate.StorageAccountName));
            this.WriteVerbose(String.Format("Container Source share name = {0}", this.ContainerToMigrate.ShareName));
            // Workaround, replace \\server\share to ||server|share
            string sourceShare = this.ContainerToMigrate.ShareName;

            if (sourceShare.Contains('\\'))
            {
                sourceShare = sourceShare.Replace('\\', '|');
                this.WriteVerbose(String.Format("Container Source share name After Replacing = {0}", sourceShare));
            }

            MigrateContainerResponse response = this.Client.Shares.MigrateContainer(this.ResourceGroupName, this.FarmName, sourceShare, migrationParameters);

            //This should display the jobid from http header
            // use following way to return a hash table. if u want to include any other strings.
            // this.WriteObject(new Hashtable() { { "JobId", jobId }}, true);
            string jobId;

            ExtractOperationIdFromLocationUri(response.Location, out jobId);
            this.WriteObject(jobId, true);
        }
 private void HandleMigrateContainerResponce(MigrateContainerResponse message)
 {
     if (message.Done)
     {
         ContainerTable.FreeLockedContainer();
         //_containersTable.Remove(sendContainerResponce.ContainerId);
     }
     else
     {
         ContainerTable.UnLockContainer();
     }
     //Release Lock
     _hostState.CurrentAction = HostCurrentAction.None;
 }
Exemplo n.º 3
0
 private void HandleMigrateContainerResponce(MigrateContainerResponse message)
 {
     if (message.Done)
     {
         ContainerTable.FreeLockedContainer();
         //_containersTable.Remove(sendContainerResponce.ContainerId);
     }
     else
     {
         ContainerTable.UnLockContainer();
     }
     //Release Lock
     BidLock = -1;
 }
Exemplo n.º 4
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 HandleMigrateContainerResponse(MigrateContainerResponse message)
        {
            if (message.Done)
            {
                ContainerTable.FreeLockedContainer();
                Busy = false;
                //ResetBackOff();

                //_containersTable.Remove(sendContainerResponce.ContainerId);
            }
            else
            {
                throw new NotImplementedException("responce");
                //_containerTable.UnLockContainer();
            }
            //BidLock = -1;
        }
        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();
        }