Beispiel #1
0
func (c *VirConnection) GetType() (string, error) {
	str := C.virConnectGetType(c.ptr)
	if str == nil {
		return "", GetLastError()
	}
	hypDriver := C.GoString(str)
	return hypDriver, nil
}
Beispiel #2
0
func (h *Hypervisor) GetType() (string, error) {
	result := C.virConnectGetType(h.cptr)
	if result == nil {
		return "", GetLastError()
	}

	htype := C.GoString(result)

	return htype, nil
}
// Type gets the name of the Hypervisor driver used. This is merely the driver
// name; for example, both KVM and QEMU guests are serviced by the driver for
// the qemu:// URI, so a return of "QEMU" does not indicate whether KVM
// acceleration is present. For more details about the hypervisor, use
// Capabilities.
func (conn Connection) Type() (string, error) {
	conn.log.Println("reading hypervisor driver name...")
	cType := C.virConnectGetType(conn.virConnect)
	if cType == nil {
		err := LastError()
		conn.log.Printf("an error occurred: %v\n", err)
		return "", err
	}

	typ := C.GoString(cType)
	conn.log.Printf("hypervisor driver name: %v\n", typ)

	return typ, nil
}