'Creates data for CloudWatch and WaitConditions.
This could be used by CloudWatch and WaitConditions
and treat HA service events like any other CloudWatch.'

@context.request_context
def create_watch_data(self, cnxt, watch_name, stats_data):

    def get_matching_watches():
        if watch_name:
            (yield watchrule.WatchRule.load(cnxt, watch_name))
        else:
            for wr in watch_rule.WatchRule.get_all(cnxt):
                if watchrule.rule_can_use_sample(wr, stats_data):
                    (yield watchrule.WatchRule.load(cnxt, watch=wr))
    rule_run = False
    for rule in get_matching_watches():
        rule.create_watch_data(stats_data)
        rule_run = True
    if (not rule_run):
        if (watch_name is None):
            watch_name = 'Unknown'
        raise exception.EntityNotFound(entity='Watch    Rule', name=watch_name)
    return stats_data
