Skip to content

Commit 821b03f

Browse files
authored
Merge pull request #11033 from hyonholee/february
[Compute] Allow empty value for ProximityPlacementGroupId during update
2 parents 68a75f2 + 3e9e95b commit 821b03f

File tree

16 files changed

+4190
-3243
lines changed

16 files changed

+4190
-3243
lines changed

src/Compute/Compute.Test/Compute.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<ItemGroup>
1414
<PackageReference Include="Microsoft.Azure.Graph.RBAC" Version="3.4.0-preview" />
15-
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="31.0.0" />
15+
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="31.1.0" />
1616
<PackageReference Include="Microsoft.Azure.Management.KeyVault" Version="2.4.2" />
1717
<PackageReference Include="Microsoft.Azure.Management.Network" Version="19.18.0-preview" />
1818
</ItemGroup>

src/Compute/Compute.Test/ScenarioTests/DedicatedHostTests.ps1

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,21 @@ function Test-DedicatedHostVirtualMachine
190190
Assert-AreEqual 1 $dedicatedHostGroup.Hosts.Count;
191191
Assert-AreEqual $dedicatedHostId $dedicatedHostGroup.Hosts[0].Id;
192192

193+
# Remove Host from VM
194+
Stop-AzVM -ResourceGroupName $rgname -Name $vmName1 -Force;
195+
$vm1.Host.Id = $null;
196+
Update-AzVM -ResourceGroupName $rgname -VM $vm1;
197+
198+
$vm1 = Get-AzVM -ResourceGroupName $rgname -Name $vmname1;
199+
Assert-Null $vm1.Host;
200+
$dedicatedHost = Get-AzHost -ResourceGroupName $rgname -HostGroupName $hostGroupName -Name $hostName;
201+
Assert-AreEqual 1 $dedicatedHost.VirtualMachines.Count;
202+
Assert-AreEqual $vm0.Id $dedicatedHost.VirtualMachines[0].Id;
203+
204+
$dedicatedHostGroup = Get-AzHostGroup -ResourceGroupName $rgname -HostGroupName $hostGroupNam;
205+
Assert-AreEqual 1 $dedicatedHostGroup.Hosts.Count;
206+
Assert-AreEqual $dedicatedHostId $dedicatedHostGroup.Hosts[0].Id;
207+
193208
Remove-AzVM -ResourceGroupName $rgname -Name $vmname1 -Force;
194209

195210
$dedicatedHost = Get-AzHost -ResourceGroupName $rgname -HostGroupName $hostGroupName -Name $hostName;

src/Compute/Compute.Test/ScenarioTests/PPGTests.ps1

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,18 @@ function Test-ProximityPlacementGroupVM
299299
Assert-AreEqual $vm.Id $ppgStatus2.VirtualMachines[0].Id;
300300
Check-ColocationStatusUnknown $ppgStatus2.ColocationStatus;
301301

302+
Update-AzVM -ResourceGroupName $rgname -VM $vm -ProximityPlacementGroupId "";
303+
$vm = Get-AzVM -ResourceGroupName $rgname -Name $vmName;
304+
Assert-Null $vm.ProximityPlacementGroup.Id;
305+
306+
$ppg2 = Get-AzProximityPlacementGroup -ResourceGroupName $rgname -Name $ppgname2;
307+
Assert-AreEqual 0 $ppg2.VirtualMachines.Count;
308+
Assert-Null $ppg2.ColocationStatus;
309+
310+
$ppgStatus2 =Get-AzProximityPlacementGroup -ResourceGroupName $rgname -Name $ppgname2 -ColocationStatus;
311+
Assert-AreEqual 0 $ppgStatus2.VirtualMachines.Count;
312+
Check-ColocationStatus $ppgStatus2.ColocationStatus;
313+
302314
Remove-AzVM -ResourceGroupName $rgname -Name $vmName -Force;
303315
$ppg = Get-AzProximityPlacementGroup -ResourceGroupName $rgname -Name $ppgname;
304316
Assert-Null $ppg.VirtualMachines;

src/Compute/Compute.Test/SessionRecords/Microsoft.Azure.Commands.Compute.Test.ScenarioTests.DedicatedHostTests/TestDedicatedHostVirtualMachine.json

Lines changed: 2453 additions & 2289 deletions
Large diffs are not rendered by default.

src/Compute/Compute.Test/SessionRecords/Microsoft.Azure.Commands.Compute.Test.ScenarioTests.PPGTests/TestPPGVM.json

