Changing the minval/maxval attribute to the minimum/maxium of every
weigher run changes the outcome of future runs. We noticed it in the
SoftAffinityWeigher, where a previous run with a host hosting a lot of
instances for a server-group would make a later run use that maximum.
This resulted in the weight being lower than 1 for a host hosting all
instances of another server-group, if the number of instances of that
server-group on that host is less than a previous server-group's
instances on any host.
Previously, there were two places that computed the maxval/minval - once
in normalize() and once in weigh_objects() - but only the one in
weigh_objects() saved the values to the weigher.
The code now uses the maxval/minval as defined by the weigher and keeps
the weights inside the maxval-minval range. There's also only one place
to compute the minval/maxval now, if the weigher did not set a value:
normalize().
Reviewed: https:/ /review. opendev. org/713863 /git.openstack. org/cgit/ openstack/ nova/commit/ ?id=5ab9ef11e27 014ce8b43e1bac7 6903fed70d0fbf
Committed: https:/
Submitter: Zuul
Branch: master
commit 5ab9ef11e27014c e8b43e1bac76903 fed70d0fbf
Author: Johannes Kulik <email address hidden>
Date: Thu Mar 19 12:51:25 2020 +0100
Don't recompute weighers' minval/maxval attributes
Changing the minval/maxval attribute to the minimum/maxium of every yWeigher, where a previous run with a host hosting a lot of
weigher run changes the outcome of future runs. We noticed it in the
SoftAffinit
instances for a server-group would make a later run use that maximum.
This resulted in the weight being lower than 1 for a host hosting all
instances of another server-group, if the number of instances of that
server-group on that host is less than a previous server-group's
instances on any host.
Previously, there were two places that computed the maxval/minval - once
in normalize() and once in weigh_objects() - but only the one in
weigh_objects() saved the values to the weigher.
The code now uses the maxval/minval as defined by the weigher and keeps
the weights inside the maxval-minval range. There's also only one place
to compute the minval/maxval now, if the weigher did not set a value:
normalize().
Closes-Bug: 1870096
Change-Id: I60a90dabcd21b4 e049e218c7c55fa 075bb7ff933