From 406aa55667f11cf9fe1f59ca8d5da1d0d3e2bb5b Mon Sep 17 00:00:00 2001 From: Jonathan Gold Date: Wed, 29 Nov 2017 15:41:02 -0500 Subject: [PATCH] resources: virt: Update libvirt-xml target Builds started failing due to go-libvirt-xml 6d97448. In that patch, the DomainChannelTarget struct was changed from having a single type field, to having an individual field for each virtualization type. This patch updates the connection check in Init to reflect the changes to go-libvirt-xml, so that builds no longer fail. --- resources/virt.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/virt.go b/resources/virt.go index 072ecff5..8a044653 100644 --- a/resources/virt.go +++ b/resources/virt.go @@ -185,9 +185,9 @@ func (obj *VirtRes) Init() error { // guest agent: domain->devices->channel->target->state == connected? for _, x := range domXML.Devices.Channels { - if x.Target.Type == "virtio" && strings.HasPrefix(x.Target.Name, "org.qemu.guest_agent.") { + if x.Target.VirtIO != nil && strings.HasPrefix(x.Target.VirtIO.Name, "org.qemu.guest_agent.") { // last connection found wins (usually 1 anyways) - obj.guestAgentConnected = (x.Target.State == "connected") + obj.guestAgentConnected = (x.Target.VirtIO.State == "connected") } } }