Skip to content

Commit 163e96c

Browse files
authored
Merge pull request #2931 from krkhan/disable_enc_fix
UpdateVmEncryptionSettings() needs to be called for VolumeType=Data on Linux VMs
2 parents 2eaf617 + d6762ea commit 163e96c

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

src/ResourceManager/Compute/Commands.Compute/Extension/AzureDiskEncryption/DisableAzureDiskEncryption.cs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -257,17 +257,27 @@ public override void ExecuteCmdlet()
257257
this.Name,
258258
parameters).GetAwaiter().GetResult();
259259

260-
if (string.IsNullOrWhiteSpace(VolumeType) ||
261-
VolumeType.Equals(AzureDiskEncryptionExtensionContext.VolumeTypeAll, StringComparison.InvariantCultureIgnoreCase) ||
262-
VolumeType.Equals(AzureDiskEncryptionExtensionContext.VolumeTypeOS, StringComparison.InvariantCultureIgnoreCase))
260+
// +---------+---------------+----------------------------+
261+
// | OSType | VolumeType | UpdateVmEncryptionSettings |
262+
// +---------+---------------+----------------------------+
263+
// | Windows | OS | Yes |
264+
// | Windows | Data | No |
265+
// | Windows | Not Specified | Yes |
266+
// | Linux | OS | N/A |
267+
// | Linux | Data | Yes |
268+
// | Linux | Not Specified | N/A |
269+
// +---------+---------------+----------------------------+
270+
271+
if (OperatingSystemTypes.Windows.Equals(currentOSType) &&
272+
VolumeType.Equals(AzureDiskEncryptionExtensionContext.VolumeTypeData, StringComparison.InvariantCultureIgnoreCase))
263273
{
264-
var opVm = UpdateVmEncryptionSettings();
265-
var result = Mapper.Map<PSAzureOperationResponse>(opVm);
274+
var result = Mapper.Map<PSAzureOperationResponse>(opExt);
266275
WriteObject(result);
267276
}
268277
else
269278
{
270-
var result = Mapper.Map<PSAzureOperationResponse>(opExt);
279+
var opVm = UpdateVmEncryptionSettings();
280+
var result = Mapper.Map<PSAzureOperationResponse>(opVm);
271281
WriteObject(result);
272282
}
273283
}

src/ResourceManager/Compute/Commands.Compute/Models/AzureDiskEncryptionStatusContext.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ enum EncryptionStatus
2222
Encrypted,
2323
NotEncrypted,
2424
NotMounted,
25+
DecryptionInProgress,
2526
EncryptionInProgress,
2627
VMRestartPending,
2728
Unknown

0 commit comments

Comments
 (0)