Create and attach additional disks before bootup.
Additional disks weren't created and attached to cloned vms until after bootup. I also fixed some typos.
This commit is contained in:
parent
c95667ce99
commit
aa97300a3b
|
@ -763,7 +763,7 @@ func findDatastore(c *govmomi.Client, sps types.StoragePlacementSpec) (*object.D
|
|||
return datastore, nil
|
||||
}
|
||||
|
||||
// createVirtualMchine creates a new VirtualMachine.
|
||||
// createVirtualMachine creates a new VirtualMachine.
|
||||
func (vm *virtualMachine) createVirtualMachine(c *govmomi.Client) error {
|
||||
dc, err := getDatacenter(c, vm.datacenter)
|
||||
if err != nil {
|
||||
|
@ -914,7 +914,7 @@ func (vm *virtualMachine) createVirtualMachine(c *govmomi.Client) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// deployVirtualMchine deploys a new VirtualMachine.
|
||||
// deployVirtualMachine deploys a new VirtualMachine.
|
||||
func (vm *virtualMachine) deployVirtualMachine(c *govmomi.Client) error {
|
||||
dc, err := getDatacenter(c, vm.datacenter)
|
||||
if err != nil {
|
||||
|
@ -1135,6 +1135,14 @@ func (vm *virtualMachine) deployVirtualMachine(c *govmomi.Client) error {
|
|||
}
|
||||
log.Printf("[DEBUG]VM customization finished")
|
||||
|
||||
for i := 1; i < len(vm.hardDisks); i++ {
|
||||
err = addHardDisk(newVM, vm.hardDisks[i].size, vm.hardDisks[i].iops, "eager_zeroed")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
log.Printf("[DEBUG] virtual machine config spec: %v", configSpec)
|
||||
|
||||
newVM.PowerOn(context.TODO())
|
||||
|
||||
ip, err := newVM.WaitForIP(context.TODO())
|
||||
|
@ -1143,12 +1151,5 @@ func (vm *virtualMachine) deployVirtualMachine(c *govmomi.Client) error {
|
|||
}
|
||||
log.Printf("[DEBUG] ip address: %v", ip)
|
||||
|
||||
for i := 1; i < len(vm.hardDisks); i++ {
|
||||
err = addHardDisk(newVM, vm.hardDisks[i].size, vm.hardDisks[i].iops, "eager_zeroed")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
log.Printf("[DEBUG] virtual machine config spec: %v", configSpec)
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue