update strategy table when parameters_spec changes
At present, In the sync function, there is no check about the parameters_spec field in strategy table, if the parameters_spec field content has changed, Such as increased 'periods' parameter, strategy table will not be updated, the program will run abnormal. exception msg: 2016-12-05 11:11:39.138 TRACE watcher.decision_engine.audit.base raise AttributeError(name) 2016-12-05 11:11:39.138 TRACE watcher.decision_engine.audit.base AttributeError: periods Change-Id: I84709c246acbdf44ccac257b07a74084962bb628 Closes-Bug: #1647521
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
import ast
|
||||||
import collections
|
import collections
|
||||||
|
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
@@ -536,11 +537,14 @@ class Syncer(object):
|
|||||||
def _soft_delete_stale_strategies(self, strategy_map, matching_strategies):
|
def _soft_delete_stale_strategies(self, strategy_map, matching_strategies):
|
||||||
strategy_name = strategy_map.name
|
strategy_name = strategy_map.name
|
||||||
strategy_display_name = strategy_map.display_name
|
strategy_display_name = strategy_map.display_name
|
||||||
|
parameters_spec = strategy_map.parameters_spec
|
||||||
|
|
||||||
stale_strategies = []
|
stale_strategies = []
|
||||||
for matching_strategy in matching_strategies:
|
for matching_strategy in matching_strategies:
|
||||||
if (matching_strategy.display_name == strategy_display_name and
|
if (matching_strategy.display_name == strategy_display_name and
|
||||||
matching_strategy.goal_id not in self.goal_mapping):
|
matching_strategy.goal_id not in self.goal_mapping and
|
||||||
|
matching_strategy.parameters_spec ==
|
||||||
|
ast.literal_eval(parameters_spec)):
|
||||||
LOG.info(_LI("Strategy %s unchanged"), strategy_name)
|
LOG.info(_LI("Strategy %s unchanged"), strategy_name)
|
||||||
else:
|
else:
|
||||||
LOG.info(_LI("Strategy %s modified"), strategy_name)
|
LOG.info(_LI("Strategy %s modified"), strategy_name)
|
||||||
|
|||||||
Reference in New Issue
Block a user