Skip to content

Commit 517caff

Browse files
grizzlytheodoreTheodore Changwyunchi-ms
authored
add hostOffloads feature (#19731)
* update code and md * changelog * update argument completer Co-authored-by: Theodore Chang <[email protected]> Co-authored-by: Yunchi Wang <[email protected]>
1 parent b3659f7 commit 517caff

File tree

11 files changed

+137
-17
lines changed

11 files changed

+137
-17
lines changed

src/Compute/Compute/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
* Added the 'BaseRegularPriorityCount' integer property to the following cmdlets: `New-AzVmssConfig` and `Update-AzVmssConfig`
2626
* Added the 'RegularPriorityPercentage' integer property to the following cmdlets: `New-AzVmssConfig` and `Update-AzVmssConfig`
2727
* Added Breaking Changes for Add-AzVMAdditionalUnattendContent and Get-AzGallery cmdlets
28+
* Added `-DiskControllerType` property to the following cmdlets: `New-AzVm`, `New-AzVmss`, `New-AzVmConfig`, `Set-AzVmssStorageProfile`
2829

2930
## Version 4.31.0
3031
* Added Trusted Launch Generic Breaking Change warning for `New-AzVM`, `New-AzDisk` and `New-AzVMSS` cmdlets.

src/Compute/Compute/Generated/VirtualMachineScaleSet/Config/SetAzureRmVmssStorageProfileCommand.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,12 @@ public partial class SetAzureRmVmssStorageProfileCommand : Microsoft.Azure.Comma
150150
ValueFromPipelineByPropertyName = true)]
151151
public VirtualMachineScaleSetDataDisk[] DataDisk { get; set; }
152152

153+
[Parameter(
154+
Mandatory = false,
155+
HelpMessage = "Specifies the disk controller type configured for the VM and VirtualMachineScaleSet. This property is only supported for virtual machines whose operating system disk and VM sku supports Generation 2 (https://docs.microsoft.com/en-us/azure/virtual-machines/generation-2), please check the HyperVGenerations capability returned as part of VM sku capabilities in the response of Microsoft.Compute SKUs api for the region contains V2 (https://docs.microsoft.com/rest/api/compute/resourceskus/list) . <br> For more information about Disk Controller Types supported please refer to https://aka.ms/azure-diskcontrollertypes.")]
156+
[PSArgumentCompleter("SCSI", "NVMe")]
157+
public string DiskControllerType { get; set; }
158+
153159
protected override void ProcessRecord()
154160
{
155161
if (ShouldProcess("VirtualMachineScaleSet", "Set"))
@@ -532,6 +538,20 @@ private void Run()
532538
this.VirtualMachineScaleSet.VirtualMachineProfile.StorageProfile.DataDisks = this.DataDisk;
533539
}
534540

541+
if (this.IsParameterBound(c => c.DiskControllerType))
542+
{
543+
if (this.VirtualMachineScaleSet.VirtualMachineProfile == null)
544+
{
545+
this.VirtualMachineScaleSet.VirtualMachineProfile = new PSVirtualMachineScaleSetVMProfile();
546+
}
547+
// StorageProfile
548+
if (this.VirtualMachineScaleSet.VirtualMachineProfile.StorageProfile == null)
549+
{
550+
this.VirtualMachineScaleSet.VirtualMachineProfile.StorageProfile = new VirtualMachineScaleSetStorageProfile();
551+
}
552+
this.VirtualMachineScaleSet.VirtualMachineProfile.StorageProfile.DiskControllerType = this.DiskControllerType;
553+
}
554+
535555
WriteObject(this.VirtualMachineScaleSet);
536556
}
537557
}

src/Compute/Compute/Manual/VirtualMachineScaleSetCreateOrUpdateMethod.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,13 @@ public partial class NewAzureRmVmss : ComputeAutomationBaseCmdlet
215215
[ResourceIdCompleter("Microsoft.Compute galleries/images/versions")]
216216
public string ImageReferenceId { get; set; }
217217

