Terraform-provider-libvirt: Problem with qemu-qa channel (bindings changed)

Created on 4 Aug 2020  路  8Comments  路  Source: dmacvicar/terraform-provider-libvirt

System Information

Gentoo Linux 5.6.14

Linux distribution

Gentoo

Terraform version

terraform -v
Terraform v0.12.29

Provider and libvirt versions

terraform-provider-libvirt -version
./terraform-provider-libvirt db587ad14bfb29aa9cbd56482c79f414e2f26409-dirty
Compiled against library: libvirt 6.0.0
Using library: libvirt 6.2.0
Running hypervisor: QEMU 5.0.0
Running against daemon: 6.2.0

If that gives you "was not built correctly", get the Git commit hash from your local provider repository:

git describe --always --abbrev=40 --dirty

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] Make sure you explain why this option is important to you, why it should be important to everyone. Describe your use-case with detail and provide examples where possible.
    • [ ] If it is a very special case, consider using the _XSLT_ support in the provider to tweak the definition instead of opening an issue
    • [ ] Maintainers do not have expertise in every libvirt setting, so please, describe the feature and how it is used. Link to the appropriate documentation
  • [ ] 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

Cannot change qemu-qa channel type.
The default configuration made by terraform is the following:

<channel type="pty">
  <source path="/dev/pts/44"/>
  <target type="virtio" name="org.qemu.guest_agent.0" state="connected"/>
  <alias name="channel0"/>
  <address type="virtio-serial" controller="0" bus="0" port="1"/>
</channel>

and that makes qemu-agent doesn't work.
The configuration which works for me is:

<channel type="unix">
  <source mode="bind" path="/var/lib/libvirt/qemu/channel/target/domain-22-exphost-prod-cicd_wo/org.qemu.guest_agent.0"/>
  <target type="virtio" name="org.qemu.guest_agent.0" state="connected"/>
  <alias name="channel0"/>
  <address type="virtio-serial" controller="0" bus="0" port="1"/>
</channel>

But I don't know, how to change type and source in terraform.
I couldn't find it in documentation or in sources...

I have to change that manually to get it working, but I need that works out of the box for CICD...

Setup

