On Mon, Jun 20, 2016 at 04:34:17PM +0200, Peter Krempa wrote:
To allow finer-grained control of vcpu state using guest agent this
API
can be used to individually set the state of the vCPU.
This will allow to better control NUMA enabled guests and/or test
various vCPU configurations.
---
[...]
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index 0971a96..11f20af 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -11891,3 +11891,52 @@ virDomainGetGuestVcpus(virDomainPtr domain,
virDispatchError(domain->conn);
return -1;
}
+
+
+/**
+ * virDomainSetGuestVcpus:
+ * @domain: pointer to domain object
+ * @cpumap: text representation of a bitmap of vcpus to set
+ * @state: 0 to disable/1 to enable cpus described by @cpumap
+ * @flags: currently unused, callers shall pass 0
+ *
+ * Sets state of individual vcpus described by @cpumap via guest agent. Other
+ * vcpus are not modified.
It would be worth documenting how the bitmap should looks like as we do in
virsh. This is a new bitmap representation in our APIs. And also add a
reference to this description in the virDomainGetGuestVcpus API.
+ *
+ * This API requires the VM to run. Various hypervisors or guest agent
+ * implementation may limit to operate on just 1 vCPU per call.
+ *
+ * Note that OSes (notably Linux) may require vCPU 0 to stay online to support
+ * low-level features a S3 sleep.
+ *
+ * Returns 0 on success, -1 on error.
+ */