[libvirt] [PATCH v4 12/13] Adding memtune command to virsh tool

Eric Blake eblake at redhat.com
Tue Oct 19 16:38:15 UTC 2010


On 10/08/2010 06:16 AM, Nikunj A. Dadhania wrote:
> +static int
> +cmdMemtune(vshControl *ctl, const vshCmd *cmd)
> +{
> +    virDomainPtr dom;
> +    int hard_limit, soft_limit, swap_hard_limit;

This is inherently limited to 32 bits.

> +    hard_limit = vshCommandOptInt(cmd, VIR_DOMAIN_MEMORY_HARD_LIMIT,&hard_limit);

You should instead be using vshCommandOptLongLong, and larger types,

> +    } else {
> +        /* set the memory parameters */
> +        params = vshMalloc(ctl, sizeof(virMemoryParameter)* nparams);
> +
> +        memset(params, 0, sizeof(virMemoryParameter)* nparams);
> +        for(i = 0; i<  nparams; i++)
> +        {
> +            temp =&params[i];
> +            temp->type = VIR_DOMAIN_MEMORY_FIELD_ULLONG;

to match the fact that you claim to be passing a long long.

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




More information about the libvir-list mailing list