218+
[Parameter(
219+
Mandatory = false,
220+
ParameterSetName = SimpleParameterSet,
221+
HelpMessage = "Specifies the disk controller type configured for the VM and VirtualMachineScaleSet. This property is only supported for virtual machines whose operating system disk and VM sku supports Generation 2 (https://docs.microsoft.com/en-us/azure/virtual-machines/generation-2), please check the HyperVGenerations capability returned as part of VM sku capabilities in the response of Microsoft.Compute SKUs api for the region contains V2 (https://docs.microsoft.com/rest/api/compute/resourceskus/list) . <br> For more information about Disk Controller Types supported please refer to https://aka.ms/azure-diskcontrollertypes.")]
222+
[PSArgumentCompleter("SCSI", "NVMe")]
223+
public string DiskControllerType { get; set; }
224+
218225
const int FirstPortRangeStart = 50000;
219226

220227
sealed class Parameters : IParameters<VirtualMachineScaleSet>
@@ -407,7 +414,8 @@ private async Task<ResourceConfig<VirtualMachineScaleSet>> SimpleParameterSetNor
407414
capacityReservationId: _cmdlet.IsParameterBound(c => c.CapacityReservationGroupId) ? _cmdlet.CapacityReservationGroupId : null,
408415
userData: _cmdlet.IsParameterBound(c => c.UserData) ? _cmdlet.UserData : null,
409416
imageReferenceId: _cmdlet.IsParameterBound(c => c.ImageReferenceId) ? _cmdlet.ImageReferenceId : null,
410-
auxAuthHeader: auxAuthHeader
417+
auxAuthHeader: auxAuthHeader,
418+
diskControllerType: _cmdlet.DiskControllerType
411419
);
412420
}
413421

src/Compute/Compute/Strategies/ComputeRp/VirtualMachineScaleSetStrategy.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ internal static ResourceConfig<VirtualMachineScaleSet> CreateVirtualMachineScale
6969
string capacityReservationId,
7070
string userData,
7171
string imageReferenceId,
72-
Dictionary<string, List<string>> auxAuthHeader
72+
Dictionary<string, List<string>> auxAuthHeader,
73+
string diskControllerType
7374
)
7475
=> Strategy.CreateResourceConfig(
7576
resourceGroup: resourceGroup,
@@ -110,7 +111,8 @@ Dictionary<string, List<string>> auxAuthHeader
110111
Id = imageReferenceId
111112
},
112113
DataDisks = DataDiskStrategy.CreateVmssDataDisks(
113-
imageAndOsType?.DataDiskLuns, dataDisks)
114+
imageAndOsType?.DataDiskLuns, dataDisks),
115+
DiskControllerType = diskControllerType
114116
},
115117
NetworkProfile = new VirtualMachineScaleSetNetworkProfile
116118
{

src/Compute/Compute/Strategies/ComputeRp/VirtualMachineStrategy.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ public static ResourceConfig<VirtualMachine> CreateVirtualMachineConfig(
7171
int? vCPUsAvailable = null,
7272
int? vCPUsPerCore = null,
7373
string imageReferenceId = null,
74-
Dictionary<string, List<string>> auxAuthHeader = null
74+
Dictionary<string, List<string>> auxAuthHeader = null,
75+
string diskControllerType = null
7576
)
7677

7778
=> Strategy.CreateResourceConfig(
@@ -115,7 +116,8 @@ public static ResourceConfig<VirtualMachine> CreateVirtualMachineConfig(
115116
Id = imageReferenceId
116117
},
117118
DataDisks = DataDiskStrategy.CreateDataDisks(
118-
imageAndOsType?.DataDiskLuns, dataDisks, dataDiskDeleteOption)
119+
imageAndOsType?.DataDiskLuns, dataDisks, dataDiskDeleteOption),
120+
DiskControllerType = diskControllerType
119121
},
120122
AvailabilitySet = engine.GetReference(availabilitySet),
121123
Zones = zones,

src/Compute/Compute/VirtualMachine/Config/NewAzureVMConfigCommand.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,12 @@ public class NewAzureVMConfigCommand : Microsoft.Azure.Commands.ResourceManager.
138138
[ResourceIdCompleter("Microsoft.Compute galleries/images/versions")]
139139
public string ImageReferenceId { get; set; }
140140

