Re: [PATCH 2/3] qemu: Report VIR_DOMAIN_MEMORY_PARAM_UNLIMITED properly

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

 



On Mon, Dec 09, 2013 at 09:22:52AM +0100, Martin Kletzander wrote:
> For dead domains that have no memtune limits, we return 0 instead of
> "unlimited", this patch fixes it to return PARAM_UNLIMITED.
> 
> Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
> ---
>  src/qemu/qemu_driver.c | 25 +++++++++++++------------
>  1 file changed, 13 insertions(+), 12 deletions(-)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 66f2a0e..4b93c02 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -8053,29 +8053,30 @@ qemuDomainGetMemoryParameters(virDomainPtr dom,
>      if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
>          for (i = 0; i < *nparams && i < QEMU_NB_MEM_PARAM; i++) {
>              virMemoryParameterPtr param = &params[i];
> +            unsigned long long value;
> 
>              switch (i) {
>              case 0: /* fill memory hard limit here */
> -                if (virTypedParameterAssign(param,
> -                                            VIR_DOMAIN_MEMORY_HARD_LIMIT,
> -                                            VIR_TYPED_PARAM_ULLONG,
> -                                            persistentDef->mem.hard_limit) < 0)
> +                value = persistentDef->mem.hard_limit;
> +                value = value ? value : VIR_DOMAIN_MEMORY_PARAM_UNLIMITED;
> +                if (virTypedParameterAssign(param, VIR_DOMAIN_MEMORY_HARD_LIMIT,
> +                                            VIR_TYPED_PARAM_ULLONG, value) < 0)
>                      goto cleanup;
>                  break;
> 
>              case 1: /* fill memory soft limit here */
> -                if (virTypedParameterAssign(param,
> -                                            VIR_DOMAIN_MEMORY_SOFT_LIMIT,
> -                                            VIR_TYPED_PARAM_ULLONG,
> -                                            persistentDef->mem.soft_limit) < 0)
> +                value = persistentDef->mem.soft_limit;
> +                value = value ? value : VIR_DOMAIN_MEMORY_PARAM_UNLIMITED;
> +                if (virTypedParameterAssign(param, VIR_DOMAIN_MEMORY_SOFT_LIMIT,
> +                                            VIR_TYPED_PARAM_ULLONG, value) < 0)
>                      goto cleanup;
>                  break;
> 
>              case 2: /* fill swap hard limit here */
> -                if (virTypedParameterAssign(param,
> -                                            VIR_DOMAIN_MEMORY_SWAP_HARD_LIMIT,
> -                                            VIR_TYPED_PARAM_ULLONG,
> -                                            persistentDef->mem.swap_hard_limit) < 0)
> +                value = persistentDef->mem.swap_hard_limit;
> +                value = value ? value : VIR_DOMAIN_MEMORY_PARAM_UNLIMITED;
> +                if (virTypedParameterAssign(param, VIR_DOMAIN_MEMORY_SWAP_HARD_LIMIT,
> +                                            VIR_TYPED_PARAM_ULLONG, value) < 0)
>                      goto cleanup;
>                  break;

Ok, so when setting cgroups limits, we treat '0' as meaning leave the
cgroup setting on its default, which is unlimited.

ACK

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
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]