Closed southsidedean closed 7 months ago
maybe, is this because of this timeouts change?
PS: Its not that. Here's the log, with my added XXX debug messages, where you can see, the first shows when it started to polll, and the second, when it failed witn an error; there is only about 5s difference between them, which means the waitFunc
gives up too soon:
2023-10-14T13:27:07.154+0100 [INFO] provider.terraform-provider-libvirt: 2023/10/14 13:27:07 [INFO] Domain ID: b76f6562-6235-40a2-8575-2b8eb2b1d061: timestamp=2023-10-14T13:27:07.154+0100
2023-10-14T13:27:07.154+0100 [INFO] provider.terraform-provider-libvirt: 2023/10/14 13:27:07 [DEBUG] XXX timeout=5m0s resourceStateMinTimeout=3000000000 resourceStateDelay=5000000000: timestamp=2023-10-14T13:27:07.154+0100
2023-10-14T13:27:07.154+0100 [INFO] provider.terraform-provider-libvirt: 2023/10/14 13:27:07 [DEBUG] Waiting for state to become: [all-addresses-obtained]: timestamp=2023-10-14T13:27:07.154+0100
2023-10-14T13:27:10.175+0100 [TRACE] dag/walk: vertex "provider[\"registry.terraform.io/dmacvicar/libvirt\"] (close)" is waiting for "libvirt_domain.example"
2023-10-14T13:27:10.175+0100 [TRACE] dag/walk: vertex "root" is waiting for "output.ip (expand)"
2023-10-14T13:27:10.175+0100 [TRACE] dag/walk: vertex "output.ip (expand)" is waiting for "libvirt_domain.example"
2023-10-14T13:27:12.156+0100 [INFO] provider.terraform-provider-libvirt: 2023/10/14 13:27:12 [DEBUG] waiting for network address for iface=52:54:00:5A:F1:B9: timestamp=2023-10-14T13:27:12.155+0100
2023-10-14T13:27:12.156+0100 [INFO] provider.terraform-provider-libvirt: 2023/10/14 13:27:12 [DEBUG] qemu-agent used to query interface info: timestamp=2023-10-14T13:27:12.156+0100
2023-10-14T13:27:12.156+0100 [INFO] provider.terraform-provider-libvirt: 2023/10/14 13:27:12 [DEBUG] XXX timeout=5m0s resourceStateMinTimeout=3000000000 resourceStateDelay=5000000000 err=error retrieving interface addresses: error retrieving interface addresses: Guest agent is not responding: QEMU guest agent is not connected: timestamp=2023-10-14T13:27:12.156+0100
2023-10-14T13:27:12.156+0100 [TRACE] provider.terraform-provider-libvirt: Called downstream: tf_resource_type=libvirt_domain tf_rpc=ApplyResourceChange @caller=/home/vagrant/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.24.1/helper/schema/resource.go:838 tf_req_id=9163b083-d4ce-aca8-76fa-0afbebd16616 @module=sdk.helper_schema tf_provider_addr=provider timestamp=2023-10-14T13:27:12.156+0100
2023-10-14T13:27:12.157+0100 [TRACE] provider.terraform-provider-libvirt: Received downstream response: diagnostic_warning_count=0 tf_proto_version=5.3 tf_provider_addr=provider tf_req_id=9163b083-d4ce-aca8-76fa-0afbebd16616 tf_resource_type=libvirt_domain tf_rpc=ApplyResourceChange @caller=/home/vagrant/go/pkg/mod/github.com/hashicorp/terraform-plugin-go@v0.14.2/tfprotov5/internal/tf5serverlogging/downstream_request.go:37 @module=sdk.proto diagnostic_error_count=1 tf_req_duration_ms=6785 timestamp=2023-10-14T13:27:12.157+0100
2023-10-14T13:27:12.157+0100 [ERROR] provider.terraform-provider-libvirt: Response contains error diagnostic: @caller=/home/vagrant/go/pkg/mod/github.com/hashicorp/terraform-plugin-go@v0.14.2/tfprotov5/internal/diag/diagnostics.go:55 diagnostic_summary="couldn't retrieve IP address of domain id: b76f6562-6235-40a2-8575-2b8eb2b1d061. Please check following:
1) is the domain running properly?
2) has the network interface an IP address?
3) Networking issues on your libvirt setup?
4) is DHCP enabled on this Domain's network?
5) if you use bridge network, the domain should have the pkg qemu-agent installed
IMPORTANT: This error is not a terraform libvirt-provider error, but an error caused by your KVM/libvirt infrastructure configuration/setup
error retrieving interface addresses: error retrieving interface addresses: Guest agent is not responding: QEMU guest agent is not connected" tf_provider_addr=provider tf_rpc=ApplyResourceChange tf_req_id=9163b083-d4ce-aca8-76fa-0afbebd16616 tf_resource_type=libvirt_domain @module=sdk.proto diagnostic_detail= diagnostic_severity=ERROR tf_proto_version=5.3 timestamp=2023-10-14T13:27:12.157+0100
PPS It fails at this call-site:
https://github.com/dmacvicar/terraform-provider-libvirt/blob/v0.7.4/libvirt/domain.go#L48-L51
with the error:
error retrieving interface addresses: error retrieving interface addresses: Guest agent is not responding: QEMU guest agent is not connected
The fix is at https://github.com/dmacvicar/terraform-provider-libvirt/pull/1039
Thanks for the update!
Hello, Having the same issue with my bridge interface (no problem with the virtual bridge created by libvirt). Does this mean we need to wait for a 0.7.5 or can we just build it from source?
You can work around this by setting the version of the plugin to 0.7.1
.
You can work around this by setting the version of the plugin to
0.7.1
.
Superb! That worked a treat! I'll stick with this version until this is fixed in later versions.
Setting the version to 0.7.1
appears to fix the immediate problem with QEMU agent communication since Terraform isn't throwing an error now when qemu_agent = true
but it's still unable to pull the IP for me. Appears to be due to the issue described in #1047 which is potentially fixed in the PR #1048.
Performing a terraform destroy
does produce valid addresses in the output so the communication is there but looks like wait_for_lease = true
isn't actually waiting for an IP address to be assigned once the interface comes up.
System Information
Linux distribution
Ubuntu 22.04
Terraform version
I've rolled back to 1.5.7 to test 0.7.4 against 0.7.0/0.7.1, due to the signing key issues in the older versions with terraform 1.6.0/1.6.1.
Provider and libvirt versions
provider = 0.7.4
Package: libvirt-daemon Version: 8.0.0-1ubuntu7.7
Checklist
[ ] Is your issue/contribution related with enabling some setting/option exposed by libvirt that the plugin does not yet support, or requires changing/extending the provider terraform schema?
[X] Is it a bug or something that does not work as expected? Please make sure you fill the version information below:
Description of Issue/Question
Terraform output is broken in 0.7.4. Can't pull the IP address information. I've double-checked that the qemu-agent is installed and running, etc.
Output from a 0.7.4 run yields:
The objects appear to be created without issue with 0.7.4, other than the outputs being broken.
Rolling back by setting the provider version to 0.7.0/0.7.1 with terraform 1.5.7 works fine:
Setup
The terraform code is from my GitHub repository
Steps to Reproduce Issue
Additional information:
Do you have SELinux or Apparmor/Firewall enabled? Some special configuration?
No
Have you tried to reproduce the issue without them enabled?
No, the issue goes away with older provider versions on the same system.