Merge pull request #8975 from jhawk28/vsphereiso_disksize_fix

disk_size should not be required if storage is defined
This commit is contained in:
Megan Marsh 2020-03-31 10:09:36 -07:00 committed by GitHub
commit fc911f0731
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions

View File

@ -70,8 +70,14 @@ type CreateConfig struct {
func (c *CreateConfig) Prepare() []error {
var errs []error
if c.DiskSize == 0 {
errs = append(errs, fmt.Errorf("'disk_size' is required"))
if len(c.Storage) > 0 {
for i, storage := range c.Storage {
if storage.DiskSize == 0 {
errs = append(errs, fmt.Errorf("storage[%d].'disk_size' is required", i))
}
}
} else if c.DiskSize == 0 {
errs = append(errs, fmt.Errorf("'disk_size' or 'storage' is required"))
}
if c.GuestOSType == "" {