コード例 #1
0
ファイル: libvirt.go プロジェクト: ericcapricorn/flynn
func (c *VirConnection) GetCapabilities() (string, error) {
	str := C.virConnectGetCapabilities(c.ptr)
	if str == nil {
		return "", GetLastError()
	}
	capabilities := C.GoString(str)
	C.free(unsafe.Pointer(str))
	return capabilities, nil
}
コード例 #2
0
ファイル: hypervisor.go プロジェクト: hooklift/golibvirt
func (h *Hypervisor) GetCapabilities() (string, error) {
	result := C.virConnectGetCapabilities(h.cptr)
	if result == nil {
		return "", GetLastError()
	}
	capabilities := C.GoString(result)
	defer C.free(unsafe.Pointer(result))

	return capabilities, nil
}
コード例 #3
0
// Capabilities provides capabilities of the hypervisor/driver.
func (conn Connection) Capabilities() (string, error) {
	conn.log.Println("reading connection capabilities...")
	cCap := C.virConnectGetCapabilities(conn.virConnect)
	if cCap == nil {
		err := LastError()
		conn.log.Printf("an error occurred: %v\n", err)
		return "", err
	}
	defer C.free(unsafe.Pointer(cCap))

	cap := C.GoString(cCap)
	conn.log.Printf("capabilities XML length: %v runes\n", utf8.RuneCountInString(cap))

	return cap, nil
}