Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Custom APITimeout seems not working fine #1401

Closed
Panplumousse opened this issue May 4, 2021 · 1 comment · Fixed by #1405
Closed

Custom APITimeout seems not working fine #1401

Panplumousse opened this issue May 4, 2021 · 1 comment · Fixed by #1405
Labels
bug Type: Bug

Comments

@Panplumousse
Copy link

Terraform Version

0.11.11

vSphere Provider Version

1.25.0

Affected Resource(s)

  • vsphere_virtual_machine creation with additional large disk (more than 400GB)

Terraform template creation

provider "vsphere" {
allow_unverified_ssl = true
api_timeout = 60
}
....

clone {
template_uuid = "${data.vsphere_virtual_machine.template.id}"
timeout = "90"
customize {
windows_options {
computer_name = "${var.vm_name}"
full_name = "xxxr"
admin_password = "xxxx"
time_zone = "105"
}
timeout = "90"
}

Debug Output

error output:
error reconfiguring virtual machine: Post https://xxx/sdk: context deadline exceeded
Additionally, there was an error removing the cloned virtual machine:
error destroying virtual machine: Post https://xxx: context deadline exceeded

Expected Behavior

We specify api_timeout: "60" in vphere provider block
Creation vm completed with reconfigure exced five minutes

Actual Behavior

When we build a vm with the vpshere provider with a large disk like 1TB.
the reconfiguration of the
vm takes a long time and after 5 minutes the vms is deleted by vsphere

Test we maked

we had make modification in provider en rebuild it to update provider.defaultapitimeout with 10 minutes instead of 5 minutes and it is working fine.
in file > virtual_machine_helper.go
Before update :

func Reconfigure(vm *object.VirtualMachine, spec types.VirtualMachineConfigSpec) error {
    log.Printf("[DEBUG] Reconfiguring virtual machine %q", vm.InventoryPath)
    ctx, cancel := context.WithTimeout(context.Background(), provider.DefaultAPITimeout)
    defer cancel()
    task, err := vm.Reconfigure(ctx, spec)
    if err != nil {
    return err
    }
    tctx, tcancel := context.WithTimeout(context.Background(), provider.DefaultAPITimeout)
    defer tcancel()
    return task.Wait(tctx)
}

After update :

func Reconfigure(vm *object.VirtualMachine, spec types.VirtualMachineConfigSpec) error {
    log.Printf("[DEBUG] Reconfiguring virtual machine %q", vm.InventoryPath)
    ctx, cancel := context.WithTimeout(context.Background(), 10 * time.Minute)
    defer cancel()
    task, err := vm.Reconfigure(ctx, spec)
    if err != nil {
    return err
    }
    tctx, tcancel := context.WithTimeout(context.Background(), 10 * time.Minute)
    defer tcancel()
    return task.Wait(tctx)
}

So despite the modification in 1.25.0 the parameter api_timeout which should overwrite the defaultapitimeout does not seem to work in the template

References

Make the API timeout configurable when creating VM # 1278
#1278

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 11, 2021
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
bug Type: Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant