Exemplo n.º 1
0
        public void VolumeAttach()
        {
            Configure();
            var resp = attachedVolumesApi.AttachVolume(datacenter.Id, server.Id, new Volume {
                Id = volume.Id
            });

            DoWait(resp.Request);


            bool isBusy = true;

            while (isBusy == true)
            {
                var dc = dcApi.FindById(datacenter.Id);
                if (dc.Metadata.State != "BUSY")
                {
                    isBusy = false;
                }
                Thread.Sleep(2000);
            }

            var list = attachedVolumesApi.FindAll(datacenter.Id, server.Id);
            var vol  = list.Items.Where(v => v.Id == volume.Id).FirstOrDefault();

            var serv = serverApi.PartialUpdate(datacenter.Id, server.Id, new ServerProperties {
                BootVolume = new ResourceReference {
                    Id = vol.Id
                }
            });

            Assert.AreEqual(vol.Id, volume.Id);
        }
        protected override void BeginProcessing()
        {
            try
            {
                var attachedVolumesApi = new AttachedVolumesApi(Utilities.Configuration);

                var volumes = attachedVolumesApi.FindAll(this.DataCenterId, this.ServerId, depth: 5);
                WriteObject(volumes.Items);
            }
            catch (Exception ex)
            {
                WriteError(new ErrorRecord(ex, "", ErrorCategory.NotSpecified, null));
            }
        }