예제 #1
0
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
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
}