disk_size should not be required if storage is defined
This commit is contained in:
parent
45da4c8ee7
commit
cf3c448d17
|
@ -70,8 +70,14 @@ type CreateConfig struct {
|
||||||
func (c *CreateConfig) Prepare() []error {
|
func (c *CreateConfig) Prepare() []error {
|
||||||
var errs []error
|
var errs []error
|
||||||
|
|
||||||
if c.DiskSize == 0 {
|
if len(c.Storage) > 0 {
|
||||||
errs = append(errs, fmt.Errorf("'disk_size' is required"))
|
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 == "" {
|
if c.GuestOSType == "" {
|
||||||
|
|
Loading…
Reference in New Issue