Skip to content
Draft
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
7 changes: 7 additions & 0 deletions src/Compute/Compute.Test/ScenarioTests/DiskRPTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,5 +219,12 @@ public void TestDiskSupportedSecurityOption()
{
TestRunner.RunTestScript("Test-SupportedSecurityOption");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestDiskAvailabilityPolicy()
{
TestRunner.RunTestScript("Test-DiskAvailabilityPolicy");
}
}
}
58 changes: 58 additions & 0 deletions src/Compute/Compute.Test/ScenarioTests/DiskRPTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1983,3 +1983,61 @@ function Test-SupportedSecurityOption
Clean-ResourceGroup $rgname
}
}

<#
.SYNOPSIS
Testing disk availability policy
#>
function Test-DiskAvailabilityPolicy
{
# Setup
$rgname = Get-ComputeTestResourceName;
$diskname = 'disk' + $rgname;

try
{
# Common
$loc = Get-ComputeVMLocation;
New-AzResourceGroup -Name $rgname -Location $loc -Force;

# Test disk config with AvailabilityPolicy set to None
$diskconfig = New-AzDiskConfig -Location $loc -DiskSizeGB 5 -SkuName Standard_LRS -OsType Windows -CreateOption Empty -ActionOnDiskDelay 'None';
Assert-NotNull $diskconfig.AvailabilityPolicy;
Assert-AreEqual 'None' $diskconfig.AvailabilityPolicy.ActionOnDiskDelay;

# Create disk with AvailabilityPolicy
$job = New-AzDisk -ResourceGroupName $rgname -DiskName $diskname -Disk $diskconfig -AsJob;
$result = $job | Wait-Job;
Assert-AreEqual "Completed" $result.State;

# Get disk and verify AvailabilityPolicy
$disk = Get-AzDisk -ResourceGroupName $rgname -DiskName $diskname;
Assert-NotNull $disk.AvailabilityPolicy;
Assert-AreEqual 'None' $disk.AvailabilityPolicy.ActionOnDiskDelay;

# Test update config with AvailabilityPolicy set to AutomaticReattach
$updateconfig = New-AzDiskUpdateConfig -ActionOnDiskDelay 'AutomaticReattach';
Assert-NotNull $updateconfig.AvailabilityPolicy;
Assert-AreEqual 'AutomaticReattach' $updateconfig.AvailabilityPolicy.ActionOnDiskDelay;

# Update disk with new AvailabilityPolicy
$job = Update-AzDisk -ResourceGroupName $rgname -DiskName $diskname -Disk $updateconfig -AsJob;
$result = $job | Wait-Job;
Assert-AreEqual "Completed" $result.State;

# Verify the update
$disk = Get-AzDisk -ResourceGroupName $rgname -DiskName $diskname;
Assert-NotNull $disk.AvailabilityPolicy;
Assert-AreEqual 'AutomaticReattach' $disk.AvailabilityPolicy.ActionOnDiskDelay;

# Cleanup
Remove-AzDisk -ResourceGroupName $rgname -DiskName $diskname -Force;
Clean-ResourceGroup $rgname
}
finally
{
# Cleanup
Clean-ResourceGroup $rgname
}
}

4 changes: 4 additions & 0 deletions src/Compute/Compute/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
* Updated Azure.Core from 1.45.0 to 1.47.3
* Added `-EnableAutomaticUpgrade` and `-TreatFailureAsDeploymentFailure` parameters (Bool) to `New-AzVmGalleryApplication` and `New-AzVmssGalleryApplication` cmdlets.
* Added `-EnableAutomaticUpgrade` and `-TreatFailureAsDeploymentFailure` parameters (Switch) to `Add-AzVmGalleryApplication` and `Add-AzVmssGalleryApplication` cmdlets.
* Added support for Disk Availability Policy
- Added `ActionOnDiskDelay` parameter to `New-AzDiskConfig` cmdlet to configure disk availability behavior
- Added `ActionOnDiskDelay` parameter to `New-AzDiskUpdateConfig` cmdlet to update disk availability behavior
- Users can now specify how VMs handle disks with slow I/O using values 'None' or 'AutomaticReattach'

