Adds Initial Logging Support

Previously, logging was hard coded into the nova and neutron
containers. This patch creates two common params for logging:

DEBUG_LOGGING
VERBOSE_LOGGING

and sets default values of verbose=true and debug=false. This patch
implements logging for Nova and Neutron. Add'l OS service config
scripts and images will need to be updated to use the logging
params.

Change-Id: I03d48005d5b4789aa3c519879a20d963ef1cbaa3
This commit is contained in:
Daneyon Hansen 2015-04-01 18:38:46 +00:00
parent 5ea37557cf
commit 0b671ad58d
15 changed files with 134 additions and 15 deletions

View File

@ -9,9 +9,16 @@ set -e
: ${DHCP_DRIVER:=neutron.agent.linux.dhcp.Dnsmasq}
: ${USE_NAMESPACES:=false}
check_required_vars VERBOSE_LOGGING DEBUG_LOGGING
check_required_vars VERBOSE_LOGGING DEBUG_LOGGING NEUTRON_DHCP_AGENT_LOG_FILE
cfg=/etc/neutron/dhcp_agent.ini
neutron_conf=/etc/neutron/neutron.conf
# Logging
crudini --set $neutron_conf \
DEFAULT \
log_file \
"${NEUTRON_DHCP_AGENT_LOG_FILE}"
# Configure dhcp_agent.ini
crudini --set $cfg \

View File

@ -8,9 +8,16 @@ set -e
: ${INTERFACE_DRIVER:=neutron.agent.linux.interface.BridgeInterfaceDriver}
: ${USE_NAMESPACES:=false}
check_required_vars VERBOSE_LOGGING DEBUG_LOGGING
check_required_vars VERBOSE_LOGGING DEBUG_LOGGING NEUTRON_L3_AGENT_LOG_FILE
cfg=/etc/neutron/l3_agent.ini
neutron_conf=/etc/neutron/neutron.conf
# Logging
crudini --set $neutron_conf \
DEFAULT \
log_file \
"${NEUTRON_L3_AGENT_LOG_FILE}"
# Configure l3_agent.ini
crudini --set $cfg \

View File

@ -8,9 +8,16 @@ set -e
: ${NEUTRON_FLAT_NETWORK_NAME:=physnet1}
: ${NEUTRON_FLAT_NETWORK_INTERFACE:=eth1}
check_required_vars PUBLIC_IP
check_required_vars PUBLIC_IP NEUTRON_LINUXBRIDGE_AGENT_LOG_FILE
cfg=/etc/neutron/plugins/ml2/ml2_conf.ini
neutron_conf=/etc/neutron/neutron.conf
# Logging
crudini --set $neutron_conf \
DEFAULT \
log_file \
"${NEUTRON_LINUXBRIDGE_AGENT_LOG_FILE}"
# Configure ml2_conf.ini
crudini --set $cfg \

View File

@ -10,9 +10,17 @@ set -e
check_required_vars VERBOSE_LOGGING DEBUG_LOGGING KEYSTONE_AUTH_PROTOCOL \
KEYSTONE_PUBLIC_SERVICE_HOST ADMIN_TENANT_NAME \
NEUTRON_KEYSTONE_USER NEUTRON_KEYSTONE_PASSWORD \
NEUTRON_SHARED_SECRET NOVA_API_SERVICE_HOST
NEUTRON_SHARED_SECRET NOVA_API_SERVICE_HOST \
NEUTRON_METADATA_AGENT_LOG_FILE
cfg=/etc/neutron/metadata_agent.ini
neutron_conf=/etc/neutron/neutron.conf
# Logging
crudini --set $neutron_conf \
DEFAULT \
log_file \
"${NEUTRON_METADATA_AGENT_LOG_FILE}"
# Configure metadata_agent.ini
crudini --set $cfg \

View File

@ -15,7 +15,7 @@ set -e
: ${VERBOSE_LOGGING:=true}
: ${DEBUG_LOGGING:=false}
check_required_vars NEUTRON_KEYSTONE_PASSWORD \
check_required_vars NEUTRON_KEYSTONE_PASSWORD NEUTRON_LOG_DIR \
KEYSTONE_PUBLIC_SERVICE_HOST RABBITMQ_SERVICE_HOST
dump_vars
@ -34,7 +34,7 @@ ml2_cfg=/etc/neutron/plugins/ml2/ml2_conf.ini
crudini --set $core_cfg \
DEFAULT \
log_dir \
"/var/log/neutron"
"${NEUTRON_LOG_DIR}"
crudini --set $core_cfg \
DEFAULT \
verbose \

View File

@ -10,7 +10,7 @@ check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_ADMIN_SERVICE_HOST \
NOVA_ADMIN_PASSWORD NEUTRON_DB_NAME NEUTRON_DB_USER \
NEUTRON_KEYSTONE_USER NEUTRON_KEYSTONE_PASSWORD \
ADMIN_TENANT_NAME NEUTRON_SERVER_SERVICE_HOST \
PUBLIC_IP NEUTRON_DB_PASSWORD
PUBLIC_IP NEUTRON_DB_PASSWORD NEUTRON_SERVER_LOG_FILE
fail_unless_os_service_running keystone
fail_unless_db
@ -35,6 +35,12 @@ crux endpoint-create -n neutron -t network \
-P "${KEYSTONE_AUTH_PROTOCOL}://${PUBLIC_IP}:9696" \
-A "${KEYSTONE_AUTH_PROTOCOL}://${NEUTRON_SERVER_SERVICE_HOST}:9696"
# Logging
crudini --set /etc/neutron/neutron.conf \
DEFAULT \
log_file \
"${NEUTRON_SERVER_LOG_FILE}"
# Database
crudini --set /etc/neutron/neutron.conf \
database \

View File

@ -18,7 +18,8 @@
check_required_vars KEYSTONE_ADMIN_TOKEN NOVA_DB_PASSWORD \
RABBITMQ_SERVICE_HOST GLANCE_API_SERVICE_HOST \
KEYSTONE_PUBLIC_SERVICE_HOST PUBLIC_IP \
PUBLIC_INTERFACE FLAT_INTERFACE
PUBLIC_INTERFACE FLAT_INTERFACE DEBUG_LOGGING \
VERBOSE_LOGGING NOVA_LOG_DIR
cfg=/etc/nova/nova.conf
@ -60,10 +61,11 @@ crudini --set $cfg DEFAULT volume_api_class nova.volume.cinder.API
crudini --set $cfg DEFAULT image_service nova.image.glance.GlanceImageService
crudini --set $cfg DEFAULT osapi_volume_listen 0.0.0.0
# configure logging to stderr
crudini --del $cfg DEFAULT log_dir
crudini --set $cfg DEFAULT log_file ""
crudini --set $cfg DEFAULT use_stderr True
# configure logging
crudini --set $cfg DEFAULT log_dir "${NOVA_LOG_DIR}"
crudini --set $cfg DEFAULT debug "${DEBUG_LOGGING}"
crudini --set $cfg DEFAULT verbose "${VERBOSE_LOGGING}"
crudini --set $cfg DEFAULT admin_token "${KEYSTONE_ADMIN_TOKEN}"
crudini --set $cfg conductor workers 8

View File

@ -5,6 +5,11 @@
cfg=/etc/nova/nova.conf
check_required_vars NOVA_COMPUTE_LOG_FILE
# configure logging
crudini --set $cfg DEFAULT log_file "${NOVA_COMPUTE_LOG_FILE}"
# set qmeu emulation if no hardware acceleration found
if [[ `egrep -c '(vmx|svm)' /proc/cpuinfo` == 0 ]]
then

View File

@ -2,6 +2,13 @@
. /opt/kolla/config-nova.sh
check_required_vars NOVA_NETWORK_LOG_FILE
cfg=/etc/nova/nova.conf
# configure logging
crudini --set $cfg DEFAULT log_file "${NOVA_NETWORK_LOG_FILE}"
# Configure eth1 as a physcial interface for nova flat network
cat > /etc/sysconfig/network-scripts/ifcfg-$FLAT_INTERFACE <<EOF
DEVICE="$FLAT_INTERFACE"

