File tree Expand file tree Collapse file tree 1 file changed +14
-9
lines changed
vsphere/internal/helper/storagepod Expand file tree Collapse file tree 1 file changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -480,28 +480,33 @@ func virtualDiskFromDeviceConfigSpecForPlacement(spec types.BaseVirtualDeviceCon
480
480
}
481
481
482
482
func expandVMPodConfigForPlacement (dc []types.BaseVirtualDeviceConfigSpec , pod * object.StoragePod ) []types.VmPodConfigForPlacement {
483
- var initialVMConfig []types.VmPodConfigForPlacement
483
+ var diskLocators []types.PodDiskLocator
484
484
485
485
for _ , deviceConfigSpec := range dc {
486
486
d , ok := virtualDiskFromDeviceConfigSpecForPlacement (deviceConfigSpec )
487
487
if ! ok {
488
488
continue
489
489
}
490
490
491
+ diskLocator := types.PodDiskLocator {
492
+ DiskId : d .Key ,
493
+ DiskBackingInfo : d .Backing ,
494
+ }
495
+
496
+ diskLocators = append (diskLocators , diskLocator )
497
+ }
498
+
499
+ // Only create a config if we have disks to place
500
+ if len (diskLocators ) > 0 {
491
501
podConfigForPlacement := types.VmPodConfigForPlacement {
492
502
StoragePod : pod .Reference (),
493
- Disk : []types.PodDiskLocator {
494
- {
495
- DiskId : d .Key ,
496
- DiskBackingInfo : d .Backing ,
497
- },
498
- },
503
+ Disk : diskLocators ,
499
504
}
500
505
501
- initialVMConfig = append ( initialVMConfig , podConfigForPlacement )
506
+ return []types. VmPodConfigForPlacement { podConfigForPlacement }
502
507
}
503
508
504
- return initialVMConfig
509
+ return nil
505
510
}
506
511
507
512
// IsMember checks to see if a datastore is a member of the datastore cluster
You can’t perform that action at this time.
0 commit comments