## Version 10.5.0
* Added `-Redeploy` switch parameter for `Update-AzHost` cmdlet to enable dedicated host redeployment.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,13 @@ public partial class NewAzureRmDiskConfigCommand : Microsoft.Azure.Commands.Reso
HelpMessage = "Setting this property to true improves reliability and performance of data disks that are frequently (more than 5 times a day) by detached from one virtual machine and attached to another. This property should not be set for disks that are not detached and attached frequently as it causes the disks to not align with the fault domain of the virtual machine.")]
public bool? OptimizedForFrequentAttach { get; set; }

[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true,
HelpMessage = "Determines on how to handle disks with slow I/O. Possible values include: 'None', 'AutomaticReattach'. None is the default behavior where the VM restarts upon slow disk I/O. AutomaticReattach will attempt to detach and reattach the disk upon I/O failure or slow response.")]
[PSArgumentCompleter("None", "AutomaticReattach")]
public string ActionOnDiskDelay { get; set; }

[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true,
Expand Down Expand Up @@ -534,7 +541,8 @@ private void Run()
SupportedCapabilities = vSupportedCapabilities,
PublicNetworkAccess = this.IsParameterBound(c => c.PublicNetworkAccess) ? PublicNetworkAccess : null,
DataAccessAuthMode = this.IsParameterBound(c => c.DataAccessAuthMode) ? DataAccessAuthMode : null,
OptimizedForFrequentAttach = this.IsParameterBound(c => c.OptimizedForFrequentAttach) ? OptimizedForFrequentAttach : null
OptimizedForFrequentAttach = this.IsParameterBound(c => c.OptimizedForFrequentAttach) ? OptimizedForFrequentAttach : null,
AvailabilityPolicy = this.IsParameterBound(c => c.ActionOnDiskDelay) ? new AvailabilityPolicy { ActionOnDiskDelay = ActionOnDiskDelay } : null
};

WriteObject(vDisk);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,13 @@ public partial class NewAzureRmDiskUpdateConfigCommand : Microsoft.Azure.Command
[PSArgumentCompleter("AzureActiveDirectory", "None")]
public string DataAccessAuthMode { get; set; }

[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true,
HelpMessage = "Determines on how to handle disks with slow I/O. Possible values include: 'None', 'AutomaticReattach'. None is the default behavior where the VM restarts upon slow disk I/O. AutomaticReattach will attempt to detach and reattach the disk upon I/O failure or slow response.")]
[PSArgumentCompleter("None", "AutomaticReattach")]
public string ActionOnDiskDelay { get; set; }

[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true,
Expand Down Expand Up @@ -337,7 +344,8 @@ private void Run()
SupportsHibernation = this.IsParameterBound(c => c.SupportsHibernation) ? SupportsHibernation : null,
SupportedCapabilities = vSupportedCapabilities,
PublicNetworkAccess = this.IsParameterBound(c => c.PublicNetworkAccess) ? PublicNetworkAccess : null,
DataAccessAuthMode = this.IsParameterBound(c => c.DataAccessAuthMode) ? DataAccessAuthMode : null
DataAccessAuthMode = this.IsParameterBound(c => c.DataAccessAuthMode) ? DataAccessAuthMode : null,
AvailabilityPolicy = this.IsParameterBound(c => c.ActionOnDiskDelay) ? new AvailabilityPolicy { ActionOnDiskDelay = ActionOnDiskDelay } : null
};

WriteObject(vDiskUpdate);
Expand Down
1 change: 1 addition & 0 deletions src/Compute/Compute/Generated/Models/PSDisk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public string ResourceGroupName
public string DataAccessAuthMode { get; set; }
public double? CompletionPercent { get; set; }
public bool? OptimizedForFrequentAttach { get; set; }
public AvailabilityPolicy AvailabilityPolicy { get; set; }
public string SecurityDataUri { get; set; }
public string SecurityMetadataUri { get; set; }
}
Expand Down
1 change: 1 addition & 0 deletions src/Compute/Compute/Generated/Models/PSDiskUpdate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,6 @@ public partial class PSDiskUpdate
// Gets or sets possible values include: 'Enabled', 'Disabled'
public string PublicNetworkAccess { get; set; }
public string DataAccessAuthMode { get; set; }
public AvailabilityPolicy AvailabilityPolicy { get; set; }
}
}