def register_cluster(self, ctx, cluster_id, check_type, interval=None, params=None): """Register cluster for health checking. :param ctx: The context of notify request. :param cluster_id: The ID of the cluster to be checked. :param check_type: A string indicating the type of checks. :param interval: An optional integer indicating the length of checking periods in seconds. :param \*\*params: Other parameters for the health check. :return: None """ params = params or {} registry = db_api.registry_create(ctx, cluster_id, check_type, interval, params, self.engine_id) timer = None if check_type == 'NODE_STATUS_POLLING': real_interval = min(interval, self.periodic_interval_max) timer = self.TG.add_timer(real_interval, self._periodic_check, None, cluster_id) reg_cap = { 'cluster_id': registry.cluster_id, 'check_type': registry.check_type, 'interval': registry.interval, 'params': registry.params, 'timer': timer } self.rt['registries'].append(reg_cap)
def register_cluster(self, ctx, cluster_id, check_type, interval=None, params=None): r"""Register cluster for health checking. :param ctx: The context of notify request. :param cluster_id: The ID of the cluster to be checked. :param check_type: A string indicating the type of checks. :param interval: An optional integer indicating the length of checking periods in seconds. :param \*\*params: Other parameters for the health check. :return: None """ params = params or {} registry = db_api.registry_create(ctx, cluster_id, check_type, interval, params, self.engine_id) entry = { 'cluster_id': registry.cluster_id, 'check_type': registry.check_type, 'interval': registry.interval, 'params': registry.params, } self._start_check(entry) self.rt['registries'].append(entry)
def create(cls, context, cluster_id, check_type, interval, params, engine_id, enabled=True): obj = db_api.registry_create(context, cluster_id, check_type, interval, params, engine_id, enabled=enabled) return cls._from_db_object(context, cls(), obj)
def create(cls, context, cluster_id, check_type, interval, params, engine_id): obj = db_api.registry_create(context, cluster_id, check_type, interval, params, engine_id) return cls._from_db_object(context, cls(context), obj)