HealthPolicy skeleton for checking
This commit is contained in:
parent
b4e19d8a9a
commit
714cc8ad3e
@ -10,10 +10,11 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from senlin.common import senlin_consts as consts
|
||||
from senlin.policies import base
|
||||
|
||||
|
||||
class HealthPolicy(base.PolicyBase):
|
||||
class HealthPolicy(base.Policy):
|
||||
'''
|
||||
Policy for health checking for members of a cluster.
|
||||
'''
|
||||
@ -29,7 +30,10 @@ class HealthPolicy(base.PolicyBase):
|
||||
)
|
||||
|
||||
TARGET = [
|
||||
('AFTER', 'CLUSTER', 'ADD_MEMBER')
|
||||
('AFTER', consts.CLUSTER_SCALE_UP),
|
||||
('AFTER', consts.CLUSTER_ADD_NODES),
|
||||
('BEFORE', consts.CLUSTER_SCALE_DOWN),
|
||||
('BEFORE', consts.CLUSTER_DEL_NODES),
|
||||
]
|
||||
|
||||
PROFILE_TYPE = [
|
||||
@ -45,12 +49,23 @@ class HealthPolicy(base.PolicyBase):
|
||||
self.check_type = self.spec.get('check_type')
|
||||
|
||||
def pre_op(self, cluster_id, action, **args):
|
||||
pass
|
||||
# Ignore actions that are not required to be processed at this stage
|
||||
if action not in (consts.CLUSTER_SCALE_DOWN,
|
||||
consts.CLUSTER_DEL_NODES):
|
||||
return True
|
||||
|
||||
# TODO(anyone): Unsubscribe nodes from backend health monitoring
|
||||
# infrastructure
|
||||
return True
|
||||
|
||||
def enforce(self, cluster_id, action, **args):
|
||||
pass
|
||||
|
||||
def post_op(self, cluster_id, action, **args):
|
||||
# TODO(Qiming): subscribe to vm-lifecycle-events for the specified VM
|
||||
# or add vm to the list of VM status polling
|
||||
pass
|
||||
# Ignore irrelevant action here
|
||||
if action not in (consts.CLUSTER_SCALE_UP, consts.CLUSTER_ADD_NODES):
|
||||
return True
|
||||
|
||||
# TODO(anyone): subscribe to vm-lifecycle-events for the specified VM
|
||||
# or add vm to the list of VM status polling
|
||||
return True
|
||||
|
Loading…
Reference in New Issue
Block a user