Skip to content

Commit

Permalink
Added clone_wait variable to configure wait time during cloning
Browse files Browse the repository at this point in the history
  • Loading branch information
AleRousse committed Sep 23, 2019
1 parent 23e407d commit 4914421
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions proxmox/resource_vm_qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,11 @@ func resourceVmQemu() *schema.Resource {
Optional: true,
Default: false,
},
"clone_wait": {
Type: schema.TypeInt,
Optional: true,
Default: 15,
},
"ci_wait": { // how long to wait before provision
Type: schema.TypeInt,
Optional: true,
Expand Down Expand Up @@ -491,7 +496,7 @@ func resourceVmQemuCreate(d *schema.ResourceData, meta interface{}) error {
}

// give sometime to proxmox to catchup
time.Sleep(5 * time.Second)
time.Sleep(time.Duration(d.Get("clone_wait").(int)) * time.Second)

err = prepareDiskSize(client, vmr, qemuDisks)
if err != nil {
Expand Down Expand Up @@ -532,7 +537,7 @@ func resourceVmQemuCreate(d *schema.ResourceData, meta interface{}) error {
d.SetId(resourceId(targetNode, "qemu", vmr.VmId()))

// give sometime to proxmox to catchup
time.Sleep(5 * time.Second)
time.Sleep(15 * time.Second)

log.Print("[DEBUG] starting VM")
_, err := client.StartVm(vmr)
Expand Down Expand Up @@ -622,7 +627,7 @@ func resourceVmQemuUpdate(d *schema.ResourceData, meta interface{}) error {
prepareDiskSize(client, vmr, qemuDisks)

// give sometime to proxmox to catchup
time.Sleep(5 * time.Second)
time.Sleep(15 * time.Second)

// Start VM only if it wasn't running.
vmState, err := client.GetVmState(vmr)
Expand Down

0 comments on commit 4914421

Please sign in to comment.