141+
[Parameter(
142+
Mandatory = false,
143+
HelpMessage = "Specifies the disk controller type configured for the VM and VirtualMachineScaleSet. This property is only supported for virtual machines whose operating system disk and VM sku supports Generation 2 (https://docs.microsoft.com/en-us/azure/virtual-machines/generation-2), please check the HyperVGenerations capability returned as part of VM sku capabilities in the response of Microsoft.Compute SKUs api for the region contains V2 (https://docs.microsoft.com/rest/api/compute/resourceskus/list) . <br> For more information about Disk Controller Types supported please refer to https://aka.ms/azure-diskcontrollertypes.")]
144+
[PSArgumentCompleter("SCSI", "NVMe")]
145+
public string DiskControllerType { get; set; }
146+
141147
protected override bool IsUsageMetricEnabled
142148
{
143149
get { return true; }
@@ -322,7 +328,16 @@ public override void ExecuteCmdlet()
322328
}
323329
vm.StorageProfile.ImageReference.Id = this.ImageReferenceId;
324330
}
325-
331+
332+
if (this.IsParameterBound(c => c.DiskControllerType))
333+
{
334+
if (vm.StorageProfile == null)
335+
{
336+
vm.StorageProfile = new StorageProfile();
337+
}
338+
vm.StorageProfile.DiskControllerType = this.DiskControllerType;
339+
}
340+
326341
if (this.IsParameterBound(c => c.PlatformFaultDomain))
327342
{
328343
vm.PlatformFaultDomain = this.PlatformFaultDomain;

src/Compute/Compute/VirtualMachine/Operation/NewAzureVMCommand.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,13 @@ public class NewAzureVMCommand : VirtualMachineBaseCmdlet
407407
HelpMessage = "This flag disables the default behavior to install the Guest Attestation extension to the virtual machine if: 1) SecurityType is TrustedLaunch, 2) SecureBootEnabled on the SecurityProfile is true, 3) VTpmEnabled on the SecurityProfile is true.")]
408408
public SwitchParameter DisableIntegrityMonitoring { get; set; }
409409