(Please provide the full _main.tf_ file for reproducing the issue (Be sure to remove sensitive information)

provider "libvirt" {
    uri = "qemu:///system"
}
resource "libvirt_volume" "volume_exphost-test-cicd_master-0-sda" {
    name = "volume_exphost-test-cicd_master-0-sda"
    pool = "default"
    base_volume_name = "base_centos7.img"
}


resource "libvirt_domain" "exphost-test-cicd_master-0" {
    name = "exphost-test-cicd_master-0"
    description = "roles: repo\ncluster: exphost-test"
    vcpu = 2
    memory = 1024

    disk {
        volume_id = libvirt_volume.volume_exphost-test-cicd_master-0-sda.id
        scsi      = "true"
    }
    network_interface {
        bridge = "br105"
    }
}

Steps to Reproduce Issue

(Include debug logs if possible and relevant).

no logs. just the wrong xml manifest for virtual machine


Additional information:

Do you have SELinux or Apparmor/Firewall enabled? Some special configuration?
Have you tried to reproduce the issue without them enabled?

none of the above

help wanted

All 8 comments

as https://github.com/dmacvicar/terraform-provider-libvirt/issues/710#issuecomment-662557145 we need research to see what has changed on the qemu-agent side

for a possible fix/feature we need some research

hi! i'm facing a similar problem in my environment. the qemu-guest-agent is installed during cloud-init using "packages" and "qemu_agent = true" set in "libvirt_domain" resource.

[description of issue/question]

everytime a vm is created, the qemu-guest-agent channel is binded to /dev/pts/X instead of unix.

[system information]

[host]
5.4.52-1-MANJARO #1 SMP PREEMPT Thu Jul 16 16:07:11 UTC 2020 x86_64 GNU/Linux
Terraform v0.12.29
+ provider.libvirt (unversioned) - terraform-provider-libvirt 0.6.2+git.1585292411.8cbe9ad0 / Compiled against library: libvirt 4.0.0
+ provider.local v1.4.0
+ provider.null v2.1.2
+ provider.template v2.1.2
qemu-x86_64 version 5.0.0
libvirtd (libvirt) 6.4.0

[guest]
4.19.0-9-cloud-amd64 #1 SMP Debian 4.19.118-2+deb10u1 (2020-06-07) x86_64 GNU/Linux
QEMU Guest Agent 3.1.0

[additional information]

[Generated XML:]

2020-07-31T13:36:32.020-0300 [DEBUG] plugin.terraform-provider-libvirt: 2020/07/31 13:36:32 [DEBUG] Do not have an IP for 'k8s-worker-01' yet: will wait until DHCP provides one...
2020-07-31T13:36:32.020-0300 [DEBUG] plugin.terraform-provider-libvirt: 2020/07/31 13:36:32 [INFO] Creating libvirt domain at qemu+ssh://server.local/system
2020-07-31T13:36:32.021-0300 [DEBUG] plugin.terraform-provider-libvirt: 2020/07/31 13:36:32 [DEBUG] Generated XML for libvirt domain:
2020-07-31T13:36:32.021-0300 [DEBUG] plugin.terraform-provider-libvirt:   <domain type="kvm">
2020-07-31T13:36:32.021-0300 [DEBUG] plugin.terraform-provider-libvirt:       <name>k8s-worker-01</name>
2020-07-31T13:36:32.021-0300 [DEBUG] plugin.terraform-provider-libvirt:       <description>create k8s workers kvm domains</description>
2020-07-31T13:36:32.021-0300 [DEBUG] plugin.terraform-provider-libvirt:       <memory unit="MiB">2048</memory>
2020-07-31T13:36:32.021-0300 [DEBUG] plugin.terraform-provider-libvirt:       <vcpu>1</vcpu>
2020-07-31T13:36:32.021-0300 [DEBUG] plugin.terraform-provider-libvirt:       <os>
2020-07-31T13:36:32.021-0300 [DEBUG] plugin.terraform-provider-libvirt:           <type>hvm</type>
2020-07-31T13:36:32.021-0300 [DEBUG] plugin.terraform-provider-libvirt:       </os>
2020-07-31T13:36:32.021-0300 [DEBUG] plugin.terraform-provider-libvirt:       <features>
2020-07-31T13:36:32.021-0300 [DEBUG] plugin.terraform-provider-libvirt:           <pae></pae>
2020-07-31T13:36:32.021-0300 [DEBUG] plugin.terraform-provider-libvirt:           <acpi></acpi>
2020-07-31T13:36:32.021-0300 [DEBUG] plugin.terraform-provider-libvirt:           <apic></apic>
2020-07-31T13:36:32.021-0300 [DEBUG] plugin.terraform-provider-libvirt:       </features>
2020-07-31T13:36:32.021-0300 [DEBUG] plugin.terraform-provider-libvirt:       <cpu></cpu>
2020-07-31T13:36:32.021-0300 [DEBUG] plugin.terraform-provider-libvirt:       <devices>
2020-07-31T13:36:32.021-0300 [DEBUG] plugin.terraform-provider-libvirt:           <disk type="volume" device="disk">
2020-07-31T13:36:32.021-0300 [DEBUG] plugin.terraform-provider-libvirt:               <driver name="qemu" type="qcow2"></driver>
2020-07-31T13:36:32.021-0300 [DEBUG] plugin.terraform-provider-libvirt:               <source pool="default" volume="k8s-worker-01.qcow2"></source>
2020-07-31T13:36:32.021-0300 [DEBUG] plugin.terraform-provider-libvirt:               <target dev="vda" bus="virtio"></target>
2020-07-31T13:36:32.021-0300 [DEBUG] plugin.terraform-provider-libvirt:           </disk>
2020-07-31T13:36:32.021-0300 [DEBUG] plugin.terraform-provider-libvirt:           <interface type="network">
2020-07-31T13:36:32.021-0300 [DEBUG] plugin.terraform-provider-libvirt:               <mac address="52:54:00:12:8d:a0"></mac>
2020-07-31T13:36:32.021-0300 [DEBUG] plugin.terraform-provider-libvirt:               <source network="network01"></source>
2020-07-31T13:36:32.021-0300 [DEBUG] plugin.terraform-provider-libvirt:               <model type="virtio"></model>
2020-07-31T13:36:32.021-0300 [DEBUG] plugin.terraform-provider-libvirt:           </interface>
2020-07-31T13:36:32.021-0300 [DEBUG] plugin.terraform-provider-libvirt:           <console>
2020-07-31T13:36:32.021-0300 [DEBUG] plugin.terraform-provider-libvirt:               <target type="serial" port="0"></target>
2020-07-31T13:36:32.021-0300 [DEBUG] plugin.terraform-provider-libvirt:           </console>
2020-07-31T13:36:32.021-0300 [DEBUG] plugin.terraform-provider-libvirt:           <console>
2020-07-31T13:36:32.021-0300 [DEBUG] plugin.terraform-provider-libvirt:               <target type="virtio" port="1"></target>
2020-07-31T13:36:32.021-0300 [DEBUG] plugin.terraform-provider-libvirt:           </console>


2020-07-31T13:36:32.021-0300 [DEBUG] plugin.terraform-provider-libvirt:           <channel>
2020-07-31T13:36:32.021-0300 [DEBUG] plugin.terraform-provider-libvirt:               <target type="virtio" name="org.qemu.guest_agent.0"></target>
2020-07-31T13:36:32.021-0300 [DEBUG] plugin.terraform-provider-libvirt:           </channel>


2020-07-31T13:36:32.021-0300 [DEBUG] plugin.terraform-provider-libvirt:           <graphics type="vnc" autoport="yes">
2020-07-31T13:36:32.021-0300 [DEBUG] plugin.terraform-provider-libvirt:               <listen type="address" address="0.0.0.0"></listen>
2020-07-31T13:36:32.021-0300 [DEBUG] plugin.terraform-provider-libvirt:           </graphics>
2020-07-31T13:36:32.021-0300 [DEBUG] plugin.terraform-provider-libvirt:           <rng model="virtio">
2020-07-31T13:36:32.021-0300 [DEBUG] plugin.terraform-provider-libvirt:               <backend model="random">/dev/urandom</backend>
2020-07-31T13:36:32.021-0300 [DEBUG] plugin.terraform-provider-libvirt:           </rng>
2020-07-31T13:36:32.021-0300 [DEBUG] plugin.terraform-provider-libvirt:       </devices>
2020-07-31T13:36:32.021-0300 [DEBUG] plugin.terraform-provider-libvirt:   </domain>

[Received XML:]

2020-07-31T13:37:07.881-0300 [DEBUG] plugin.terraform-provider-libvirt: 2020/07/31 13:37:07 [DEBUG] Read resource libvirt_domain
2020-07-31T13:37:07.881-0300 [DEBUG] plugin.terraform-provider-libvirt: 2020/07/31 13:37:07 [DEBUG] Read resource libvirt_domain
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt: 2020/07/31 13:37:07 [DEBUG] read: obtained XML desc for domain:
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt: <domain type='kvm' id='20'>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:   <name>k8s-worker-01</name>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:   <uuid>dce6b5d4-1200-4730-9e01-5db242c53ac5</uuid>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:   <memory unit='KiB'>2097152</memory>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:   <currentMemory unit='KiB'>2097152</currentMemory>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:   <vcpu placement='static'>1</vcpu>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:   <resource>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:     <partition>/machine</partition>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:   </resource>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:   <os>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:     <type arch='x86_64' machine='pc-i440fx-5.0'>hvm</type>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:     <boot dev='hd'/>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:   </os>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:   <features>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:     <acpi/>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:     <apic/>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:     <pae/>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:   </features>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:   <cpu mode='custom' match='exact' check='full'>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:     <model fallback='forbid'>qemu64</model>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:     <feature policy='require' name='x2apic'/>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:     <feature policy='require' name='hypervisor'/>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:     <feature policy='require' name='lahf_lm'/>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:     <feature policy='disable' name='svm'/>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:   </cpu>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:   <clock offset='utc'/>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:   <on_poweroff>destroy</on_poweroff>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:   <on_reboot>restart</on_reboot>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:   <on_crash>destroy</on_crash>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:   <devices>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:     <emulator>/usr/bin/qemu-system-x86_64</emulator>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:     <disk type='volume' device='disk'>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:       <driver name='qemu' type='qcow2'/>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:       <source pool='default' volume='k8s-worker-01.qcow2' index='2'/>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:       <target dev='vda' bus='virtio'/>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:       <alias name='virtio-disk0'/>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:       <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:     </disk>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:     <controller type='usb' index='0' model='piix3-uhci'>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:       <alias name='usb'/>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:       <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:     </controller>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:     <controller type='pci' index='0' model='pci-root'>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:       <alias name='pci.0'/>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:     </controller>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:     <controller type='ide' index='0'>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:       <alias name='ide'/>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:       <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:     </controller>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:     <controller type='virtio-serial' index='0'>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:       <alias name='virtio-serial0'/>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:       <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:     </controller>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:     <interface type='network'>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:       <mac address='52:54:00:12:8d:a0'/>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:       <source network='network01' portid='c8b28045-72d7-40a0-b3ba-c41de45d8916' bridge='virbr1'/>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:       <target dev='vnet0'/>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:       <model type='virtio'/>
2020-07-31T13:37:07.982-0300 [DEBUG] plugin.terraform-provider-libvirt:       <alias name='net0'/>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:       <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:     </interface>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:     <serial type='pty'>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:       <source path='/dev/pts/0'/>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:       <target type='isa-serial' port='0'>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:         <model name='isa-serial'/>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:       </target>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:       <alias name='serial0'/>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:     </serial>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:     <console type='pty' tty='/dev/pts/0'>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:       <source path='/dev/pts/0'/>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:       <target type='serial' port='0'/>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:       <alias name='serial0'/>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:     </console>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:     <console type='pty'>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:       <source path='/dev/pts/2'/>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:       <target type='virtio' port='1'/>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:       <alias name='console1'/>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:     </console>


2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:     <channel type='pty'>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:       <source path='/dev/pts/1'/>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:       <target type='virtio' name='org.qemu.guest_agent.0' state='disconnected'/>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:       <alias name='channel0'/>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:       <address type='virtio-serial' controller='0' bus='0' port='1'/>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:     </channel>


2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:     <input type='mouse' bus='ps2'>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:       <alias name='input0'/>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:     </input>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:     <input type='keyboard' bus='ps2'>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:       <alias name='input1'/>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:     </input>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:     <graphics type='vnc' port='5900' autoport='yes' listen='0.0.0.0'>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:       <listen type='address' address='0.0.0.0'/>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:     </graphics>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:     <video>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:       <model type='cirrus' vram='16384' heads='1' primary='yes'/>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:       <alias name='video0'/>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:       <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:     </video>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:     <memballoon model='virtio'>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:       <stats period='5'/>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:       <alias name='balloon0'/>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:       <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:     </memballoon>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:     <rng model='virtio'>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:       <backend model='random'>/dev/urandom</backend>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:       <alias name='rng0'/>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:       <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:     </rng>
2020-07-31T13:37:07.983-0300 [DEBUG] plugin.terraform-provider-libvirt:   </devices>

[then, this error goes until fallback to libvirt API:]

2020-07-31T13:37:34.392-0300 [DEBUG] plugin.terraform-provider-libvirt: 2020/07/31 13:37:34 [DEBUG] sending command to qemu-agent 2020-07-31T13:37:34.394-0300 [DEBUG] plugin.terraform-provider-libvirt: 2020/07/31 13:37:34 [DEBUG] sending command to qemu-agent 2020-07-31T13:37:34.421-0300 [DEBUG] plugin.terraform-provider-libvirt: 2020/07/31 13:37:34 [DEBUG] command error: virError(Code=86, Domain=10, Message='Agente de convidado n茫o est谩 respondendo: QEMU guest agent is not connected') 2020-07-31T13:37:34.421-0300 [DEBUG] plugin.terraform-provider-libvirt: 2020/07/31 13:37:34 [TRACE] Waiting 10s before next try 2020-07-31T13:37:34.422-0300 [DEBUG] plugin.terraform-provider-libvirt: 2020/07/31 13:37:34 [DEBUG] command error: virError(Code=86, Domain=10, Message='Agente de convidado n茫o est谩 respondendo: QEMU guest agent is not connected') 2020-07-31T13:37:34.422-0300 [DEBUG] plugin.terraform-provider-libvirt: 2020/07/31 13:37:34 [TRACE] Waiting 10s before next try 2020-07-31T13:37:34.467-0300 [DEBUG] plugin.terraform-provider-libvirt: 2020/07/31 13:37:34 [DEBUG] sending command to qemu-agent 2020-07-31T13:37:34.472-0300 [DEBUG] plugin.terraform-provider-libvirt: 2020/07/31 13:37:34 [DEBUG] command error: virError(Code=86, Domain=10, Message='Agente de convidado n茫o est谩 respondendo: QEMU guest agent is not connected') 2020-07-31T13:37:34.472-0300 [DEBUG] plugin.terraform-provider-libvirt: 2020/07/31 13:37:34 [TRACE] Waiting 10s before next try 2020-07-31T13:37:34.530-0300 [DEBUG] plugin.terraform-provider-libvirt: 2020/07/31 13:37:34 [DEBUG] sending command to qemu-agent 2020-07-31T13:37:34.534-0300 [DEBUG] plugin.terraform-provider-libvirt: 2020/07/31 13:37:34 [DEBUG] command error: virError(Code=86, Domain=10, Message='Agente de convidado n茫o est谩 respondendo: QEMU guest agent is not connected') 2020-07-31T13:37:34.534-0300 [DEBUG] plugin.terraform-provider-libvirt: 2020/07/31 13:37:34 [TRACE] Waiting 10s before next try 2020-07-31T13:37:34.550-0300 [DEBUG] plugin.terraform-provider-libvirt: 2020/07/31 13:37:34 [DEBUG] sending command to qemu-agent 2020-07-31T13:37:34.553-0300 [DEBUG] plugin.terraform-provider-libvirt: 2020/07/31 13:37:34 [DEBUG] command error: virError(Code=86, Domain=10, Message='Agente de convidado n茫o est谩 respondendo: QEMU guest agent is not connected') 2020-07-31T13:37:34.553-0300 [DEBUG] plugin.terraform-provider-libvirt: 2020/07/31 13:37:34 [TRACE] Waiting 10s before next try 2020-07-31T13:37:34.674-0300 [DEBUG] plugin.terraform-provider-libvirt: 2020/07/31 13:37:34 [DEBUG] sending command to qemu-agent 2020-07-31T13:37:34.706-0300 [DEBUG] plugin.terraform-provider-libvirt: 2020/07/31 13:37:34 [DEBUG] command error: virError(Code=86, Domain=10, Message='Agente de convidado n茫o est谩 respondendo: QEMU guest agent is not connected') 2020/07/31 13:37:36 [TRACE] dag/walk: vertex "module.domain_k8s_workers.output.k8s_workers_ips_output" is waiting for "module.domain_k8s_workers.local.ip_add" 2020-07-31T13:37:38.264-0300 [DEBUG] plugin.terraform-provider-libvirt: 2020/07/31 13:37:38 [WARN] WaitForState timeout after 30s 2020-07-31T13:37:38.264-0300 [DEBUG] plugin.terraform-provider-libvirt: 2020/07/31 13:37:38 [WARN] WaitForState starting 30s refresh grace period 2020-07-31T13:37:38.264-0300 [DEBUG] plugin.terraform-provider-libvirt: 2020/07/31 13:37:38 [DEBUG] no interfaces could be obtained with qemu-agent: falling back to the libvirt API 2020-07-31T13:37:38.272-0300 [DEBUG] plugin.terraform-provider-libvirt: 2020/07/31 13:37:38 [DEBUG] Interfaces info obtained with libvirt API: 2020-07-31T13:37:38.272-0300 [DEBUG] plugin.terraform-provider-libvirt: ([]libvirt.DomainInterface) (len=1 cap=1) { 2020-07-31T13:37:38.272-0300 [DEBUG] plugin.terraform-provider-libvirt: (libvirt.DomainInterface) { 2020-07-31T13:37:38.272-0300 [DEBUG] plugin.terraform-provider-libvirt: Name: (string) (len=5) "vnet2", 2020-07-31T13:37:38.272-0300 [DEBUG] plugin.terraform-provider-libvirt: Hwaddr: (string) (len=17) "52:54:00:0e:59:56", 2020-07-31T13:37:38.272-0300 [DEBUG] plugin.terraform-provider-libvirt: Addrs: ([]libvirt.DomainIPAddress) (len=1 cap=1) { 2020-07-31T13:37:38.272-0300 [DEBUG] plugin.terraform-provider-libvirt: (libvirt.DomainIPAddress) { 2020-07-31T13:37:38.272-0300 [DEBUG] plugin.terraform-provider-libvirt: Type: (int) 0, 2020-07-31T13:37:38.272-0300 [DEBUG] plugin.terraform-provider-libvirt: Addr: (string) (len=12) "172.16.0.192", 2020-07-31T13:37:38.272-0300 [DEBUG] plugin.terraform-provider-libvirt: Prefix: (uint) 24 2020-07-31T13:37:38.272-0300 [DEBUG] plugin.terraform-provider-libvirt: } 2020-07-31T13:37:38.272-0300 [DEBUG] plugin.terraform-provider-libvirt: } 2020-07-31T13:37:38.272-0300 [DEBUG] plugin.terraform-provider-libvirt: } 2020-07-31T13:37:38.272-0300 [DEBUG] plugin.terraform-provider-libvirt: } 2020-07-31T13:37:38.272-0300 [DEBUG] plugin.terraform-provider-libvirt: 2020-07-31T13:37:38.273-0300 [DEBUG] plugin.terraform-provider-libvirt: 2020/07/31 13:37:38 [DEBUG] read: addresses for '52:54:00:0E:59:56': [172.16.0.192]

After patching the code as @aaannz commented on issue #710, the XML generated by the provider contains the 'channel type="unix"' value and the response comes with the correct type of binding and the qemu-guest-agent starts working.

I don't know golang, and after looking at the code, I think this is caused by the fallthrough statement on line '448' of "libvirt/domain.go". It will fallthrough to 'pty' because the type 'unix' is not referenced.

Also, I took a look on libvirt/domain_def.go, and found a refactoring that removed the 'type="unix"' on July/2018 ( but I don't know if this information is useful for diagnosis purpose).

Hope this helps someway.

If needed more information or logs, tell me.

This XSL works:

<?xml version="1.0" ?>
<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output omit-xml-declaration="yes" indent="yes"/>
  <xsl:template match="node()|@*">
     <xsl:copy>
       <xsl:apply-templates select="node()|@*"/>
     </xsl:copy>
  </xsl:template>
  <xsl:template match="devices/channel">
   <xsl:element name="channel">
      <xsl:attribute name="type">
        <xsl:value-of select="'unix'"/>
      </xsl:attribute>
    <xsl:element name="source">
      <xsl:attribute name="mode">
        <xsl:value-of select="'bind'"/>
      </xsl:attribute>
    </xsl:element>
    <xsl:element name="target">
      <xsl:attribute name="type">
        <xsl:value-of select="'virtio'"/>
      </xsl:attribute>
      <xsl:attribute name="name">
        <xsl:value-of select="'org.qemu.guest_agent.0'"/>
      </xsl:attribute>
    </xsl:element>
   </xsl:element>
  </xsl:template>
</xsl:stylesheet>

@ianblenke is it possible to set that via terraform manifest?

ok, figured it out.
thanks

@dmacvicar To my knowledge nothing has changed in qemu-agent, but as described in #800 past refactorings to include a newer version of libvirt-go-xml broke the behavior of this provider (from using the type="unix" channel to unsetting it, which leads to type="pty").

It would be really great to integrate this patch, as it fixes the issue of defining a wrong channel type, which breaks the possibility of interacting with the domain in question using the qemu-guest-agent.
After applying the suggested fix (https://github.com/dmacvicar/terraform-provider-libvirt/issues/710#issuecomment-663007825) I can again query newly created domains (e.g. virsh domifaddr --source agent <name>).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

arunnalpet picture arunnalpet  路  3Comments

alkersan picture alkersan  路  5Comments

james-crowley picture james-crowley  路  6Comments

MalloZup picture MalloZup  路  5Comments

will-code-for-pizza picture will-code-for-pizza  路  4Comments