Skip to content

[Compute] Fix Remove-AzVmssVMDataDisk cmdlet and update VM instance view object #9713

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Compute/Compute.Test/Compute.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Graph.RBAC" Version="3.4.0-preview" />
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="27.0.0" />
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="27.1.0" />
<PackageReference Include="Microsoft.Azure.Management.KeyVault" Version="2.4.2" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="19.13.0-preview" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1972,7 +1972,8 @@ function Test-VirtualMachineScaleSetVMUpdate
Assert-AreEqual 1 $vmssVM.StorageProfile.DataDisks.Count;

$vmssVM = Remove-AzVmssVMDataDisk -VirtualMachineScaleSetVM $vmssVM -Lun 0;
Assert-Null $vmssVM.StorageProfile.DataDisks;
Assert-NotNull $vmssVM.StorageProfile.DataDisks;
Assert-AreEqual 0 $vmssVM.StorageProfile.DataDisks.Count;

$result = $vmssVMs[0] `
| Add-AzVmssVMDataDisk -Caching 'ReadOnly' -DiskSizeInGB 10 -Lun 1 -CreateOption Attach -StorageAccountType Standard_LRS -ManagedDiskId $disk0.Id `
Expand Down
1 change: 1 addition & 0 deletions src/Compute/Compute/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- Additional information about change #1
-->
## Upcoming Release
* Add missing properties (ComputerName, OsName, OsVersion and HyperVGeneration) of VM instance view object.

## Version 2.4.0
* Add HyperVGeneration parameter to New-AzImageConfig
Expand Down
2 changes: 1 addition & 1 deletion src/Compute/Compute/Compute.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<ItemGroup>
<PackageReference Include="AutoMapper" Version="6.2.2" />
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="27.0.0" />
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="27.1.0" />
<PackageReference Include="System.Security.Permissions" Version="4.5.0" />
<PackageReference Include="System.ServiceModel.Primitives" Version="4.4.1" />
<PackageReference Include="WindowsAzure.Storage" Version="9.3.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,7 @@ public override void ExecuteCmdlet()
var disks = storageProfile.DataDisks.ToList();
disks.RemoveAll(d => d.Lun == this.Lun);

if (disks.Count == 0)
{
storageProfile.DataDisks = null;
}
else
{
storageProfile.DataDisks = disks;
}
storageProfile.DataDisks = disks;
}

this.VirtualMachineScaleSetVM.StorageProfile = storageProfile;
Expand Down
10 changes: 9 additions & 1 deletion src/Compute/Compute/Models/PSVirtualMachineInstanceView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ public class PSVirtualMachineInstanceView
public string ResourceGroupName { get; set; }

public string Name { get; set; }
public string ComputerName { get; set; }
public string OsName { get; set; }
public string OsVersion { get; set; }
public string HyperVGeneration { get; set; }

public BootDiagnosticsInstanceView BootDiagnostics { get; set; }

Expand Down Expand Up @@ -61,7 +65,11 @@ public static PSVirtualMachineInstanceView ToPSVirtualMachineInstanceView(
PlatformUpdateDomain = virtualMachineInstanceView.PlatformUpdateDomain,
RemoteDesktopThumbprint = virtualMachineInstanceView.RdpThumbPrint,
VMAgent = virtualMachineInstanceView.VmAgent,
MaintenanceRedeployStatus = virtualMachineInstanceView.MaintenanceRedeployStatus
MaintenanceRedeployStatus = virtualMachineInstanceView.MaintenanceRedeployStatus,
ComputerName = virtualMachineInstanceView.ComputerName,
OsName = virtualMachineInstanceView.OsName,
OsVersion = virtualMachineInstanceView.OsVersion,
HyperVGeneration = virtualMachineInstanceView.HyperVGeneration
};

return result;
Expand Down
2 changes: 1 addition & 1 deletion src/Network/Network.Test/Network.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<PackageReference Include="Microsoft.Azure.Graph.RBAC" Version="3.4.0-preview" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="19.13.0-preview" />
<PackageReference Include="Microsoft.Azure.Insights" Version="0.16.0-preview" />
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="27.0.0" />
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="27.1.0" />
<PackageReference Include="Microsoft.Azure.Management.ContainerInstance" Version="2.0.0" />
<PackageReference Include="Microsoft.Azure.Management.Redis" Version="4.4.1" />
<PackageReference Include="Microsoft.Azure.Management.OperationalInsights" Version="0.19.0-preview" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="27.0.0" />
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="27.1.0" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="19.13.0-preview" />
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices" Version="4.2.1-preview" />
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices.Backup" Version="3.1.1-preview" />
Expand Down