Exemple #1
0
func (d *Domain) GetOsType() (string, error) {
	result := C.virDomainGetOSType(d.cptr)
	if result == nil {
		return "", GetLastError()
	}

	osType := C.GoString(result)
	defer C.free(unsafe.Pointer(result))

	return osType, nil
}
Exemple #2
0
// OSType gets the type of domain operation system.
func (dom Domain) OSType() (string, error) {
	dom.log.Println("reading domain OS type...")
	cOS := C.virDomainGetOSType(dom.virDomain)
	if cOS == nil {
		err := LastError()
		dom.log.Printf("an error occurred: %v\n", err)
		return "", err
	}
	defer C.free(unsafe.Pointer(cOS))

	os := C.GoString(cOS)
	dom.log.Printf("OS type: %v\n", os)

	return os, nil
}