dmacvicar / terraform-provider-libvirt

Terraform provider to provision infrastructure with Linux's KVM using libvirt
Apache License 2.0
1.54k stars 457 forks source link

Upgraded from 0.7.1 to 0.7.6 - got this error: Guest agent is not responding: QEMU guest agent is not connected #1050

Closed LavBU closed 7 months ago

LavBU commented 7 months ago

Linux distribution

Oracle-8

Terraform version

Terraform v1.5.7
on linux_amd64

Provider and libvirt versions

0.7.6

Checklist

Description of Issue/Question

When using version 0.7.1, I didn't have no error regarding QEMU guest agent. When unzip 0.7.6 and using it in main.tf file, my guest provisioning worked, but with this error:

Plan: 6 to add, 0 to change, 0 to destroy. libvirt_volume.vm[0]: Creating... libvirt_cloudinit_disk.cloudinit: Creating... libvirt_network.vm_nfs_network: Creating... libvirt_network.vm_main_network: Creating... libvirt_network.vm_iscsi_network: Creating... libvirt_network.vm_nfs_network: Creation complete after 5s [id=1b7fef2a-6357-4da7-8863-df1506c51a63] libvirt_network.vm_main_network: Creation complete after 5s [id=404ab10b-9942-46e9-9019-9cb0a0c1f67d] libvirt_network.vm_iscsi_network: Creation complete after 5s [id=d79457d9-8fea-4fd9-a725-4cb83cb27b79] libvirt_volume.vm[0]: Creation complete after 8s [id=my_guest.qcow2] libvirt_cloudinit_disk.cloudinit: Creation complete after 8s [id=my_guest.iso;0bcdfe3e-67cd-4407-a5eb-6439ebaf80cd] libvirt_domain.vm[0]: Creating... ╷ │ Error: error retrieving interface addresses: error retrieving interface addresses: Guest agent is not responding: QEMU guest agent is not connected │ │ with libvirt_domain.vm[0], │ on main.tf line 89, in resource "libvirt_domain" "vm": │ 89: resource "libvirt_domain" "vm" {

Setup

The relevant main.tf section is this:

resource "libvirt_domain" "vm" { count = var.VM_COUNT name = "${var.VM_HOSTNAME}" memory = var.VMEM vcpu = var.VCPU cloudinit = libvirt_cloudinit_disk.cloudinit.id qemu_agent = true

Steps to Reproduce Issue

Provisioning of a new VM using 0.7.6 version with the above main.tf 'qemu_agent = true' defined.

rgl commented 7 months ago

FWIW, this is also happening here, in my terraform-libvirt-talos example, which uses qemu_agent = true and network_interface wait_for_lease = false.

PS in my case qemu agent will not really be available until much later, after the virtual machine is created, after it reports the ip address, after it eventually installs the qemu agent; so in my case, having qemu_agent = false and network_interface wait_for_lease = true fixed the problem.

LavBU commented 7 months ago

Thanks @rgl for your reply and nice work you did there 👍 I just tested it qemu_agent = false (in my case, the network_interface wait_for_lease is not defined at all), and everything is working as usual (Guest is up and running with network connection). Will go with 0.7.6 then. Thanks

LavBU commented 7 months ago

So far So good