give temp data disks lun suffix

This commit is contained in:
Paul Meyer 2020-04-29 22:11:16 +00:00
parent 4c96847683
commit aa8250bcc8
2 changed files with 4 additions and 7 deletions

View File

@ -84,8 +84,6 @@ func (s *StepCreateNewDiskset) Run(ctx context.Context, state multistep.StateBag
futures := []Future{{osDisk, f}}
if s.SourceImageResourceID != "" {
datadiskSuffix := 0 // initialize
// retrieve image to see if there are any datadisks
imageID, err := client.ParseResourceID(s.SourceImageResourceID)
if err != nil {
@ -108,8 +106,7 @@ func (s *StepCreateNewDiskset) Run(ctx context.Context, state multistep.StateBag
if ddi.Lun == nil {
return errorMessage("unexpected: lun is null for data disk # %d", i)
}
datadiskID, err := client.ParseResourceID(fmt.Sprintf("%s%d", s.DataDiskIDPrefix, datadiskSuffix))
datadiskSuffix++
datadiskID, err := client.ParseResourceID(fmt.Sprintf("%s%d", s.DataDiskIDPrefix, *ddi.Lun))
if err != nil {
return errorMessage("unable to construct resource id for datadisk: %v", err)
}

View File

@ -165,9 +165,9 @@ func TestStepCreateNewDisk_Run(t *testing.T) {
want: multistep.ActionContinue,
verifyDiskset: &Diskset{
-1: resource("/subscriptions/SubscriptionID/resourceGroups/ResourceGroupName/providers/Microsoft.Compute/disks/TemporaryOSDiskName"),
3: resource("/subscriptions/SubscriptionID/resourceGroups/ResourceGroupName/providers/Microsoft.Compute/disks/TemporaryDataDisk-2"),
5: resource("/subscriptions/SubscriptionID/resourceGroups/ResourceGroupName/providers/Microsoft.Compute/disks/TemporaryDataDisk-0"),
9: resource("/subscriptions/SubscriptionID/resourceGroups/ResourceGroupName/providers/Microsoft.Compute/disks/TemporaryDataDisk-1"),
3: resource("/subscriptions/SubscriptionID/resourceGroups/ResourceGroupName/providers/Microsoft.Compute/disks/TemporaryDataDisk-3"),
5: resource("/subscriptions/SubscriptionID/resourceGroups/ResourceGroupName/providers/Microsoft.Compute/disks/TemporaryDataDisk-5"),
9: resource("/subscriptions/SubscriptionID/resourceGroups/ResourceGroupName/providers/Microsoft.Compute/disks/TemporaryDataDisk-9"),
},
},
}