Merge "Fix a bug in scaleutils.truncate_desired"

This commit is contained in:
Jenkins 2015-05-25 09:23:14 +00:00 committed by Gerrit Code Review
commit 61ff14243e
1 changed files with 4 additions and 3 deletions

View File

@ -57,17 +57,18 @@ def truncate_desired(cluster, desired, min_size, max_size):
LOG.debug(_("Truncating shrinkage to specified min_size (%s).")
% desired)
if desired < cluster.min_size:
if min_size is None and desired < cluster.min_size:
desired = cluster.min_size
LOG.debug(_("Truncating shrinkage to cluster's min_size (%s).")
% desired)
if (max_size is not None and max_size > 0 and desired > max_size):
if max_size is not None and max_size > 0 and desired > max_size:
desired = max_size
LOG.debug(_("Truncating growth to specified max_size (%s).")
% desired)
if desired > cluster.max_size and cluster.max_size > 0:
if (max_size is None and desired > cluster.max_size and
cluster.max_size > 0):
desired = cluster.max_size
LOG.debug(_("Truncating growth to cluster's max_size (%s).")
% desired)