memtune: change the way how we store unlimited value

There was a mess in the way how we store unlimited value for memory
limits and how we handled values provided by user.  Internally there
were two possible ways how to store unlimited value: as 0 value or as
VIR_DOMAIN_MEMORY_PARAM_UNLIMITED.  Because we chose to store memory
limits as unsigned long long, we cannot use -1 to represent unlimited.
It's much easier for us to say that everything greater than
VIR_DOMAIN_MEMORY_PARAM_UNLIMITED means unlimited and leave 0 as valid
value despite that it makes no sense to set limit to 0.

Remove unnecessary function virCompareLimitUlong.  The update of test
is to prevent the 0 to be miss-used as unlimited in future.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1146539

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Pavel Hrdina
2015-03-02 20:04:12 +01:00
parent a73395ae66
commit cf521fc8ba
19 changed files with 118 additions and 94 deletions

View File

@@ -798,7 +798,9 @@
for <code>&lt;memory&gt;</code>. For backwards
compatibility, output is always in
KiB. <span class='since'><code>unit</code>
since 0.9.11</span></dd>
since 0.9.11</span>
Possible values for all *_limit parameters are in range from 0 to
VIR_DOMAIN_MEMORY_PARAM_UNLIMITED.</dd>
<dt><code>hard_limit</code></dt>
<dd> The optional <code>hard_limit</code> element is the maximum memory
the guest can use. The units for this value are kibibytes (i.e. blocks