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.
This commit is contained in:
Jonathan Gold
2017-11-29 15:41:02 -05:00
committed by James Shubin
parent a76dce8b15
commit 406aa55667

View File

@@ -185,9 +185,9 @@ func (obj *VirtRes) Init() error {
// guest agent: domain->devices->channel->target->state == connected? // guest agent: domain->devices->channel->target->state == connected?
for _, x := range domXML.Devices.Channels { 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) // last connection found wins (usually 1 anyways)
obj.guestAgentConnected = (x.Target.State == "connected") obj.guestAgentConnected = (x.Target.VirtIO.State == "connected")
} }
} }
} }