Hypervisors are starting to support hot-(un)plugging of specific vcpus.
This adds more flexibility for the management tools to decide which CPU
should be added or removed.
Libvirt's API in current state does not allow to choose arbitrary vCPU
id's for the new vCPU's and does not support removing arbitrary vCPUs
either.
I propose a following API to enable working with specific vCPUs:
/**
* virDomainAddVcpu:
* @domain: pointer to domain object
* @vcpu: ID of the vcpu socket to plug the virtual CPU to
* @flags: bitwise-OR of virDomainModificationImpact
*
* Dynamicaly add a CPU to the domain. Attach the cpu to the ID specified
* by @vcpu. Note that this call may fail if the underlying virtualization
* hypervisor does not support adding cpu's with specific ID or if maximum
* number of CPUs is arbitrary limited.
*
* The @vcpu parameter identifies the vcpu ID the new vcpu should be
attached
* to. If -1 is specified, the new cpu is added to the first available ID.
*
* @flags may include VIR_DOMAIN_AFFECT_LIVE to affect a running
* domain (which may fail if domain is not active), or
* VIR_DOMAIN_AFFECT_CONFIG to affect the next boot via the XML
* description of the domain. Both flags may be set.
* If neither flag is specified (that is, @flags is
VIR_DOMAIN_AFFECT_CURRENT),
* then an inactive domain modifies persistent setup, while an active
domain
* is hypervisor-dependent on whether just live or both live and persistent
* state is changed.
*
* Returns 0 in case of success, -1 in case of failure.
*/
int
virDomainAddVcpu(virDomainPtr domain,
int vcpu,
unsigned int flags)
/**
* virDomainRemoveVcpu:
* @domain: pointer to domain object
* @vcpu: ID of the vcpu socket to plug the virtual CPU to
* @flags: bitwise-OR of virDomainModificationImpact
*
* Dynamicaly remove a CPU from the domain. Remove the the vcpu with ID
* specified by @vcpu. Note that this call may fail if the underlying
* virtualization hypervisor does not support hot-unplugging vcpus with
* specific ID or vcpus in general.
*
* The @vcpu parameter identifies the vcpu ID that should be removed.
* If -1 is specified, the cpu with the highest ID is removed.
*
* @flags may include VIR_DOMAIN_AFFECT_LIVE to affect a running
* domain (which may fail if domain is not active), or
* VIR_DOMAIN_AFFECT_CONFIG to affect the next boot via the XML
* description of the domain. Both flags may be set.
* If neither flag is specified (that is, @flags is
VIR_DOMAIN_AFFECT_CURRENT),
* then an inactive domain modifies persistent setup, while an active
domain
* is hypervisor-dependent on whether just live or both live and persistent
* state is changed.
*
* Returns 0 in case of success, -1 in case of failure.
*/
int
virDomainRemoveVcpu(virDomainPtr domain,
int vcpu,
unsigned int flags)
What are your thoughts on this?
Thanks
Peter
--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list