-
Notifications
You must be signed in to change notification settings - Fork 460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix/qemuagent #873
Fix/qemuagent #873
Conversation
See TestAccLibvirtDomain_NetworkInterfaceQemuGuestAgentStaticIP Testcase requires download of external vm image generated from GitHub workflow.
Uses libvirt.DomainInterfaceAddressesSrcAgent in call to virConn.DomainInterfaceAddresses
I have created a test version with this fix: https://github.com/remoe/terraform-provider-libvirt/releases/tag/untagged-fb1e891272fa09d2d159 It works on my side. ATTENTION: this not an official version. Use it only for testing. |
|
||
interfaces, err = virConn.DomainInterfaceAddresses(domain, uint32(libvirt.DomainInterfaceAddressesSrcLease), 0) | ||
var interfaces []libvirt.DomainInterface | ||
interfaces, err = virConn.DomainInterfaceAddresses(domain, addrsrc, 0) | ||
if err != nil { | ||
switch err.(type) { | ||
default: | ||
return interfaces, fmt.Errorf("Error retrieving interface addresses: %s", err) | ||
case libvirt.Error: | ||
virErr := err.(libvirt.Error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can remove this cast here as it is not needed in this switch type.
Can anyone merge this with the above changes for next release? |
I have manually rebased and committed this. I don't like the 120M image for the test, so the test is pending and I opened #913 to revisit it. |
Reimplements qemu-guest-agent interface query using go-libvirt interface.
Needed to query dhcp allocated IPs on bridged networks.
Testcase
I wanted to produce a decent reproducible test case so I generated an VM image (using alpine scripts) that runs qemu-guest-agent and configures a static IP that can be queried. See TestAccLibvirtDomain_NetworkInterfaceQemuGuestAgentStaticIP.
The VM test image in https://github.com/maseman/testvm-tflibvirt is generated with a workflow as a release asset. At ~100MB I thought it best NOT to add the file to terraform-provider-libvirt /testdata and instead setup a download in the testcase.
Alpine VMs like this (and with small overlay configurations) might be useful for other more complex test scenarios in the future.