示例#1
0
func (d *Domain) GetMaxMemory() (uint64, error) {
	result := C.virDomainGetMaxMemory(d.cptr)
	if result == 0 {
		return uint64(0), GetLastError()
	}

	return uint64(result), nil
}
示例#2
0
// MaxMemory retrieves the maximum amount of physical memory allocated to
// a domain.
func (dom Domain) MaxMemory() (uint64, error) {
	dom.log.Println("reading domain maximum memory...")
	cRet := C.virDomainGetMaxMemory(dom.virDomain)
	ret := uint64(cRet)

	if ret == 0 {
		err := LastError()
		dom.log.Printf("an error occurred: %v\n", err)
		return 0, err
	}

	dom.log.Printf("max memory: %v kiB\n", ret)

	return ret, nil
}