Commit b3d4f5dd authored by Daniel P. Berrange's avatar Daniel P. Berrange

Add virDomainSetVcpu API binding

Signed-off-by: default avatarDaniel P. Berrange <berrange@redhat.com>
parent a6700791
......@@ -4221,3 +4221,35 @@ func (d *Domain) SetGuestVcpus(cpus []bool, state bool, flags uint32) error {
return nil
}
func (d *Domain) SetVcpu(cpus []bool, state bool, flags uint32) error {
if C.LIBVIR_VERSION_NUMBER < 3001000 {
return GetNotImplementedError()
}
cpumap := ""
for i := 0; i < len(cpus); i++ {
if cpus[i] {
if cpumap == "" {
cpumap = string(i)
} else {
cpumap += "," + string(i)
}
}
}
var cstate C.int
if state {
cstate = 1
} else {
cstate = 0
}
ccpumap := C.CString(cpumap)
defer C.free(unsafe.Pointer(ccpumap))
ret := C.virDomainSetVcpuCompat(d.ptr, ccpumap, cstate, C.uint(flags))
if ret == -1 {
return GetLastError()
}
return nil
}
......@@ -286,5 +286,17 @@ int virDomainSetGuestVcpusCompat(virDomainPtr domain,
#endif
}
int virDomainSetVcpuCompat(virDomainPtr domain,
const char *cpumap,
int state,
unsigned int flags)
{
#if LIBVIR_VERSION_NUMBER < 3001000
assert(0); // Caller should have checked version
#else
return virDomainSetVcpu(domain, cpumap, state, flags);
#endif
}
*/
import "C"
......@@ -843,5 +843,12 @@ int virDomainSetGuestVcpusCompat(virDomainPtr domain,
#define VIR_DOMAIN_TUNABLE_BLKDEV_GROUP_NAME "blkdeviotune.group_name"
#endif
/* 3.1.0 */
int virDomainSetVcpuCompat(virDomainPtr domain,
const char *cpumap,
int state,
unsigned int flags);
#endif /* LIBVIRT_GO_DOMAIN_COMPAT_H__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment