-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New-AzureRmVM/VMSS: DataDiskSizeInGb parameter #5734
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
5cb1f6b
Data Disks
sergey-shandar 64fb01c
Include a number of disks into image and OS type.
sergey-shandar 7b926b2
Merge
sergey-shandar 6d6a9f9
New-AzureRmVm support for data disks.
sergey-shandar 4d0ad51
Merge branch 'sergey-vmss-custom-image'
sergey-shandar 54f858c
ImageDataDisks
sergey-shandar 15cd9c2
Merge
sergey-shandar 77daf6d
merge
sergey-shandar 01301e2
DataDisk should be null if there are no additional images.
sergey-shandar 70d7ba6
minor.
sergey-shandar a834c4b
Merge.
sergey-shandar 5cdfb6b
DataDiskSizeGb => DataDiskSizeInGb
sergey-shandar ae9a4bb
Merge branch 'preview'
sergey-shandar cf90b17
revert unsignificant changes.
sergey-shandar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
src/ResourceManager/Compute/Commands.Compute/Strategies/ComputeRp/DataDiskStrategy.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| using Microsoft.Azure.Commands.Common.Strategies; | ||
| using Microsoft.Azure.Management.Compute.Models; | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Linq; | ||
|
|
||
| namespace Microsoft.Azure.Commands.Compute.Strategies.ComputeRp | ||
| { | ||
| static class DataDiskStrategy | ||
| { | ||
| static IList<T> CreateDataDisks<T>( | ||
| IEnumerable<int> imageDataDiskLuns, | ||
| IEnumerable<int> dataDiskSizes, | ||
| Func<DiskCreateOptionTypes, int, int?, T> createDataDisk) | ||
| { | ||
| if (dataDiskSizes == null) | ||
| { | ||
| return null; | ||
| } | ||
| imageDataDiskLuns = imageDataDiskLuns.EmptyIfNull(); | ||
| var firstLun = imageDataDiskLuns | ||
| .Select(v => v + 1) | ||
| .Concat(new[] { 0 }) | ||
| .Max(); | ||
| return imageDataDiskLuns | ||
| .Select(lun => createDataDisk(DiskCreateOptionTypes.FromImage, lun, null)) | ||
| .Concat(dataDiskSizes.Select((size, i) => createDataDisk( | ||
| DiskCreateOptionTypes.Empty, | ||
| i + firstLun, | ||
| size))) | ||
| .ToList(); | ||
| } | ||
|
|
||
| public static IList<DataDisk> CreateDataDisks( | ||
| IEnumerable<int> imageDataDiskLuns, | ||
| IEnumerable<int> dataDiskSizes) | ||
| => CreateDataDisks( | ||
| imageDataDiskLuns, | ||
| dataDiskSizes, | ||
| (createOption, lun, size) => new DataDisk | ||
| { | ||
| CreateOption = createOption, | ||
| Lun = lun, | ||
| DiskSizeGB = size, | ||
| }); | ||
|
|
||
| public static IList<VirtualMachineScaleSetDataDisk> CreateVmssDataDisks( | ||
| IEnumerable<int> dataDisks, | ||
| IEnumerable<int> dataDiskSizes) | ||
| => CreateDataDisks( | ||
| dataDisks, | ||
| dataDiskSizes, | ||
| (createOption, lun, size) => new VirtualMachineScaleSetDataDisk | ||
| { | ||
| CreateOption = createOption, | ||
| Lun = lun, | ||
| DiskSizeGB = size, | ||
| }); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/ResourceManager/Compute/Commands.Compute/Strategies/ComputeRp/ImageDataDiskStrategy.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| using Microsoft.Azure.Management.Compute.Models; | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Linq; | ||
|
|
||
| namespace Microsoft.Azure.Commands.Compute.Strategies.ComputeRp | ||
| { | ||
| static class ImageDataDiskStrategy | ||
| { | ||
| static IList<int> GetLuns<T>(this IEnumerable<T> imageDataDisks, Func<T, int?> getLun) | ||
| => imageDataDisks.Select(idd => getLun(idd) ?? 0).ToList(); | ||
|
|
||
| public static IList<int> GetLuns(this IEnumerable<ImageDataDisk> imageDataDisks) | ||
| => imageDataDisks.GetLuns(idd => idd.Lun); | ||
|
|
||
| public static IList<int> GetLuns(this IEnumerable<DataDiskImage> imageDataDisks) | ||
| => imageDataDisks.GetLuns(idd => idd.Lun); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
src/ResourceManager/Compute/Commands.Compute/Strategies/StrategyCmdlet.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice