Merge pull request #9940 from hashicorp/fix_9936

skip slot 7 in disk creation so we don't use reserved slot
This commit is contained in:
Megan Marsh 2020-09-14 13:36:16 -07:00 committed by GitHub
commit f28cabb162
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

@ -45,8 +45,13 @@ func (s *StepCreateDisks) Run(ctx context.Context, state multistep.StateBag) mul
}
// Additional disks
if len(s.AdditionalDiskSize) > 0 {
incrementer := 1
for i, diskSize := range s.AdditionalDiskSize {
path := filepath.Join(*s.OutputDir, fmt.Sprintf("%s-%d.vmdk", s.DiskName, i+1))
// scsi slot 7 is reserved, so we skip it.
if i+incrementer == 7 {
incrementer = 2
}
path := filepath.Join(*s.OutputDir, fmt.Sprintf("%s-%d.vmdk", s.DiskName, i+incrementer))
diskFullPaths = append(diskFullPaths, path)
size := fmt.Sprintf("%dM", uint64(diskSize))
diskSizes = append(diskSizes, size)

View File

@ -107,9 +107,14 @@ func (s *stepCreateVMX) Run(ctx context.Context, state multistep.StateBag) multi
// Mount extra vmdks we created earlier.
if len(config.AdditionalDiskSize) > 0 {
incrementer := 1
for i := range config.AdditionalDiskSize {
// slot 7 is special and reserved, so we need to skip that index.
if i+1 == 7 {
incrementer = 2
}
ictx.Data = &additionalDiskTemplateData{
DiskNumber: i + 1,
DiskNumber: i + incrementer,
DiskName: config.DiskName,
}