9998a65 domain: fix parsing of memory tunables on 32-bit machines

Authored and Committed by ericb 9 years ago
    domain: fix parsing of memory tunables on 32-bit machines
    
    Commit 6c9a8a4 (Oct 2014) exposed a long-standing issue on 32-bit
    machines: code related to virDomainSetMemoryParameters has always
    been documented as using a 64-bit limit, but it was implemented by
    calling virDomainParseMemory which enforced an 'unsigned long'
    limit.  Since VIR_DOMAIN_MEMORY_PARAM_UNLIMITED capped to a
    long is -1, but virDomainParseScaledValue no longer accepts
    negative values, an attempt to use 2^53-1 as a hard memory limit
    started failing the testsuite.  However, the problem with capping
    things artificially low has existed for much longer - ever since
    commits 4888f0fb and 2e22f23 (Mar 2012) switched internal tracking
    from 'unsigned long' to 'unsigned long long' (prior to that time,
    the cap was a side-effect of the choice of types).  We _have_ to
    cap the balloon memory values, (no thanks to baked in 'unsigned long'
    of API such as virDomainSetMaxMemory or virDomainGetInfo with no
    counterpart API that guarantees 64-bit access to those numbers)
    but memory parameters have never needed the artificial limit.
    
    At any rate, the solution is to make the parser function gain a
    parameter, and only do the reduced 32-bit cap for the values that
    are constrained due to API.
    
    * src/conf/domain_conf.h (_virDomainMemtune): Add comments.
    * src/conf/domain_conf.c (virDomainParseMemory): Add parameter.
    (virDomainDefParseXML): Adjust callers.
    
    Signed-off-by: Eric Blake <eblake@redhat.com>
    
        
file modified
+14 -10
file modified
+8 -6