Skip to content

Commit b7d4410

Browse files
authored
Merge pull request #3990 from MSSedusch/preview
Set-AzureRmVMAEMExtension: Add caching information for Premium managed disks
2 parents 231a559 + 15db46b commit b7d4410

File tree

6 files changed

+469849
-2983
lines changed

6 files changed

+469849
-2983
lines changed

src/ResourceManager/Compute/ChangeLog.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- Additional information about change #1
1919
-->
2020
## Current Release
21+
* Updated Set-AzureRmVMAEMExtension: Add caching information for Premium managed disks
2122

2223
## Version 3.0.0
2324
* Updated Set-AzureRmVMAEMExtension and Test-AzureRmVMAEMExtension cmdlets to support Premium managed disks
@@ -93,4 +94,4 @@
9394
- VMScaleSet and ContainerService now have "ResourceGroupName" property, so when piping Get command to Delete/Update command, -ResourceGroupName is not required.
9495
* Separate paremater sets for Set-AzureRmVM with Generalized and Redeploy parameter
9596
* Reduce time taken by Get-AzureRmVMDiskEncryptionStatus cmdlet from two minutes to under five seconds
96-
* Allow Set-AzureRmVMDiskEncryptionStatus to be used with VHDs residing in multiple resource groups
97+
* Allow Set-AzureRmVMDiskEncryptionStatus to be used with VHDs residing in multiple resource groups

src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/AEMExtensionTests.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ function Test-AEMExtensionAdvancedWindowsMD
284284
Assert-AreEqual $extension.Name 'AzureCATExtensionHandler'
285285
$settings = $extension.PublicSettings | ConvertFrom-Json
286286
Assert-NotNull $settings.cfg
287+
Assert-True { ($extension.PublicSettings.Contains("osdisk.caching")) }
287288
Write-Verbose "Test-AEMExtensionAdvancedWindowsMD: Get done"
288289

289290
# Test command.

src/ResourceManager/Compute/Commands.Compute.Test/SessionRecords/Microsoft.Azure.Commands.Compute.Test.ScenarioTests.AEMExtensionTests/TestAEMExtensionAdvancedLinuxMD.json

Lines changed: 186319 additions & 1459 deletions
Large diffs are not rendered by default.

src/ResourceManager/Compute/Commands.Compute.Test/SessionRecords/Microsoft.Azure.Commands.Compute.Test.ScenarioTests.AEMExtensionTests/TestAEMExtensionAdvancedWindowsMD.json

Lines changed: 283489 additions & 1493 deletions
Large diffs are not rendered by default.

src/ResourceManager/Compute/Commands.Compute/Extension/AEM/AEMExtensionConstants.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public static class AEMExtensionConstants
4040

4141
public const string DISK_TYPE_STANDARD = "Standard";
4242
public const string DISK_TYPE_PREMIUM = "Premium";
43-
public const string DISK_TYPE_PREMIUM_MD = "PremiumMD";
43+
public const string DISK_TYPE_PREMIUM_MD = "Premium";
4444
public const string WadTableName = "WADPerformanceCountersTable";
4545
public const string AzureEndpoint = "core.windows.net";
4646
public const int ContentAgeInMinutes = 5;

src/ResourceManager/Compute/Commands.Compute/Extension/AEM/SetAzureRmVMAEMExtension.cs

