Add debug logs to server_group_affinity_constraint
This adds a couple of debug logs for debuging convenience. Change-Id: I5859366b8dc8ddc138a767c78013f36a5d7b323c
This commit is contained in:
@@ -13,8 +13,12 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
from oslo_log import log as logging
|
||||||
|
|
||||||
from nova_solverscheduler.scheduler.solvers import constraints
|
from nova_solverscheduler.scheduler.solvers import constraints
|
||||||
|
|
||||||
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class ServerGroupAffinityConstraint(constraints.BaseLinearConstraint):
|
class ServerGroupAffinityConstraint(constraints.BaseLinearConstraint):
|
||||||
"""Force to select hosts which host given server group."""
|
"""Force to select hosts which host given server group."""
|
||||||
@@ -36,6 +40,9 @@ class ServerGroupAffinityConstraint(constraints.BaseLinearConstraint):
|
|||||||
|
|
||||||
group_hosts = filter_properties.get('group_hosts')
|
group_hosts = filter_properties.get('group_hosts')
|
||||||
|
|
||||||
|
LOG.debug('Group hosts: %(hosts)s.',
|
||||||
|
{'hosts': ', '.join(group_hosts)})
|
||||||
|
|
||||||
if not group_hosts:
|
if not group_hosts:
|
||||||
constraint_matrix = [
|
constraint_matrix = [
|
||||||
([False for j in xrange(num_instances - 1)] + [True])
|
([False for j in xrange(num_instances - 1)] + [True])
|
||||||
@@ -45,6 +52,9 @@ class ServerGroupAffinityConstraint(constraints.BaseLinearConstraint):
|
|||||||
if hosts[i].host not in group_hosts:
|
if hosts[i].host not in group_hosts:
|
||||||
constraint_matrix[i] = [False for
|
constraint_matrix[i] = [False for
|
||||||
j in xrange(num_instances)]
|
j in xrange(num_instances)]
|
||||||
|
else:
|
||||||
|
LOG.debug('%(host)s is in group hosts.',
|
||||||
|
{'host': hosts[i].host})
|
||||||
|
|
||||||
return constraint_matrix
|
return constraint_matrix
|
||||||
|
|
||||||
@@ -70,9 +80,14 @@ class ServerGroupAntiAffinityConstraint(constraints.BaseLinearConstraint):
|
|||||||
|
|
||||||
group_hosts = filter_properties.get('group_hosts')
|
group_hosts = filter_properties.get('group_hosts')
|
||||||
|
|
||||||
|
LOG.debug('Group hosts: %(hosts)s.',
|
||||||
|
{'hosts': ', '.join(group_hosts)})
|
||||||
|
|
||||||
for i in xrange(num_hosts):
|
for i in xrange(num_hosts):
|
||||||
if hosts[i].host in group_hosts:
|
if hosts[i].host in group_hosts:
|
||||||
constraint_matrix[i] = [False for j in xrange(num_instances)]
|
constraint_matrix[i] = [False for j in xrange(num_instances)]
|
||||||
|
LOG.debug('%(host)s is in group hosts.',
|
||||||
|
{'host': hosts[i].host})
|
||||||
else:
|
else:
|
||||||
constraint_matrix[i] = ([True] + [False for
|
constraint_matrix[i] = ([True] + [False for
|
||||||
j in xrange(num_instances - 1)])
|
j in xrange(num_instances - 1)])
|
||||||
|
|||||||
Reference in New Issue
Block a user