Esempio n. 1
0
func (d *VirDomain) GetVcpusFlags(flags uint32) (int32, error) {
	result := C.virDomainGetVcpusFlags(d.ptr, C.uint(flags))
	if result == -1 {
		return 0, GetLastError()
	}
	return int32(result), nil
}
Esempio n. 2
0
// VCPUs queries the number of virtual CPUs used by the domain. Note that this
// call may fail if the underlying virtualization hypervisor does not support
// it. This function may require privileged access to the hypervisor.
func (dom Domain) VCPUs(flags DomainVCPUsFlag) (int32, error) {
	dom.log.Println("reading domain VCPUs count...")
	cRet := C.virDomainGetVcpusFlags(dom.virDomain, C.uint(flags))
	ret := int32(cRet)

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

	dom.log.Printf("VCPUs count: %v\n", ret)

	return ret, nil
}