func (d *VirDomain) SetVcpusFlags(vcpu uint16, flags uint) error { result := C.virDomainSetVcpusFlags(d.ptr, C.uint(vcpu), C.uint(flags)) if result == -1 { return GetLastError() } return nil }
func (d *Domain) SetVcpus(vcpus uint8, flags uint16) error { result := C.virDomainSetVcpusFlags(d.cptr, C.uint(vcpus), C.uint(flags)) if result == -1 { return GetLastError() } return nil }
// SetVCPUs dynamically changes the number of virtual CPUs used by the domain. // Note that this call may fail if the underlying virtualization hypervisor // does not support it or if growing the number is arbitrary limited. This // function may require privileged access to the hypervisor. func (dom Domain) SetVCPUs(vcpus uint32, flags DomainVCPUsFlag) error { dom.log.Printf("changing domain VCPUs count to %v (flags = %v)...\n", vcpus, flags) cRet := C.virDomainSetVcpusFlags(dom.virDomain, C.uint(vcpus), C.uint(flags)) ret := int32(cRet) if ret == -1 { err := LastError() dom.log.Printf("an error occurred: %v\n", err) return err } dom.log.Println("VCPUs count changed") return nil }