Open SJFCS opened 3 months ago
Hello,
could you try to get an specify wait_For_lease
using an image that already has qemu-guest-agent
installed? I had successfully get IP address from VM when doing so.
Hello, could you try to get an specify
wait_For_lease
using an image that already hasqemu-guest-agent
installed? I had successfully get IP address from VM when doing so.
Thank you for the method you provided I haven't tried to use an image with qemu-guest-agent already installed because I want qemu-guest-agent to be installed automatically during the cloudinit phase, which was possible in previous versions but will not work in the new version
I'll try to take a look and see if I can find anything changed that might cause it between those two versions.
I couldn't find anything particular between those versions. Also, I don't have bridged network in my setup and it's hard for me to create it so I used NAT-ed one and I couldn't reproduce it.
@SJFCS could you check if you can reproduce it in different network types? NAT-ed and routed for example?
EDIT: forget what I wrote, I can reproduce it, just used wrong image before :facepalm:
I'll try to bisect and see where problem lies
Okay, more debugging later: I cannot reproduce it - previously I had problems with cloud-init. I think it might be related to cloud-init itself rather than to provider.
Either way, I have consisten behavior between 0.7.6 and 0.7.1 - it's either failing if qemu-guest-agent is not installed and started or it is running fine otherwise.
I couldn't find anything particular between those versions. Also, I don't have bridged network in my setup and it's hard for me to create it so I used NAT-ed one and I couldn't reproduce it.
@SJFCS could you check if you can reproduce it in different network types? NAT-ed and routed for example?
EDIT: forget what I wrote, I can reproduce it, just used wrong image before 🤦
I'll try to bisect and see where problem lies
The network configuration is the same, I think it has nothing to do with this
Okay, more debugging later: I cannot reproduce it - previously I had problems with cloud-init. I think it might be related to cloud-init itself rather than to provider.
Either way, I have consisten behavior between 0.7.6 and 0.7.1 - it's either failing if qemu-guest-agent is not installed and started or it is running fine otherwise.
Okay, thanks for the troubleshooting, but I did only change the provider version number while keeping the configuration unchanged.
Do you have cloud-init logs for both scenarios?
Do you have cloud-init logs for both scenarios?
I have seen the logs in both cases, and they are normal and no errors are reported.
libv
This issue can be reproduced in versions greater than 0.7.1
│ Error: couldn't retrieve IP address of domain id: 3ac397de-13cd-485d-9772-872f7652de0d. Please check following: │ 1) is the domain running proplerly? │ 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: Virtual machine agent not responding: QEMU host agent not connected
I found that this is not related to whether the network mode is bridge or nat. To simplify the reproduction process and avoid cloudinit interference, I used the Talos ISO boot image below, which includes qemu-guest-agent and can be booted directly as a boot disk.
The metal-amd64.iso (MD5: ebd98e402606991700d8cb5545e72673) can be downloaded from: https://factory.talos.dev/image/ce4c980550dd2ab1b17bbf2b08801c7eb59418eafe8f279833297925d67c7515/v1.8.2/metal-amd64.iso
You can also build it yourself here: https://factory.talos.dev -> Bare-metal Machine -> choose version -> amd64 -> choose System Extensions qemu-guest-agent
#=====================================================================================
# Providers
#=====================================================================================
terraform {
required_version = ">= 1.6.0"
required_providers {
libvirt = {
source = "dmacvicar/libvirt"
version = "0.7.4"
}
template = {
source = "hashicorp/template"
version = "2.2.0"
}
}
}
provider "libvirt" {
uri = "qemu:///system"
}
#=====================================================================================
# Libvirt Pool
#=====================================================================================
resource "libvirt_pool" "kubernetes" {
name = "talos"
type = "dir"
path = "/opt/libvirt-pool/talos"
}
#=====================================================================================
# Network
#=====================================================================================
# resource "libvirt_network" "talos" {
# name = "talos"
# mode = "bridge"
# bridge = "br0" # Use the created bridge network card
# autostart = true
# }
resource "libvirt_network" "talos" {
name = "talos"
mode = "nat"
addresses = ["192.168.123.0/24"]
autostart = true
}
#=====================================================================================
# Domain
#=====================================================================================
resource "libvirt_domain" "domain-talos" {
name = "talos"
memory = "2048"
vcpu = 4
cpu {
mode = "host-passthrough"
}
qemu_agent = true
boot_device {
dev = ["cdrom", "hd", "network"]
}
network_interface {
network_id = libvirt_network.talos.id
wait_for_lease = true
}
# cdrom
disk {
file = "/home/admin/Downloads/images/metal-amd64.iso"
}
#=====================================================================================
# Console
#=====================================================================================
console {
type = "pty"
target_port = "0"
target_type = "serial"
}
console {
type = "pty"
target_type = "virtio"
target_port = "1"
}
graphics {
type = "spice"
listen_type = "address"
autoport = true
}
video {
type = "virtio"
}
}
# Output the IP addresses
output "ips" {
value = {
ip = libvirt_domain.domain-talos.network_interface[0].addresses
}
}
# set version = "0.7.1"
terraform init
terraform apply -auto-approve
terraform destroy -auto-approve
# it work !
# set version = "0.7.4"
terraform init -upgrade
terraform apply -auto-approve
# it err !
I wanted to have a look at this issue, but it seems I can reproduce it only with version 0.7.4
Versions 0.7.1, 0.7.6 and 0.8.1 are working fine for me. I pretty much copy-pasted your tf file in the previous comment, minus the template provider.
I wanted to have a look at this issue, but it seems I can reproduce it only with version 0.7.4
Versions 0.7.1, 0.7.6 and 0.8.1 are working fine for me. I pretty much copy-pasted your tf file in the previous comment, minus the template provider.
i try it ,on 0.7.6 and 0.8.1 is not working too. ...
System Information
Linux distribution
Archlinux
Terraform version
Provider and libvirt versions
This issue can be reproduced in versions greater than 0.7.1 Tested version: 0.7.1 normal 0.7.4 broken 0.7.6 broken 0.8.1 broken
Description of Issue/Question
If it is greater than 0.7.1, will not wait to obtain IP. You won't see this prompt "Still creating... [10s elapsed]"
I found that this is not related to whether the network mode is bridge or nat. To simplify the reproduction process and avoid cloudinit interference, I used the Talos ISO boot image below, which includes qemu-guest-agent and can be booted directly as a boot disk.
The metal-amd64.iso (MD5: ebd98e402606991700d8cb5545e72673) can be downloaded from: https://factory.talos.dev/image/ce4c980550dd2ab1b17bbf2b08801c7eb59418eafe8f279833297925d67c7515/v1.8.2/metal-amd64.iso
You can also build it yourself here: https://factory.talos.dev/ -> Bare-metal Machine -> choose version -> amd64 -> choose System Extensions qemu-guest-agent
Reproduction steps
when use 0.7.6 debug: TF_LOG=DEBUG terraform apply -auto-approve
0.7.1 is work step:
when use 0.7.1 debug:
(Include debug logs if possible and relevant).
Related issues issue #1050 #1028 #1037
Additional information:
The environment is the same, only the provider version is different