[libvirt] [PATCH] setmem: provide dummy impls for remaining drivers

Matthias Bolte matthias.bolte at googlemail.com
Fri Mar 11 21:50:46 UTC 2011


2011/3/10 Eric Blake <eblake at redhat.com>:
> * src/esx/esx_driver.c (esxDomainSetMemory): Move guts...
> (esxDomainSetMemoryFlags): ...here.
> * src/lxc/lxc_driver.c (lxcDomainSetMemory)
> (lxcDomainSetMemoryFlags): Likewise.
> * src/test/test_driver.c (testSetMemory, testSetMemoryFlags):
> Likewise.
> * src/uml/uml_driver.c (umlDomainSetMemory)
> (umlDomainSetMemoryFlags): Likewise.
> * src/vbox/vbox_tmpl.c (vboxDomainSetMemory)
> (vboxDomainSetMemoryFlags): Likewise.
> * src/xen/xen_driver.c (xenUnifiedDomainSetMemory)
> (xenUnifiedDomainSetMemoryFlags): Likewise.
> ---
>
>> Hmm, for other API additions, I have provided dummy wrappers for the new
>> function anywhere the old function existed, that merely require the same
>> flags as the old function would use.  I'll probably propose that as a
>> followup patch.
>
> Like so.
>
>  src/esx/esx_driver.c   |   17 ++++++++++++++---
>  src/lxc/lxc_driver.c   |   15 +++++++++++++--
>  src/test/test_driver.c |   19 ++++++++++++++++---
>  src/uml/uml_driver.c   |   15 +++++++++++++--
>  src/vbox/vbox_tmpl.c   |   15 +++++++++++++--
>  src/xen/xen_driver.c   |   15 ++++++++++++++-
>  6 files changed, 83 insertions(+), 13 deletions(-)
>
> diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
> index 37e104e..a2d8433 100644
> --- a/src/esx/esx_driver.c
> +++ b/src/esx/esx_driver.c
> @@ -2111,7 +2111,8 @@ esxDomainSetMaxMemory(virDomainPtr domain, unsigned long memory)
>
>
>  static int
> -esxDomainSetMemory(virDomainPtr domain, unsigned long memory)
> +esxDomainSetMemoryFlags(virDomainPtr domain, unsigned long memory,
> +                        unsigned int flags)
>  {
>     int result = -1;
>     esxPrivate *priv = domain->conn->privateData;
> @@ -2121,6 +2122,12 @@ esxDomainSetMemory(virDomainPtr domain, unsigned long memory)
>     esxVI_TaskInfoState taskInfoState;
>     char *taskInfoErrorMessage = NULL;
>
> +    if (flags != VIR_DOMAIN_MEM_LIVE) {
> +        ESX_ERROR(VIR_ERR_INVALID_ARG,
> +                  _("invalid flag combination: (0x%x)"), flags);
> +        return -1;
> +    }
> +

Actually this doesn't match with what ESX really does. There is no
such thing like distinct values for _LIVE and _CONFIG. Changing the
memory value always affects a running domain and is persistent at the
same time.

Matthias




More information about the libvir-list mailing list