View File

@ -7,13 +7,19 @@ set -e
check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_ADMIN_SERVICE_HOST \
NOVA_KEYSTONE_USER NOVA_KEYSTONE_PASSWORD \
ADMIN_TENANT_NAME NOVA_API_SERVICE_HOST \
NOVA_EC2_API_SERVICE_HOST PUBLIC_IP NOVA_DB_NAME
NOVA_EC2_API_SERVICE_HOST PUBLIC_IP NOVA_DB_NAME \
NOVA_API_LOG_FILE
fail_unless_os_service_running keystone
fail_unless_db $NOVA_DB_NAME
export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}"
export SERVICE_ENDPOINT="http://${KEYSTONE_ADMIN_SERVICE_HOST}:35357/v2.0"
cfg=/etc/nova/nova.conf
# configure logging
crudini --set $cfg DEFAULT log_file "${NOVA_API_LOG_FILE}"
crux user-create --update \
-n "${NOVA_KEYSTONE_USER}" \
-p "${NOVA_KEYSTONE_PASSWORD}" \

View File

@ -4,9 +4,15 @@ set -e
. /opt/kolla/config-nova.sh
check_required_vars NOVA_DB_NAME NOVA_DB_USER NOVA_DB_PASSWORD
check_required_vars NOVA_DB_NAME NOVA_DB_USER NOVA_DB_PASSWORD \
NOVA_CONDUCTOR_LOG_FILE
fail_unless_db
cfg=/etc/nova/nova.conf
# configure logging
crudini --set $cfg DEFAULT log_file "${NOVA_CONDUCTOR_LOG_FILE}"
mysql -h ${MARIADB_SERVICE_HOST} -u root \
-p${DB_ROOT_PASSWORD} mysql <<EOF
CREATE DATABASE IF NOT EXISTS ${NOVA_DB_NAME};

View File

@ -4,7 +4,12 @@ set -e
. /opt/kolla/config-nova.sh
check_required_vars NOVA_DB_NAME
check_required_vars NOVA_DB_NAME NOVA_SCHEDULER_LOG_FILE
fail_unless_db $NOVA_DB_NAME
cfg=/etc/nova/nova.conf
# configure logging
crudini --set $cfg DEFAULT log_file "${NOVA_SCHEDULER_LOG_FILE}"
exec /usr/bin/nova-scheduler

View File

@ -41,6 +41,18 @@ all containers. This allows a simple method of ensuring every type of node
### Environment Variable KEY/VALUE pairs
DEBUG_LOGGING=<true|false> - Defaults to false. Enable/disable debug level logging for all OpenStack services.
VERBOSE_LOGGING=<true|false> - Defaults to true. Enable/disable verbose level logging for all OpenStack services.
NOVA_LOG_DIR=<none> - Defaults to none. The base directory used for relative Nova --log-file paths.
NEUTRON_LOG_DIR<none> - Defaults to none. The base directory used for relative Neutron --log-file paths.
NOVA_API_LOG_FILE=<none> Defaults to none. Name of Nova API log file to output to. If no default is set, logging will go to stdout.
NOVA_CONDUCTOR_LOG_FILE=<none> Defaults to none. Name of Nova Conductor log file to output to. If no default is set, logging will go to stdout.
NOVA_SCHEDULER_LOG_FILE=<none> Defaults to none. Name of Nova Scheduler log file to output to. If no default is set, logging will go to stdout.
NOVA_COMPUTE_LOG_FILE=<none> Defaults to none. Name of Nova Compute log file to output to. If no default is set, logging will go to stdout.
NEUTRON_SERVER_LOG_FILE=<none> Defaults to none. Name of Neutron Server log file to output to. If no default is set, logging will go to stdout.
NEUTRON_L3_AGENT_LOG_FILE=<none> Defaults to none. Name of Neutron L3 Agent log file to output to. If no default is set, logging will go to stdout.
NEUTRON_LINUXBRIDGE_AGENT_LOG_FILE=<none> Defaults to none. Name of Neutron Linux Bridge Agent log file to output to. If no default is set, logging will go to stdout.
NEUTRON_METADATA_AGENT_LOG_FILE=<none> Defaults to none. Name of Neutron Metadata Agent log file to output to. If no default is set, logging will go to stdout.
ADMIN_USER_PASSWORD=<steakfordinner> - The admin user password
ADMIN_TENANT_NAME=<admin> - tenant name
FLAT_INTERFACE=<eth1> - nova networking flat interface device name

