go-qemu icon indicating copy to clipboard operation
go-qemu copied to clipboard

Bindings fail to run on libvirtd 1.3.1 with Go 1.7

Open simar7 opened this issue 7 years ago • 6 comments

Hello,

I was testing out these binding in a environment running libvirtd 1.3.1 and QEMU 2.5.0 and observed the following behavior:

vagrant@localhost:/kvmhost$ ./main --domainName smoketestvm2

Connecting to unix:///var/run/libvirt/libvirt-sock
2016/10/31 13:50:28 failed to create domain object: xdr:DecodeUint: EOF while decoding 4 bytes - read: '[]'
vagrant@localhost:/kvmhost$ virsh list
 Id    Name                           State
----------------------------------------------------
 4     smoketestvm2                   running

Has anything changed significantly between libvirtd 1.2.{1,2} and/or QEMU versions that has broken the bindings?

Would appreciate any insight into this.

simar7 avatar Oct 31 '16 23:10 simar7

Hey @simar7,

Looks like you may have found a bug! Can you provide me with a snippet of code that will reproduce this on 1.2.{1,2}?

benlemasurier avatar Oct 31 '16 23:10 benlemasurier

@benlemasurier the bindings work fine on 1.2.{1,2}. The problem seems to be on 1.3.1. To reproduce this you could try the domain_details example here: https://github.com/digitalocean/go-qemu/blob/master/examples/domain_details/main.go

go run examples/domain_details/main.go --domainName testVM

simar7 avatar Nov 01 '16 00:11 simar7

Thanks, @simar7. I just ran this against 2 local versions, 1.3.2 and 2.2.0 without any issue. From the error, I believe this is a bug somewhere in the go-libvirt library. I'm going to get a 1.3.1 instance spun up, in the meantime, can you provide me with any further details on your libvirt configuration? Your libvirtd.conf would definitely help the debugging process. Can you also try the same command as root?

Thanks again!

benlemasurier avatar Nov 01 '16 00:11 benlemasurier

Hey @benlemasurier thanks for looking into this. Here's my libvirtd.conf and here's sample run output again.

To confirm again, I'm running the following versions:

root@localhost:~# libvirtd --version
libvirtd (libvirt) 1.3.1
root@localhost:~# qemu-system-x86_64 --version
QEMU emulator version 2.5.0 (Debian 1:2.5+dfsg-5ubuntu10.5), Copyright (c) 2003-2008 Fabrice Bellard

simar7 avatar Nov 01 '16 17:11 simar7

I also tried talking to libvirt over TCP here's the stdout:

vagrant@localhost:/opt/software/rebox/bin$ sudo ./domain_details --address="localhost:16509" --network=tcp --domainName="smoketestvm2"

Connecting to tcp://localhost:16509
2016/11/01 11:27:33 failed to create domain object: xdr:DecodeUint: EOF while decoding 4 bytes - read: '[]'
vagrant@localhost:/opt/software/rebox/bin$ virsh list
 Id    Name                           State
----------------------------------------------------
 1     smoketestvm2                   running

simar7 avatar Nov 01 '16 18:11 simar7

Ok so as I mentioned in the IRC channel, I've seem to notice the following behavior:

Scenario 1: Go bindings work when built within a Vagrantbox running Ubuntu Xenial, Go 1.6.

Scenario 2: Go binding do not work when built on a Mac OS X machine running Go 1.7 with GOOS=linux and GOARCH=amd64

Has anything changed between Go versions? My initial guess would be the xdr:DecodeUint bits that show up when doing scenario 2, causing the bindings to fail.

simar7 avatar Nov 01 '16 22:11 simar7