From 0b671ad58d31dc3c3704a35a9ef0c17af0834e72 Mon Sep 17 00:00:00 2001 From: Daneyon Hansen Date: Wed, 1 Apr 2015 18:38:46 +0000 Subject: [PATCH] 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 --- docker/neutron/agents/dhcp/start.sh | 9 ++++++- docker/neutron/agents/l3/start.sh | 9 ++++++- docker/neutron/agents/linux-bridge/start.sh | 9 ++++++- docker/neutron/agents/metadata/start.sh | 10 ++++++- docker/neutron/neutron-base/config-neutron.sh | 4 +-- docker/neutron/neutron-server/start.sh | 8 +++++- docker/nova-base/config-nova.sh | 12 +++++---- .../nova-compute/config-nova-compute.sh | 5 ++++ .../nova-network/config-nova-network.sh | 7 +++++ docker/nova-controller/nova-api/start.sh | 8 +++++- .../nova-controller/nova-conductor/start.sh | 8 +++++- .../nova-controller/nova-scheduler/start.sh | 7 ++++- docs/integration-guide.md | 12 +++++++++ docs/minimal-environment-vars.md | 15 +++++++++++ tools/genenv | 26 +++++++++++++++++++ 15 files changed, 134 insertions(+), 15 deletions(-) diff --git a/docker/neutron/agents/dhcp/start.sh b/docker/neutron/agents/dhcp/start.sh index 7754532a62..70c8465265 100755 --- a/docker/neutron/agents/dhcp/start.sh +++ b/docker/neutron/agents/dhcp/start.sh @@ -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 \ diff --git a/docker/neutron/agents/l3/start.sh b/docker/neutron/agents/l3/start.sh index 17a09ad653..0ad1121659 100755 --- a/docker/neutron/agents/l3/start.sh +++ b/docker/neutron/agents/l3/start.sh @@ -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 \ diff --git a/docker/neutron/agents/linux-bridge/start.sh b/docker/neutron/agents/linux-bridge/start.sh index 1aeea4cf58..2ff5a05ede 100755 --- a/docker/neutron/agents/linux-bridge/start.sh +++ b/docker/neutron/agents/linux-bridge/start.sh @@ -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 \ diff --git a/docker/neutron/agents/metadata/start.sh b/docker/neutron/agents/metadata/start.sh index 9eef79a313..a995741521 100755 --- a/docker/neutron/agents/metadata/start.sh +++ b/docker/neutron/agents/metadata/start.sh @@ -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 \ diff --git a/docker/neutron/neutron-base/config-neutron.sh b/docker/neutron/neutron-base/config-neutron.sh index 35a1375fff..6cbbc74ac3 100644 --- a/docker/neutron/neutron-base/config-neutron.sh +++ b/docker/neutron/neutron-base/config-neutron.sh @@ -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 \ diff --git a/docker/neutron/neutron-server/start.sh b/docker/neutron/neutron-server/start.sh index b121b6f952..f6c64f2a28 100755 --- a/docker/neutron/neutron-server/start.sh +++ b/docker/neutron/neutron-server/start.sh @@ -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 \ diff --git a/docker/nova-base/config-nova.sh b/docker/nova-base/config-nova.sh index 0764964d58..6350ed695c 100755 --- a/docker/nova-base/config-nova.sh +++ b/docker/nova-base/config-nova.sh @@ -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 diff --git a/docker/nova-compute/nova-compute/config-nova-compute.sh b/docker/nova-compute/nova-compute/config-nova-compute.sh index b0f20d9fc3..62e40701f6 100755 --- a/docker/nova-compute/nova-compute/config-nova-compute.sh +++ b/docker/nova-compute/nova-compute/config-nova-compute.sh @@ -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 diff --git a/docker/nova-compute/nova-network/config-nova-network.sh b/docker/nova-compute/nova-network/config-nova-network.sh index f26bb66d14..05013bde23 100755 --- a/docker/nova-compute/nova-network/config-nova-network.sh +++ b/docker/nova-compute/nova-network/config-nova-network.sh @@ -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 < - Defaults to false. Enable/disable debug level logging for all OpenStack services. + VERBOSE_LOGGING= - Defaults to true. Enable/disable verbose level logging for all OpenStack services. + NOVA_LOG_DIR= - Defaults to none. The base directory used for relative Nova --log-file paths. + NEUTRON_LOG_DIR - Defaults to none. The base directory used for relative Neutron --log-file paths. + NOVA_API_LOG_FILE= 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= 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= 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= 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= 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= 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= 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= 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= - The admin user password ADMIN_TENANT_NAME= - tenant name FLAT_INTERFACE= - nova networking flat interface device name diff --git a/docs/minimal-environment-vars.md b/docs/minimal-environment-vars.md index f610f6cc35..713507f795 100644 --- a/docs/minimal-environment-vars.md +++ b/docs/minimal-environment-vars.md @@ -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 diff --git a/tools/genenv b/tools/genenv index 5484cb8f7f..bb349b5b0a 100755 --- a/tools/genenv +++ b/tools/genenv @@ -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 <