[libvirt] [PATCH] memtune: Let virsh know the unlimited value for memory tunables

Eric Blake eblake at redhat.com
Mon Jan 10 19:02:36 UTC 2011


On 01/07/2011 12:09 AM, Nikunj A. Dadhania wrote:
> From: Nikunj A. Dadhania <nikunj at linux.vnet.ibm.com>
> 
> Display unlimited when the memory cgroup settings says so. Unlimited is
> represented by INT64_MAX in memory cgroup.
> 
> Signed-off-by: Nikunj A. Dadhania <nikunj at linux.vnet.ibm.com>
> Reported-by: Justin Clift <jclift at redhat.com>
> ---
>  tools/virsh.c |   10 ++++++++--
>  1 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/virsh.c b/tools/virsh.c
> index 55e2a68..bee875c 100644
> --- a/tools/virsh.c
> +++ b/tools/virsh.c
> @@ -2987,9 +2987,15 @@ cmdMemtune(vshControl * ctl, const vshCmd * cmd)
>                               params[i].value.l);
>                      break;
>                  case VIR_DOMAIN_MEMORY_PARAM_ULLONG:
> -                    vshPrint(ctl, "%-15s: %llu\n", params[i].field,
> -                             params[i].value.ul);
> +                {
> +                    unsigned long long max_kbytes = INT64_MAX >> 10;

Yuck - why do the clients have to know the magic value?  Why not patch
the source to actually return INT64_MAX rather than INT64_MAX>>10 when
returning unlimited?

Actually, due to the issue of cross-versioning between virsh and the
actual libvirt running, we may have to check for both values.  But even
having a constant (VIR_DOMAIN_MEMORY_PARAM_UNLIMITED) rather than making
guests recompute things might be nice.

But overall, I like the idea of this patch.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110110/80eb012f/attachment-0001.sig>


More information about the libvir-list mailing list