| ... | ... |
@@ -123,12 +123,10 @@ if [[ -n "$LOGDIR" ]] && [[ -d "$LOGDIR" ]]; then |
| 123 | 123 |
sudo rm -rf $LOGDIR |
| 124 | 124 |
fi |
| 125 | 125 |
|
| 126 |
-# Clean out the systemd user unit files if systemd was used. |
|
| 127 |
-if [[ "$USE_SYSTEMD" = "True" ]]; then |
|
| 128 |
- sudo find $SYSTEMD_DIR -type f -name '*devstack@*service' -delete |
|
| 129 |
- # Make systemd aware of the deletion. |
|
| 130 |
- $SYSTEMCTL daemon-reload |
|
| 131 |
-fi |
|
| 126 |
+# Clean out the systemd unit files. |
|
| 127 |
+sudo find $SYSTEMD_DIR -type f -name '*devstack@*service' -delete |
|
| 128 |
+# Make systemd aware of the deletion. |
|
| 129 |
+$SYSTEMCTL daemon-reload |
|
| 132 | 130 |
|
| 133 | 131 |
# Clean up venvs |
| 134 | 132 |
DIRS_TO_CLEAN="$WHEELHOUSE ${PROJECT_VENV[@]} .config/openstack"
|
| ... | ... |
@@ -651,40 +651,29 @@ function vercmp {
|
| 651 | 651 |
# This sets up defaults we like in devstack for logging for tracking |
| 652 | 652 |
# down issues, and makes sure everything is done the same between |
| 653 | 653 |
# projects. |
| 654 |
+# NOTE(jh): Historically this function switched between three different |
|
| 655 |
+# functions: setup_systemd_logging, setup_colorized_logging and |
|
| 656 |
+# setup_standard_logging_identity. Since we always run with systemd now, |
|
| 657 |
+# this could be cleaned up, but the other functions may still be in use |
|
| 658 |
+# by plugins. Since deprecations haven't worked in the past, we'll just |
|
| 659 |
+# leave them in place. |
|
| 654 | 660 |
function setup_logging {
|
| 655 |
- local conf_file=$1 |
|
| 656 |
- local other_cond=${2:-"False"}
|
|
| 657 |
- if [[ "$USE_SYSTEMD" == "True" ]]; then |
|
| 658 |
- setup_systemd_logging $conf_file |
|
| 659 |
- elif [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ] && [ "$other_cond" == "False" ]; then |
|
| 660 |
- setup_colorized_logging $conf_file |
|
| 661 |
- else |
|
| 662 |
- setup_standard_logging_identity $conf_file |
|
| 663 |
- fi |
|
| 661 |
+ setup_systemd_logging $1 |
|
| 664 | 662 |
} |
| 665 | 663 |
|
| 666 | 664 |
# This function sets log formatting options for colorizing log |
| 667 | 665 |
# output to stdout. It is meant to be called by lib modules. |
| 668 |
-# The last two parameters are optional and can be used to specify |
|
| 669 |
-# non-default value for project and user format variables. |
|
| 670 |
-# Defaults are respectively 'project_name' and 'user_name' |
|
| 671 |
-# |
|
| 672 |
-# setup_colorized_logging something.conf SOMESECTION |
|
| 673 | 666 |
function setup_colorized_logging {
|
| 674 | 667 |
local conf_file=$1 |
| 675 |
- local conf_section="DEFAULT" |
|
| 676 |
- local project_var="project_name" |
|
| 677 |
- local user_var="user_name" |
|
| 678 | 668 |
# Add color to logging output |
| 679 |
- iniset $conf_file $conf_section logging_context_format_string "%(asctime)s.%(msecs)03d %(color)s%(levelname)s %(name)s [[01;36m%(request_id)s [00;36m%("$project_var")s %("$user_var")s%(color)s] [01;35m%(instance)s%(color)s%(message)s[00m"
|
|
| 680 |
- iniset $conf_file $conf_section logging_default_format_string "%(asctime)s.%(msecs)03d %(color)s%(levelname)s %(name)s [[00;36m-%(color)s] [01;35m%(instance)s%(color)s%(message)s[00m" |
|
| 681 |
- iniset $conf_file $conf_section logging_debug_format_suffix "[00;33mfrom (pid=%(process)d) %(funcName)s %(pathname)s:%(lineno)d[00m" |
|
| 682 |
- iniset $conf_file $conf_section logging_exception_prefix "%(color)s%(asctime)s.%(msecs)03d TRACE %(name)s [01;35m%(instance)s[00m" |
|
| 669 |
+ iniset $conf_file DEFAULT logging_context_format_string "%(asctime)s.%(msecs)03d %(color)s%(levelname)s %(name)s [[01;36m%(request_id)s [00;36m%(project_name)s %(user_name)s%(color)s] [01;35m%(instance)s%(color)s%(message)s[00m" |
|
| 670 |
+ iniset $conf_file DEFAULT logging_default_format_string "%(asctime)s.%(msecs)03d %(color)s%(levelname)s %(name)s [[00;36m-%(color)s] [01;35m%(instance)s%(color)s%(message)s[00m" |
|
| 671 |
+ iniset $conf_file DEFAULT logging_debug_format_suffix "[00;33mfrom (pid=%(process)d) %(funcName)s %(pathname)s:%(lineno)d[00m" |
|
| 672 |
+ iniset $conf_file DEFAULT logging_exception_prefix "%(color)s%(asctime)s.%(msecs)03d TRACE %(name)s [01;35m%(instance)s[00m" |
|
| 683 | 673 |
} |
| 684 | 674 |
|
| 685 | 675 |
function setup_systemd_logging {
|
| 686 | 676 |
local conf_file=$1 |
| 687 |
- local conf_section="DEFAULT" |
|
| 688 | 677 |
# NOTE(sdague): this is a nice to have, and means we're using the |
| 689 | 678 |
# native systemd path, which provides for things like search on |
| 690 | 679 |
# request-id. However, there may be an eventlet interaction here, |
| ... | ... |
@@ -692,16 +681,16 @@ function setup_systemd_logging {
|
| 692 | 692 |
USE_JOURNAL=$(trueorfalse False USE_JOURNAL) |
| 693 | 693 |
local pidstr="" |
| 694 | 694 |
if [[ "$USE_JOURNAL" == "True" ]]; then |
| 695 |
- iniset $conf_file $conf_section use_journal "True" |
|
| 695 |
+ iniset $conf_file DEFAULT use_journal "True" |
|
| 696 | 696 |
# if we are using the journal directly, our process id is already correct |
| 697 | 697 |
else |
| 698 | 698 |
pidstr="(pid=%(process)d) " |
| 699 | 699 |
fi |
| 700 |
- iniset $conf_file $conf_section logging_debug_format_suffix "[00;33m{{${pidstr}%(funcName)s %(pathname)s:%(lineno)d}}[00m"
|
|
| 700 |
+ iniset $conf_file DEFAULT logging_debug_format_suffix "[00;33m{{${pidstr}%(funcName)s %(pathname)s:%(lineno)d}}[00m"
|
|
| 701 | 701 |
|
| 702 |
- iniset $conf_file $conf_section logging_context_format_string "%(color)s%(levelname)s %(name)s [[01;36m%(global_request_id)s %(request_id)s [00;36m%(project_name)s %(user_name)s%(color)s] [01;35m%(instance)s%(color)s%(message)s[00m" |
|
| 703 |
- iniset $conf_file $conf_section logging_default_format_string "%(color)s%(levelname)s %(name)s [[00;36m-%(color)s] [01;35m%(instance)s%(color)s%(message)s[00m" |
|
| 704 |
- iniset $conf_file $conf_section logging_exception_prefix "ERROR %(name)s [01;35m%(instance)s[00m" |
|
| 702 |
+ iniset $conf_file DEFAULT logging_context_format_string "%(color)s%(levelname)s %(name)s [[01;36m%(global_request_id)s %(request_id)s [00;36m%(project_name)s %(user_name)s%(color)s] [01;35m%(instance)s%(color)s%(message)s[00m" |
|
| 703 |
+ iniset $conf_file DEFAULT logging_default_format_string "%(color)s%(levelname)s %(name)s [[00;36m-%(color)s] [01;35m%(instance)s%(color)s%(message)s[00m" |
|
| 704 |
+ iniset $conf_file DEFAULT logging_exception_prefix "ERROR %(name)s [01;35m%(instance)s[00m" |
|
| 705 | 705 |
} |
| 706 | 706 |
|
| 707 | 707 |
function setup_standard_logging_identity {
|
| ... | ... |
@@ -759,13 +759,11 @@ fixup_all |
| 759 | 759 |
# Install subunit for the subunit output stream |
| 760 | 760 |
pip_install -U os-testr |
| 761 | 761 |
|
| 762 |
-if [[ "$USE_SYSTEMD" == "True" ]]; then |
|
| 763 |
- pip_install_gr systemd-python |
|
| 764 |
- # the default rate limit of 1000 messages / 30 seconds is not |
|
| 765 |
- # sufficient given how verbose our logging is. |
|
| 766 |
- iniset -sudo /etc/systemd/journald.conf "Journal" "RateLimitBurst" "0" |
|
| 767 |
- sudo systemctl restart systemd-journald |
|
| 768 |
-fi |
|
| 762 |
+pip_install_gr systemd-python |
|
| 763 |
+# the default rate limit of 1000 messages / 30 seconds is not |
|
| 764 |
+# sufficient given how verbose our logging is. |
|
| 765 |
+iniset -sudo /etc/systemd/journald.conf "Journal" "RateLimitBurst" "0" |
|
| 766 |
+sudo systemctl restart systemd-journald |
|
| 769 | 767 |
|
| 770 | 768 |
# Virtual Environment |
| 771 | 769 |
# ------------------- |
| ... | ... |
@@ -1482,14 +1480,11 @@ if [[ -n "$DEPRECATED_TEXT" ]]; then |
| 1482 | 1482 |
echo |
| 1483 | 1483 |
fi |
| 1484 | 1484 |
|
| 1485 |
-# If USE_SYSTEMD is enabled, tell the user about using it. |
|
| 1486 |
-if [[ "$USE_SYSTEMD" == "True" ]]; then |
|
| 1487 |
- echo |
|
| 1488 |
- echo "Services are running under systemd unit files." |
|
| 1489 |
- echo "For more information see: " |
|
| 1490 |
- echo "https://docs.openstack.org/devstack/latest/systemd.html" |
|
| 1491 |
- echo |
|
| 1492 |
-fi |
|
| 1485 |
+echo |
|
| 1486 |
+echo "Services are running under systemd unit files." |
|
| 1487 |
+echo "For more information see: " |
|
| 1488 |
+echo "https://docs.openstack.org/devstack/latest/systemd.html" |
|
| 1489 |
+echo |
|
| 1493 | 1490 |
|
| 1494 | 1491 |
# Useful info on current state |
| 1495 | 1492 |
cat /etc/devstack-version |
| ... | ... |
@@ -109,9 +109,7 @@ CELLSV2_SETUP=${CELLSV2_SETUP:-"superconductor"}
|
| 109 | 109 |
# Set the root URL for Horizon |
| 110 | 110 |
HORIZON_APACHE_ROOT="/dashboard" |
| 111 | 111 |
|
| 112 |
-# Whether to use SYSTEMD to manage services, we only do this from |
|
| 113 |
-# Queens forward. |
|
| 114 |
-USE_SYSTEMD="True" |
|
| 112 |
+# Whether to use user specific units for running services or global ones. |
|
| 115 | 113 |
USER_UNITS=$(trueorfalse False USER_UNITS) |
| 116 | 114 |
if [[ "$USER_UNITS" == "True" ]]; then |
| 117 | 115 |
SYSTEMD_DIR="$HOME/.local/share/systemd/user" |