[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 5/7] Introduce flag VIR_DOMAIN_VCPU agent, for agent based CPU unlpug(shutdown).



On 04/15/2013 09:11 AM, Peter Krempa wrote:

Subject line is long, and doesn't match...

> This flag will allow to use qemu guest agent commands to disable processors in a
> live guest.
> ---
>  include/libvirt/libvirt.h.in |  1 +
>  src/libvirt.c                |  7 +++++++
>  tools/virsh-domain.c         | 25 +++++++++++++++++++++++--
>  tools/virsh.pod              | 13 ++++++++++---
>  4 files changed, 41 insertions(+), 5 deletions(-)
> 
> diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
> index 518f0fe..f12173d 100644
> --- a/include/libvirt/libvirt.h.in
> +++ b/include/libvirt/libvirt.h.in
> @@ -2120,6 +2120,7 @@ typedef enum {
> 
>      /* Additionally, these flags may be bitwise-OR'd in.  */
>      VIR_DOMAIN_VCPU_MAXIMUM = (1 << 2), /* Max rather than current count */
> +    VIR_DOMAIN_VCPU_AGENT   = (1 << 3), /* Use guest-agent based cpu hotplug */

...actual flag name.  May I suggest:

API: add VIR_DOMAIN_VCPU_AGENT for agent-based vcpu hotplug

>  } virDomainVcpuFlags;
> 
>  int                     virDomainSetVcpus       (virDomainPtr domain,
> diff --git a/src/libvirt.c b/src/libvirt.c
> index c8728b7..0b780cf 100644
> --- a/src/libvirt.c
> +++ b/src/libvirt.c
> @@ -8887,6 +8887,10 @@ error:
>   * equal to virConnectGetMaxVcpus().  Otherwise, this call affects the
>   * current virtual CPU limit, which must be less than or equal to the
>   * maximum limit.
> + *
> + * If @flags includes VIR_DOMAIN_VCPU_AGENT, then a guest agent is used to
> + * modify the number of processors used by a domain.

I'm assuming that VCPU_AGENT and VCPU_MAXIMUM are mutually exclusive
(the guest cannot increase or decrease the maximum number of vcpus that
the hypervisor uses as its limit); also the flag is useless if not
specified on a running domain.  Probably worth mentioning this in the docs.

> + *
>   * Not all hypervisors can support all flag combinations.
>   *
>   * Returns 0 in case of success, -1 in case of failure.
> @@ -8957,6 +8961,9 @@ error:
>   * virtual CPU limit is queried.  Otherwise, this call queries the
>   * current virtual CPU limit.
>   *
> + * If @flags includes VIR_DOMAIN_VCPU_AGENT, then a guest agent is used to
> + * modify the number of processors used by a domain.

This is under virDomainGetVcpusFlags(), which reads rather than queries
the number of processors.  But here, VCPU_AGENT|MAXIMUM makes sense - a
guest might see a (smaller) maximum of possible vcpus that could still
be hotplugged, in relation to the hypervisor limit.

> + *
>   * Returns the number of vCPUs in case of success, -1 in case of failure.
>   */

You should probably encode any mutual exclusion directly into libvirt.c,
so that hypervisor drivers don't have to repeat the same logic.

But looks like a good start for a useful addition.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]