diff options
Diffstat (limited to 'libvirt/utils_libvirt.go')
-rw-r--r-- | libvirt/utils_libvirt.go | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/libvirt/utils_libvirt.go b/libvirt/utils_libvirt.go index cc86b1ec..22816769 100644 --- a/libvirt/utils_libvirt.go +++ b/libvirt/utils_libvirt.go @@ -5,7 +5,7 @@ import ( "log" libvirt "github.com/libvirt/libvirt-go" - "github.com/libvirt/libvirt-go-xml" + libvirtxml "github.com/libvirt/libvirt-go-xml" ) func getHostXMLDesc(ip, mac, name string) string { @@ -68,3 +68,16 @@ func getHostArchitecture(virConn *libvirt.Connect) (string, error) { return capabilities.Host.CPU.Arch, nil } + +func getHostCapabilities(virConn *libvirt.Connect) (libvirtxml.Caps, error) { + // We should perhaps think of storing this on the connect object + // on first call to avoid the back and forth + caps := libvirtxml.Caps{} + capsXML, err := virConn.GetCapabilities() + if err != nil { + return caps, err + } + xml.Unmarshal([]byte(capsXML), &caps) + log.Printf("[TRACE] Capabilities of host \n %+v", caps) + return caps, nil +} |