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

Help to configure api_timeout on vsphere provider #1387

Closed
Panplumousse opened this issue Apr 15, 2021 · 4 comments
Closed

Help to configure api_timeout on vsphere provider #1387

Panplumousse opened this issue Apr 15, 2021 · 4 comments
Labels
bug Type: Bug

Comments

@Panplumousse
Copy link

Panplumousse commented Apr 15, 2021

Terraform Version

0.11.11

vSphere Provider Version

1.25.0

Hello, we have an issue with the vpshere api_timeout link to this issue:
Make the API timeout configurable when creating VM # 1278

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

We used to use version 1.12.0 of the plugin from the vpshere provider and today we have updated to 1.25.0. but the problem continues
we specify a timeout: "90" in the customization block of our model and api_timeout: "60" in vphere provider block but the result is the same

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"
}

Can you help us

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

@Panplumousse Panplumousse added the bug Type: Bug label Apr 15, 2021
@Panplumousse
Copy link
Author

Panplumousse commented May 3, 2021

Nobody can help us ?

@JmLallem
Copy link

JmLallem commented May 4, 2021

Perhaps in relation with References :
Similar issue reported - #641
Apparent fix for the issue - #792
Context deadline exceeded on VMs with large disks #1134

@Panplumousse
Copy link
Author

Panplumousse commented May 4, 2021

Hello
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

@github-actions
Copy link

github-actions bot commented Jun 4, 2021

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 4, 2021
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
bug Type: Bug
Projects
None yet
Development

No branches or pull requests

2 participants