Re: [libvirt] [PATCH 08/27] Add API for issuing 'balloon' monitor command

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

 



On Thu, 2009-09-24 at 16:00 +0100, Daniel P. Berrange wrote:
> * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add new
>   qemuMonitorSetBalloon() based on existing code in
>   qemudDomainSetMemoryBalloon
> * src/qemu/qemu_driver.c: Remove use of qemudDomainSetMemoryBalloon()
>   in favour of qemuMonitorSetBalloon(). Fix error code when balloon
>   is not supported
> ---
>  src/qemu/qemu_driver.c       |   56 ++++-------------------------------------
>  src/qemu/qemu_monitor_text.c |   47 +++++++++++++++++++++++++++++++++++
>  src/qemu/qemu_monitor_text.h |    2 +
>  3 files changed, 55 insertions(+), 50 deletions(-)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 8d3c9b6..a0b5e49 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
...
> @@ -3066,10 +3019,13 @@ static int qemudDomainSetMemory(virDomainPtr dom, unsigned long newmem) {
>      }
>  
>      if (virDomainIsActive(vm)) {
> -        ret = qemudDomainSetMemoryBalloon(dom->conn, vm, newmem);
> -        if (ret == 0)
> +        ret = qemuMonitorSetBalloon(vm, newmem);
> +        /* Turn lack of balloon support into a fatal error */
> +        if (ret == 0) {
>              qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
>                               "%s", _("cannot set memory of an active domain"));
> +            ret = -1;
> +        }

Making this an error condition is new; would have been nice as a
preceeding patch

>      } else {
>          vm->def->memory = newmem;
>          ret = 0;
> diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
> index 2a20db3..be13dce 100644
> --- a/src/qemu/qemu_monitor_text.c
> +++ b/src/qemu/qemu_monitor_text.c
> @@ -551,6 +551,10 @@ error:
>  /* The reply from QEMU contains 'ballon: actual=421' where value is in MB */
>  #define BALLOON_PREFIX "balloon: actual="
>  
> +/*
> + * Returns: 0 if balloon not supported, +1 if balloon query worked
> + * or -1 on failure
> + */
>  int qemuMonitorGetBalloonInfo(const virDomainObjPtr vm,
>                                unsigned long *currmem)
>  {

Should be in previous patch

ACK

Cheers,
Mark.

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]