View File

@ -2,6 +2,21 @@
In order for each service to function, there is a minimum set of required variables that need to be plugged into the environment. Below is the list of variables that is needed for each service to run in a minimal setting.
# Logging
DEBUG_LOGGING
VERBOSE_LOGGING
NOVA_LOG_DIR
NEUTRON_LOG_DIR
NOVA_API_LOG_FILE
NOVA_CONDUCTOR_LOG_FILE
NOVA_SCHEDULER_LOG_FILE
NOVA_COMPUTE_LOG_FILE
NEUTRON_SERVER_LOG_FILE
NEUTRON_L3_AGENT_LOG_FILE
NEUTRON_LINUXBRIDGE_AGENT_LOG_FILE
NEUTRON_METADATA_AGENT_LOG_FILE
# Mariadb
MARIADB_SERVICE_HOST

View File

@ -31,6 +31,20 @@ PASSWORD=12345
ADMIN_TENANT_NAME=admin
PUBLIC_IP=$HOST_IP
# Logging
DEBUG_LOGGING=false
VERBOSE_LOGGING=true
NOVA_LOG_DIR=
NEUTRON_LOG_DIR=
NOVA_API_LOG_FILE=
NOVA_CONDUCTOR_LOG_FILE=
NOVA_SCHEDULER_LOG_FILE=
NOVA_COMPUTE_LOG_FILE=
NEUTRON_SERVER_LOG_FILE=
NEUTRON_L3_AGENT_LOG_FILE=
NEUTRON_LINUXBRIDGE_AGENT_LOG_FILE=
NEUTRON_METADATA_AGENT_LOG_FILE=
# RabbitMQ
RABBITMQ_SERVICE_HOST=$HOST_IP
RABBIT_USER=guest
@ -86,6 +100,18 @@ export OS_TENANT_NAME=$ADMIN_TENANT_NAME
EOF
cat > ./compose/openstack.env <<EOF
DEBUG_LOGGING=$DEBUG_LOGGING
VERBOSE_LOGGING=$VERBOSE_LOGGING
NOVA_LOG_DIR=$NOVA_LOG_DIR
NEUTRON_LOG_DIR=$NEUTRON_LOG_DIR
NOVA_API_LOG_FILE=$NOVA_API_LOG_FILE
NOVA_CONDUCTOR_LOG_FILE=$NOVA_CONDUCTOR_LOG_FILE
NOVA_SCHEDULER_LOG_FILE=$NOVA_SCHEDULER_LOG_FILE
NOVA_COMPUTE_LOG_FILE=$NOVA_COMPUTE_LOG_FILE
NEUTRON_SERVER_LOG_FILE=$NEUTRON_SERVER_LOG_FILE
NEUTRON_L3_AGENT_LOG_FILE=$NEUTRON_L3_AGENT_LOG_FILE
NEUTRON_LINUXBRIDGE_AGENT_LOG_FILE=$NEUTRON_LINUXBRIDGE_AGENT_LOG_FILE
NEUTRON_METADATA_AGENT_LOG_FILE=$NEUTRON_METADATA_AGENT_LOG_FILE
ADMIN_USER_PASSWORD=$ADMIN_USER_PASSWORD
ADMIN_TENANT_NAME=$ADMIN_TENANT_NAME
CONFIG_NETWORK=$CONFIG_NETWORK