410+
[Parameter(
411+
Mandatory = false,
412+
ParameterSetName = SimpleParameterSet,
413+
HelpMessage = "Specifies the disk controller type configured for the VM and VirtualMachineScaleSet. This property is only supported for virtual machines whose operating system disk and VM sku supports Generation 2 (https://docs.microsoft.com/en-us/azure/virtual-machines/generation-2), please check the HyperVGenerations capability returned as part of VM sku capabilities in the response of Microsoft.Compute SKUs api for the region contains V2 (https://docs.microsoft.com/rest/api/compute/resourceskus/list) . <br> For more information about Disk Controller Types supported please refer to https://aka.ms/azure-diskcontrollertypes.")]
414+
[PSArgumentCompleter("SCSI", "NVMe")]
415+
public string DiskControllerType { get; set; }
416+
410417
public override void ExecuteCmdlet()
411418
{
412419
if (this.IsParameterBound(c => c.UserData))
@@ -635,7 +642,8 @@ public async Task<ResourceConfig<VirtualMachine>> CreateConfigAsync()
635642
vCPUsAvailable: _cmdlet.IsParameterBound(c => c.vCPUCountAvailable) ? _cmdlet.vCPUCountAvailable : (int?)null,
636643
vCPUsPerCore: _cmdlet.IsParameterBound(c => c.vCPUCountPerCore) ? _cmdlet.vCPUCountPerCore : (int?)null,
637644
imageReferenceId: _cmdlet.ImageReferenceId,
638-
auxAuthHeader: auxAuthHeader
645+
auxAuthHeader: auxAuthHeader,
646+
diskControllerType: _cmdlet.DiskControllerType
639647
);
640648
}
641649
else

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

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ New-AzVM [[-ResourceGroupName] <String>] [[-Location] <String>] [-EdgeZone <Stri
2626
[-Priority <String>] [-EvictionPolicy <String>] [-MaxPrice <Double>] [-EncryptionAtHost]
2727
[-HostGroupId <String>] [-SshKeyName <String>] [-GenerateSshKey] [-CapacityReservationGroupId <String>]
2828
[-UserData <String>] [-ImageReferenceId <String>] [-PlatformFaultDomain <Int32>] [-HibernationEnabled]
29-
[-vCPUCountAvailable <Int32>] [-vCPUCountPerCore <Int32>] [-DefaultProfile <IAzureContextContainer>] [-WhatIf]
30-
[-Confirm] [<CommonParameters>]
29+
[-vCPUCountAvailable <Int32>] [-vCPUCountPerCore <Int32>] [-DiskControllerType <String>]
30+
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
3131
```
3232

3333
### DefaultParameterSet
@@ -407,6 +407,8 @@ Linux: Username must only contain letters, numbers, hyphens, and underscores and
407407
**Password** <br>
408408
Must have 3 of the following: 1 lower case character, 1 upper case character, 1 number, and 1 special character. <br>
409409
The value must be between 12 and 123 characters long.
410+
411+
410412
```yaml
411413
Type: System.Management.Automation.PSCredential
412414
Parameter Sets: SimpleParameterSet
@@ -494,6 +496,21 @@ Accept pipeline input: True (ByPropertyName)
494496
Accept wildcard characters: False
495497
```
496498
499+
### -DiskControllerType
500+
Specifies the disk controller type configured for the VM and VirtualMachineScaleSet. This property is only supported for virtual machines whose operating system disk and VM sku supports Generation 2 (https://docs.microsoft.com/en-us/azure/virtual-machines/generation-2), please check the HyperVGenerations capability returned as part of VM sku capabilities in the response of Microsoft.Compute SKUs api for the region contains V2 (https://docs.microsoft.com/rest/api/compute/resourceskus/list) . <br> For more information about Disk Controller Types supported please refer to https://aka.ms/azure-diskcontrollertypes.
501+
502+
```yaml
503+
Type: System.String
504+
Parameter Sets: SimpleParameterSet
505+
Aliases:
506+
507+
Required: False
508+
Position: Named
509+
Default value: None
510+
Accept pipeline input: False
511+
Accept wildcard characters: False
512+
```
513+
497514
### -DiskFile
498515
The local path to the virtual hard disk file to be uploaded to the cloud and for creating the VM, and it must have '.vhd' as its suffix.
499516

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

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ Creates a configurable virtual machine object.
1818
New-AzVMConfig [-VMName] <String> [-VMSize] <String> [[-AvailabilitySetId] <String>] [[-LicenseType] <String>]
1919
[-Zone <String[]>] [-ProximityPlacementGroupId <String>] [-HostId <String>] [-VmssId <String>]
2020
[-MaxPrice <Double>] [-EvictionPolicy <String>] [-Priority <String>] [-Tags <Hashtable>] [-EnableUltraSSD]
21-
[-EncryptionAtHost] [-CapacityReservationGroupId <String>] [-ImageReferenceId <String>] [-UserData <String>]
22-
[-PlatformFaultDomain <Int32>] [-HibernationEnabled] [-vCPUCountAvailable <Int32>] [-vCPUCountPerCore <Int32>]
23-
[-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
21+
[-EncryptionAtHost] [-CapacityReservationGroupId <String>] [-ImageReferenceId <String>]
22+
[-DiskControllerType <String>] [-UserData <String>] [-PlatformFaultDomain <Int32>] [-HibernationEnabled]
23+
[-vCPUCountAvailable <Int32>] [-vCPUCountPerCore <Int32>] [-DefaultProfile <IAzureContextContainer>]
24+
[<CommonParameters>]
2425
```
2526

2627
### ExplicitIdentityParameterSet
@@ -29,9 +30,9 @@ New-AzVMConfig [-VMName] <String> [-VMSize] <String> [[-AvailabilitySetId] <Stri
2930
[-IdentityType] <ResourceIdentityType> [-IdentityId <String[]>] [-Zone <String[]>]
3031
[-ProximityPlacementGroupId <String>] [-HostId <String>] [-VmssId <String>] [-MaxPrice <Double>]
3132
[-EvictionPolicy <String>] [-Priority <String>] [-Tags <Hashtable>] [-EnableUltraSSD] [-EncryptionAtHost]
32-
[-CapacityReservationGroupId <String>] [-ImageReferenceId <String>] [-UserData <String>]
33-
[-PlatformFaultDomain <Int32>] [-HibernationEnabled] [-vCPUCountAvailable <Int32>] [-vCPUCountPerCore <Int32>]
34-
[-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
33+
[-CapacityReservationGroupId <String>] [-ImageReferenceId <String>] [-DiskControllerType <String>]
34+
[-UserData <String>] [-PlatformFaultDomain <Int32>] [-HibernationEnabled] [-vCPUCountAvailable <Int32>]
35+
[-vCPUCountPerCore <Int32>] [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
3536
```
3637

3738
## DESCRIPTION
@@ -113,6 +114,21 @@ Accept pipeline input: False
113114
Accept wildcard characters: False
114115
```
115116
117+
### -DiskControllerType
118+
Specifies the disk controller type configured for the VM and VirtualMachineScaleSet. This property is only supported for virtual machines whose operating system disk and VM sku supports Generation 2 (https://docs.microsoft.com/en-us/azure/virtual-machines/generation-2), please check the HyperVGenerations capability returned as part of VM sku capabilities in the response of Microsoft.Compute SKUs api for the region contains V2 (https://docs.microsoft.com/rest/api/compute/resourceskus/list) . <br> For more information about Disk Controller Types supported please refer to https://aka.ms/azure-diskcontrollertypes.
119+
120+
```yaml
121+
Type: System.String
122+
Parameter Sets: (All)
123+
Aliases:
124+
125+
Required: False
126+
Position: Named
127+
Default value: None
128+
Accept pipeline input: False
129+
Accept wildcard characters: False
130+
```
131+
116132
### -EnableUltraSSD
117133
Enables a capability to have one or more managed data disks with UltraSSD_LRS storage account type on the VM.
118134
Managed disks with storage account type UltraSSD_LRS can be added to a virtual machine only if this property is enabled.

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

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ New-AzVmss [[-ResourceGroupName] <String>] [-VMScaleSetName] <String> [-AsJob] [
3535
[-Priority <String>] [-EvictionPolicy <String>] [-MaxPrice <Double>] [-ScaleInPolicy <String[]>]
3636
[-SkipExtensionsOnOverprovisionedVMs] [-EncryptionAtHost] [-PlatformFaultDomainCount <Int32>]
3737
[-OrchestrationMode <String>] [-CapacityReservationGroupId <String>] [-ImageReferenceId <String>]
38-
[-DefaultProfile <IAzureContextContainer>] [-SinglePlacementGroup] [-WhatIf] [-Confirm] [<CommonParameters>]
38+
[-DiskControllerType <String>] [-DefaultProfile <IAzureContextContainer>] [-SinglePlacementGroup] [-WhatIf]
39+
[-Confirm] [<CommonParameters>]
3940
```
4041

4142
## DESCRIPTION
@@ -401,6 +402,21 @@ Accept pipeline input: True (ByPropertyName)
401402
Accept wildcard characters: False
402403
```
403404
405+
### -DiskControllerType
406+
Specifies the disk controller type configured for the VM and VirtualMachineScaleSet. This property is only supported for virtual machines whose operating system disk and VM sku supports Generation 2 (https://docs.microsoft.com/en-us/azure/virtual-machines/generation-2), please check the HyperVGenerations capability returned as part of VM sku capabilities in the response of Microsoft.Compute SKUs api for the region contains V2 (https://docs.microsoft.com/rest/api/compute/resourceskus/list) . <br> For more information about Disk Controller Types supported please refer to https://aka.ms/azure-diskcontrollertypes.
407+
408+
```yaml
409+
Type: System.String
410+
Parameter Sets: SimpleParameterSet
411+
Aliases:
412+
413+
Required: False
414+
Position: Named
415+
Default value: None
416+
Accept pipeline input: False
417+
Accept wildcard characters: False
418+
```
419+
404420
### -DomainNameLabel
405421
The domain name label for the public Fully-Qualified domain name (FQDN) for this Scale Set. This is the first component of the domain name that is automatically assigned to the Scale Set. Automatically assigned Domain names use the form (`<DomainNameLabel>.<Location>.cloudapp.azure.com`). If no value is supplied, the default domain name label will be the concatenation of `<ScaleSetName>` and `<ResourceGroupName>`.
406422

0 commit comments

Comments
 (0)