On Tue, Feb 23, 2016 at 12:49:50PM +0100, 'Klaus Aehlig' via ganeti-devel wrote:
> With the introduction of forthcoming instances, htools will
> consider two memory states: the memory usage now, and the
> future one, when all forthcoming one, when all instances are
> created and started. In particular, it is not necessary,
> and in fact harmful, to reserve the memory of currently down
> instances by subtracting it from the current free memory at
> the IAllocator interface. IAllocators are supposed to take future
> memory usage into account in the same way as they are supposed
> to ensure N+1 redundancy.
> 
> Signed-off-by: Klaus Aehlig <[email protected]>
> Reviewed-by: Brian Foley <[email protected]>
> 
> Cherry-picked-from: eacfdba57f24
> Signed-off-by: Klaus Aehlig <[email protected]>
> ---
>  lib/masterd/iallocator.py | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/masterd/iallocator.py b/lib/masterd/iallocator.py
> index 728a02b..a94d880 100644
> --- a/lib/masterd/iallocator.py
> +++ b/lib/masterd/iallocator.py
> @@ -696,9 +696,9 @@ class IAllocator(object):
>            i_used_mem = int(node_instances_info[node_uuid]
>                             .payload[iinfo.name]["memory"])
>          i_mem_diff = beinfo[constants.BE_MAXMEM] - i_used_mem
> -        mem_free -= max(0, i_mem_diff)
> -
> -        if iinfo.admin_state == constants.ADMINST_UP:
> +        if iinfo.admin_state == constants.ADMINST_UP \
> +            and not iinfo.forthcoming:
> +          mem_free -= max(0, i_mem_diff)
>            i_p_up_mem += beinfo[constants.BE_MAXMEM]
>      return (i_p_mem, i_p_up_mem, mem_free)
>  
LGTM. Thanks.

Reply via email to