Add syslog logging to quantum-ha-tool

Add syslog logging to quantum-ha-tool and direct
any output from the command to /dev/null so we do
not generate output to cron

Change-Id: I225dd90252a4a54b4bdab05a98068ca4e06903f0
This commit is contained in:
Alan Meadows 2013-08-12 14:03:02 -07:00
parent 63cc909530
commit 8ccb4fa063
2 changed files with 7 additions and 2 deletions

View File

@ -22,6 +22,7 @@ import os
import sys
import json
import argparse
from logging.handlers import SysLogHandler
from collections import OrderedDict
from random import choice
from quantumclient.quantum import client
@ -59,6 +60,10 @@ def setup_logging(args):
if args.debug:
level = logging.DEBUG
logging.basicConfig(level=level, format=LOG_FORMAT, date_fmt=LOG_DATE)
handler = SysLogHandler(address = '/dev/log')
syslog_formatter = logging.Formatter('%(name)s: %(levelname)s %(message)s')
handler.setFormatter(syslog_formatter)
LOG.addHandler(handler)
def run(args):

View File

@ -54,11 +54,11 @@ if node["openstack"]["network"]["quantum_ha_cmd_cron"]
cron "quantum-ha-healthcheck" do
minute node["openstack"]["network"]["cron_l3_healthcheck"]
command "sleep #{sleep_time} ; . /root/openrc && #{node["openstack"]["network"]["quantum_ha_cmd"]} --l3-agent-migrate"
command "sleep #{sleep_time} ; . /root/openrc && #{node["openstack"]["network"]["quantum_ha_cmd"]} --l3-agent-migrate > /dev/null 2>&1"
end
cron "quantum-ha-replicate-dhcp" do
minute node["openstack"]["network"]["cron_replicate_dhcp"]
command "sleep #{sleep_time} ; . /root/openrc && #{node["openstack"]["network"]["quantum_ha_cmd"]} --replicate-dhcp"
command "sleep #{sleep_time} ; . /root/openrc && #{node["openstack"]["network"]["quantum_ha_cmd"]} --replicate-dhcp > /dev/null 2>&1"
end
end