public void VolumeUpdate() { Configure(); var newProps = new VolumeProperties { Size = volume.Properties.Size + 1 }; var newVolume = volumeApi.PartialUpdate(datacenter.Id, volume.Id, newProps); DoWait(newVolume.Request); bool isBusy = true; while (isBusy == true) { var dc = dcApi.FindById(datacenter.Id); if (dc.Metadata.State != "BUSY") { isBusy = false; } Thread.Sleep(2000); } isBusy = true; while (isBusy == true) { newVolume = volumeApi.FindById(datacenter.Id, volume.Id); if (newVolume.Metadata.State != "BUSY") { isBusy = false; } Thread.Sleep(2000); } newVolume = volumeApi.FindById(datacenter.Id, volume.Id); Assert.AreEqual(newVolume.Properties.Size, volume.Properties.Size + 1); volume = newVolume; }
protected override void BeginProcessing() { try { var newProps = new VolumeProperties(); if (!string.IsNullOrEmpty(this.Name)) { newProps.Name = this.Name; } if (!string.IsNullOrEmpty(this.Type)) { newProps.Type = this.Type; } if (!string.IsNullOrEmpty(this.Bus)) { newProps.Bus = this.Bus; } if (!string.IsNullOrEmpty(this.ImageId)) { newProps.Image = this.ImageId; } if (!string.IsNullOrEmpty(this.LicenceType)) { newProps.LicenceType = this.LicenceType; } if (!string.IsNullOrEmpty(this.ImagePassword)) { newProps.ImagePassword = this.ImagePassword; } if (!string.IsNullOrEmpty(this.SshKey)) { newProps.SshKeys = new List <string> { SshKey }; } if (this.Size != 0) { newProps.Size = this.Size; } if (!string.IsNullOrEmpty(AvailabilityZone)) { newProps.AvailabilityZone = AvailabilityZone; } newProps.CpuHotPlug = CpuHotPlug; newProps.CpuHotUnplug = CpuHotUnplug; newProps.DiscScsiHotPlug = DiscScsiHotPlug; newProps.DiscScsiHotUnplug = DiscScsiHotUnplug; newProps.DiscVirtioHotPlug = DiscVirtioHotPlug; newProps.DiscVirtioHotUnplug = DiscVirtioHotUnplug; var volumeApi = new VolumeApi(Utilities.Configuration); var resp = volumeApi.PartialUpdate(DataCenterId, VolumeId, newProps); WriteObject(resp); } catch (Exception ex) { WriteError(new ErrorRecord(ex, "", ErrorCategory.NotSpecified, null)); } }