Revised to use global constants

This commit is contained in:
tengqm 2015-01-02 17:32:33 +08:00
parent a681931023
commit b4e19d8a9a
2 changed files with 37 additions and 3 deletions

View File

@ -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'

View File

@ -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 = [