mirror of
https://github.com/letic/terraform-provider-proxmox.git
synced 2024-07-06 01:22:39 +00:00
Merge pull request #91 from AleRousse/fix/clone_timeout#90
Added clone_wait variable to configure wait time during cloning
This commit is contained in:
commit
1c90e79148
|
@ -349,6 +349,11 @@ func resourceVmQemu() *schema.Resource {
|
||||||
Optional: true,
|
Optional: true,
|
||||||
Default: false,
|
Default: false,
|
||||||
},
|
},
|
||||||
|
"clone_wait": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Optional: true,
|
||||||
|
Default: 15,
|
||||||
|
},
|
||||||
"ci_wait": { // how long to wait before provision
|
"ci_wait": { // how long to wait before provision
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
|
@ -524,7 +529,7 @@ func resourceVmQemuCreate(d *schema.ResourceData, meta interface{}) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// give sometime to proxmox to catchup
|
// 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)
|
err = prepareDiskSize(client, vmr, qemuDisks)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -567,7 +572,7 @@ func resourceVmQemuCreate(d *schema.ResourceData, meta interface{}) error {
|
||||||
d.SetId(resourceId(targetNode, "qemu", vmr.VmId()))
|
d.SetId(resourceId(targetNode, "qemu", vmr.VmId()))
|
||||||
|
|
||||||
// give sometime to proxmox to catchup
|
// give sometime to proxmox to catchup
|
||||||
time.Sleep(5 * time.Second)
|
time.Sleep(15 * time.Second)
|
||||||
|
|
||||||
log.Print("[DEBUG] starting VM")
|
log.Print("[DEBUG] starting VM")
|
||||||
_, err := client.StartVm(vmr)
|
_, err := client.StartVm(vmr)
|
||||||
|
@ -660,7 +665,7 @@ func resourceVmQemuUpdate(d *schema.ResourceData, meta interface{}) error {
|
||||||
prepareDiskSize(client, vmr, qemuDisks)
|
prepareDiskSize(client, vmr, qemuDisks)
|
||||||
|
|
||||||
// give sometime to proxmox to catchup
|
// give sometime to proxmox to catchup
|
||||||
time.Sleep(5 * time.Second)
|
time.Sleep(15 * time.Second)
|
||||||
|
|
||||||
// Start VM only if it wasn't running.
|
// Start VM only if it wasn't running.
|
||||||
vmState, err := client.GetVmState(vmr)
|
vmState, err := client.GetVmState(vmr)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user