diff --git a/senlin/common/senlin_consts.py b/senlin/common/senlin_consts.py new file mode 100644 index 000000000..64c9fe241 --- /dev/null +++ b/senlin/common/senlin_consts.py @@ -0,0 +1,33 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + + +# ACTION PHRASES +CLUSTER_CREATE = 'CLUSTER_CREATE' +CLUSTER_DELETE = 'CLUSTER_DELETE' +CLUSTER_UPDATE = 'CLUSTER_UPDATE' +CLUSTER_ADD_NODES = 'CLUSTER_ADD_NODES' +CLUSTER_DEL_NODES = 'CLUSTER_DEL_NODES' +CLUSTER_SCALE_UP = 'CLUSTER_SCALE_UP' +CLUSTER_SCALE_DOWN = 'CLUSTER_SCALE_DOWN' +CLUSTER_ATTACH_POLICY = 'CLUSTER_ATTACH_POLICY' +CLUSTER_DETACH_POLICY = 'CLUSTER_DETACH_POLICY' + +NODE_CREATE = 'NODE_CREATE' +NODE_DELETE = 'NODE_DELETE' +NODE_UPDATE = 'NODE_UPDATE' +NODE_JOIN_CLUSTER = 'NODE_JOIN_CLUSTER' +NODE_LEAVE_CLUSTER = 'NODE_LEAVE_CLUSTER' + +POLICY_ENABLE = 'POLICY_ENABLE' +POLICY_DISABLE = 'POLICY_DISABLE' +POLICY_UPDATE = 'POLICY_UPDATE' diff --git a/senlin/policies/deletion_policy.py b/senlin/policies/deletion_policy.py index 85f26b14d..296ea18be 100644 --- a/senlin/policies/deletion_policy.py +++ b/senlin/policies/deletion_policy.py @@ -12,6 +12,7 @@ import random +from senlin.common import senlin_consts as consts from senlin.db import api as db_api from senlin.policies import base @@ -30,9 +31,9 @@ class DeletionPolicy(base.Policy): ) TARGET = [ - ('WHEN', 'CLUSTER_SCALE_DOWN'), - ('AFTER', 'CLUSTER_DEL_NODES'), - ('AFTER', 'CLUSTER_SCALE_DOWN'), + ('WHEN', consts.CLUSTER_SCALE_DOWN), + ('AFTER', consts.CLUSTER_DEL_NODES), + ('AFTER', consts.CLUSTER_SCALE_DOWN), ] PROFILE_TYPE = [