Lines changed: 1667 additions & 941 deletions
Large diffs are not rendered by default.

src/Compute/Compute/AvailabilitySets/UpdateAzureAvailabilitySetCommand.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public class UpdateAzureAvailabilitySetCommand : AvailabilitySetBaseCmdlet
4747

4848
[Parameter(
4949
Mandatory = false)]
50-
[ValidateNotNullOrEmpty]
50+
[AllowEmptyString]
5151
public string ProximityPlacementGroupId { get; set; }
5252

5353
[Parameter(
@@ -79,6 +79,11 @@ public override void ExecuteCmdlet()
7979
: this.AvailabilitySet.ProximityPlacementGroup
8080
};
8181

82+
if (avSetParams.ProximityPlacementGroup != null && string.IsNullOrEmpty(avSetParams.ProximityPlacementGroup.Id))
83+
{
84+
avSetParams.ProximityPlacementGroup.Id = null;
85+
}
86+
8287
var result = this.AvailabilitySetClient.CreateOrUpdateWithHttpMessagesAsync(
8388
this.AvailabilitySet.ResourceGroupName,
8489
this.AvailabilitySet.Name,

src/Compute/Compute/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
- Additional information about change #1
2020
-->
2121
## Upcoming Release
22+
* Allow empty value for ProximityPlacementGroupId during update
2223

2324
## Version 3.4.0
2425
* Limit the number of VM status to 100 to avoid throttling when Get-AzVM -Status is performed without VM name.

src/Compute/Compute/Compute.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
<ItemGroup>
1515
<PackageReference Include="AutoMapper" Version="6.2.2" />
16-
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="31.0.0" />
16+
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="31.1.0" />
1717
<PackageReference Include="System.Security.Permissions" Version="4.5.0" />
1818
<PackageReference Include="System.ServiceModel.Primitives" Version="4.4.1" />
1919
<PackageReference Include="WindowsAzure.Storage" Version="9.3.0" />

src/Compute/Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetUpdateMethod.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ public override void ExecuteCmdlet()
251251

252252
[Parameter(
253253
Mandatory = false)]
254-
[ValidateNotNullOrEmpty]
254+
[AllowEmptyString]
255255
public string ProximityPlacementGroupId { get; set; }
256256

257257
[Parameter(
@@ -1096,6 +1096,13 @@ private void BuildPatchObject()
10961096
this.VirtualMachineScaleSetUpdate.VirtualMachineProfile.StorageProfile.OsDisk.VhdContainers = this.VhdContainer;
10971097
}
10981098

1099+
if (this.VirtualMachineScaleSetUpdate != null
1100+
&& this.VirtualMachineScaleSetUpdate.ProximityPlacementGroup != null
1101+
&& string.IsNullOrEmpty(this.VirtualMachineScaleSetUpdate.ProximityPlacementGroup.Id))
1102+
{
1103+
this.VirtualMachineScaleSetUpdate.ProximityPlacementGroup.Id = null;
1104+
}
1105+
10991106
if (this.VirtualMachineScaleSetUpdate != null
11001107
&& this.VirtualMachineScaleSetUpdate.VirtualMachineProfile != null
11011108
&& this.VirtualMachineScaleSetUpdate.VirtualMachineProfile.OsProfile != null
@@ -1699,6 +1706,13 @@ private void BuildPutObject()
16991706
this.VirtualMachineScaleSet.VirtualMachineProfile.StorageProfile.OsDisk.VhdContainers = this.VhdContainer;
17001707
}
17011708

1709+
if (this.VirtualMachineScaleSet != null
1710+
&& this.VirtualMachineScaleSet.ProximityPlacementGroup != null
1711+
&& string.IsNullOrEmpty(this.VirtualMachineScaleSet.ProximityPlacementGroup.Id))
1712+
{
1713+
this.VirtualMachineScaleSet.ProximityPlacementGroup.Id = null;
1714+
}
1715+
17021716
if (this.VirtualMachineScaleSet != null
17031717
&& this.VirtualMachineScaleSet.VirtualMachineProfile != null
17041718
&& this.VirtualMachineScaleSet.VirtualMachineProfile.OsProfile != null

src/Compute/Compute/VirtualMachine/Operation/UpdateAzureVMCommand.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public class UpdateAzureVMCommand : VirtualMachineBaseCmdlet
109109

110110
[Parameter(
111111
Mandatory = false)]
112-
[ValidateNotNullOrEmpty]
112+
[AllowEmptyString]
113113
public string ProximityPlacementGroupId { get; set; }
114114

115115
[Parameter(Mandatory = false, HelpMessage = "Run cmdlet in the background")]
@@ -158,6 +158,16 @@ public override void ExecuteCmdlet()
158158
Priority = this.VM.Priority
159159
};
160160

161+
if (parameters.Host != null && string.IsNullOrWhiteSpace(parameters.Host.Id))
162+
{
163+
parameters.Host.Id = null;
164+
}
165+
166+
if (parameters.ProximityPlacementGroup != null && string.IsNullOrWhiteSpace(parameters.ProximityPlacementGroup.Id))
167+
{
168+
parameters.ProximityPlacementGroup.Id = null;
169+
}
170+
161171
if (this.IsParameterBound(c => c.IdentityType))
162172
{
163173
parameters.Identity = new VirtualMachineIdentity(null, null, this.IdentityType, null);

src/Compute/Compute/help/New-AzDiskEncryptionSet.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ schema: 2.0.0
88
# New-AzDiskEncryptionSet
99

1010
## SYNOPSIS
11-
Creates a disk encryption key.
11+
Creates a disk encryption set.
1212

1313
## SYNTAX
1414

@@ -18,7 +18,7 @@ New-AzDiskEncryptionSet [-ResourceGroupName] <String> [-Name] <String> [-InputOb
1818
```
1919

2020
## DESCRIPTION
21-
Creates a disk encryption key.
21+
Creates a disk encryption set.
2222

2323
## EXAMPLES
2424

src/Compute/Compute/help/Update-AzDiskEncryptionSet.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ schema: 2.0.0
88
# Update-AzDiskEncryptionSet
99

1010
## SYNOPSIS
11-
Updates a disk encryption key.
11+
Updates a disk encryption set.
1212

1313
## SYNTAX
1414

@@ -34,7 +34,7 @@ Update-AzDiskEncryptionSet [-InputObject] <PSDiskEncryptionSet> [-KeyUrl <String
3434
```
3535

3636
## DESCRIPTION
37-
Updates a disk encryption key.
37+
Updates a disk encryption set.
3838

3939
## EXAMPLES
4040

src/Network/Network.Test/Network.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<PackageReference Include="Microsoft.Azure.Graph.RBAC" Version="3.4.0-preview" />
1717
<PackageReference Include="Microsoft.Azure.Management.Network" Version="19.18.0-preview" />
1818
<PackageReference Include="Microsoft.Azure.Insights" Version="0.16.0-preview" />
19-
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="31.0.0" />
19+
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="31.1.0" />
2020
<PackageReference Include="Microsoft.Azure.Management.ContainerInstance" Version="2.0.0" />
2121
<PackageReference Include="Microsoft.Azure.Management.Redis" Version="4.4.1" />
2222
<PackageReference Include="Microsoft.Azure.Management.OperationalInsights" Version="0.19.0-preview" />

src/RecoveryServices/RecoveryServices.Backup.Test/RecoveryServices.Backup.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</PropertyGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="31.0.0" />
14+
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="31.1.0" />
1515
<PackageReference Include="Microsoft.Azure.Management.Network" Version="19.18.0-preview" />
1616
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices" Version="4.2.1-preview" />
1717
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices.Backup" Version="4.0.1-preview" />

src/RecoveryServices/RecoveryServices.SiteRecovery.Test/RecoveryServices.SiteRecovery.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</PropertyGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="31.0.0" />
14+
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="31.1.0" />
1515
<PackageReference Include="Microsoft.Azure.Management.Network" Version="19.18.0-preview" />
1616
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices" Version="4.2.1-preview" />
1717
<PackageReference Include="Microsoft.Azure.Management.Storage" Version="14.3.0" />

src/SqlVirtualMachine/SqlVirtualMachine.Test/SqlVirtualMachine.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
</ItemGroup>
1616

1717
<ItemGroup>
18-
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="31.0.0" />
18+
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="31.1.0" />
1919
<PackageReference Include="Microsoft.Azure.Management.Network" Version="19.18.0-preview" />
2020
<PackageReference Include="Microsoft.Azure.Management.Storage" Version="13.1.0" />
2121
<PackageReference Include="Microsoft.Azure.Management.ResourceManager" Version="3.0.0-preview" />

0 commit comments

Comments
 (0)