Lines changed: 37 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,9 @@ public override void ExecuteCmdlet()
216216
{
217217
WriteVerbose("OS Disk Storage Account is a premium account - adding SLAs for OS disk");
218218
var sla = this._Helper.GetDiskSLA(osDiskMD.DiskSizeGB, null);
219+
var caching = osdisk.Caching;
220+
sapmonPublicConfig.Add(new KeyValuePair() { Key = "osdisk.name", Value = this._Helper.GetResourceNameFromId(osdisk.ManagedDisk.Id) });
221+
sapmonPublicConfig.Add(new KeyValuePair() { Key = "osdisk.caching", Value = caching });
219222
sapmonPublicConfig.Add(new KeyValuePair() { Key = "osdisk.type", Value = AEMExtensionConstants.DISK_TYPE_PREMIUM_MD });
220223
sapmonPublicConfig.Add(new KeyValuePair() { Key = "osdisk.sla.throughput", Value = sla.TP });
221224
sapmonPublicConfig.Add(new KeyValuePair() { Key = "osdisk.sla.iops", Value = sla.IOPS });
@@ -239,6 +242,10 @@ public override void ExecuteCmdlet()
239242
{
240243
this._Helper.WriteVerbose("Data Disk {0} is a Premium Managed Disk - adding SLAs for disk", diskNumber.ToString());
241244
var sla = this._Helper.GetDiskSLA(diskMD.DiskSizeGB, null);
245+
var cachingMD = disk.Caching;
246+
sapmonPublicConfig.Add(new KeyValuePair() { Key = "disk.lun." + diskNumber, Value = disk.Lun });
247+
sapmonPublicConfig.Add(new KeyValuePair() { Key = "disk.name." + diskNumber, Value = this._Helper.GetResourceNameFromId(disk.ManagedDisk.Id) });
248+
sapmonPublicConfig.Add(new KeyValuePair() { Key = "disk.caching." + diskNumber, Value = cachingMD });
242249
sapmonPublicConfig.Add(new KeyValuePair() { Key = "disk.type." + diskNumber, Value = AEMExtensionConstants.DISK_TYPE_PREMIUM_MD });
243250
sapmonPublicConfig.Add(new KeyValuePair() { Key = "disk.sla.throughput." + diskNumber, Value = sla.TP });
244251
sapmonPublicConfig.Add(new KeyValuePair() { Key = "disk.sla.iops." + diskNumber, Value = sla.IOPS });
@@ -247,42 +254,43 @@ public override void ExecuteCmdlet()
247254
else
248255
{
249256
this._Helper.WriteWarning("[WARN] Standard Managed Disks are not supported. Extension will be installed but no disk metrics will be available.");
250-
257+
251258
}
252-
continue;
253259
}
254-
255-
var accountName = this._Helper.GetStorageAccountFromUri(disk.Vhd.Uri);
256-
if (!accounts.ContainsKey(accountName))
260+
else
257261
{
258-
var storageKey = this._Helper.GetAzureStorageKeyFromCache(accountName);
259-
accounts.Add(accountName, storageKey);
260-
}
261262

262-
this._Helper.WriteHost("[INFO] Adding configuration for data disk {0}", disk.Name);
263-
var caching = disk.Caching;
264-
sapmonPublicConfig.Add(new KeyValuePair() { Key = "disk.lun." + diskNumber, Value = disk.Lun });
265-
sapmonPublicConfig.Add(new KeyValuePair() { Key = "disk.name." + diskNumber, Value = this._Helper.GetDiskName(disk.Vhd.Uri) });
266-
sapmonPublicConfig.Add(new KeyValuePair() { Key = "disk.caching." + diskNumber, Value = caching });
267-
sapmonPublicConfig.Add(new KeyValuePair() { Key = "disk.account." + diskNumber, Value = accountName });
263+
var accountName = this._Helper.GetStorageAccountFromUri(disk.Vhd.Uri);
264+
if (!accounts.ContainsKey(accountName))
265+
{
266+
var storageKey = this._Helper.GetAzureStorageKeyFromCache(accountName);
267+
accounts.Add(accountName, storageKey);
268+
}
268269

269-
if (this._Helper.IsPremiumStorageAccount(accountName))
270-
{
271-
this._Helper.WriteVerbose("Data Disk {0} Storage Account is a premium account - adding SLAs for disk", diskNumber.ToString());
272-
var sla = this._Helper.GetDiskSLA(disk);
273-
sapmonPublicConfig.Add(new KeyValuePair() { Key = "disk.type." + diskNumber, Value = AEMExtensionConstants.DISK_TYPE_PREMIUM });
274-
sapmonPublicConfig.Add(new KeyValuePair() { Key = "disk.sla.throughput." + diskNumber, Value = sla.TP });
275-
sapmonPublicConfig.Add(new KeyValuePair() { Key = "disk.sla.iops." + diskNumber, Value = sla.IOPS });
276-
this._Helper.WriteVerbose("Done - Data Disk {0} Storage Account is a premium account - adding SLAs for disk", diskNumber.ToString());
270+
this._Helper.WriteHost("[INFO] Adding configuration for data disk {0}", disk.Name);
271+
var caching = disk.Caching;
272+
sapmonPublicConfig.Add(new KeyValuePair() { Key = "disk.lun." + diskNumber, Value = disk.Lun });
273+
sapmonPublicConfig.Add(new KeyValuePair() { Key = "disk.name." + diskNumber, Value = this._Helper.GetDiskName(disk.Vhd.Uri) });
274+
sapmonPublicConfig.Add(new KeyValuePair() { Key = "disk.caching." + diskNumber, Value = caching });
275+
sapmonPublicConfig.Add(new KeyValuePair() { Key = "disk.account." + diskNumber, Value = accountName });
277276

278-
}
279-
else
280-
{
281-
sapmonPublicConfig.Add(new KeyValuePair() { Key = "disk.type." + diskNumber, Value = AEMExtensionConstants.DISK_TYPE_STANDARD });
282-
sapmonPublicConfig.Add(new KeyValuePair() { Key = "disk.connminute." + diskNumber, Value = (accountName + ".minute") });
283-
sapmonPublicConfig.Add(new KeyValuePair() { Key = "disk.connhour." + diskNumber, Value = (accountName + ".hour") });
284-
}
277+
if (this._Helper.IsPremiumStorageAccount(accountName))
278+
{
279+
this._Helper.WriteVerbose("Data Disk {0} Storage Account is a premium account - adding SLAs for disk", diskNumber.ToString());
280+
var sla = this._Helper.GetDiskSLA(disk);
281+
sapmonPublicConfig.Add(new KeyValuePair() { Key = "disk.type." + diskNumber, Value = AEMExtensionConstants.DISK_TYPE_PREMIUM });
282+
sapmonPublicConfig.Add(new KeyValuePair() { Key = "disk.sla.throughput." + diskNumber, Value = sla.TP });
283+
sapmonPublicConfig.Add(new KeyValuePair() { Key = "disk.sla.iops." + diskNumber, Value = sla.IOPS });
284+
this._Helper.WriteVerbose("Done - Data Disk {0} Storage Account is a premium account - adding SLAs for disk", diskNumber.ToString());
285285

286+
}
287+
else
288+
{
289+
sapmonPublicConfig.Add(new KeyValuePair() { Key = "disk.type." + diskNumber, Value = AEMExtensionConstants.DISK_TYPE_STANDARD });
290+
sapmonPublicConfig.Add(new KeyValuePair() { Key = "disk.connminute." + diskNumber, Value = (accountName + ".minute") });
291+
sapmonPublicConfig.Add(new KeyValuePair() { Key = "disk.connhour." + diskNumber, Value = (accountName + ".hour") });
292+
}
293+
}
286294
diskNumber += 1;
287295
}
288296

0 commit comments

Comments
 (0)