We dropped the ability to override USE_SYSTEMD to False when we deleted
screen support in [0], so we can also clean up any conditionals based
on it.
Also clean up the logging setup functions, dropping local vars for
parameters that we don't actually support anymore.
[0] I8c27182f60b0f5310b3a8bf5feb02beb7ffbb26a
Change-Id: I5cbce9f2c42e111761e8689447b3f8cbb7ea2eb5
... | ... |
@@ -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" |
... | ... |
@@ -635,40 +635,29 @@ function vercmp { |
635 | 635 |
# This sets up defaults we like in devstack for logging for tracking |
636 | 636 |
# down issues, and makes sure everything is done the same between |
637 | 637 |
# projects. |
638 |
+# NOTE(jh): Historically this function switched between three different |
|
639 |
+# functions: setup_systemd_logging, setup_colorized_logging and |
|
640 |
+# setup_standard_logging_identity. Since we always run with systemd now, |
|
641 |
+# this could be cleaned up, but the other functions may still be in use |
|
642 |
+# by plugins. Since deprecations haven't worked in the past, we'll just |
|
643 |
+# leave them in place. |
|
638 | 644 |
function setup_logging { |
639 |
- local conf_file=$1 |
|
640 |
- local other_cond=${2:-"False"} |
|
641 |
- if [[ "$USE_SYSTEMD" == "True" ]]; then |
|
642 |
- setup_systemd_logging $conf_file |
|
643 |
- elif [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ] && [ "$other_cond" == "False" ]; then |
|
644 |
- setup_colorized_logging $conf_file |
|
645 |
- else |
|
646 |
- setup_standard_logging_identity $conf_file |
|
647 |
- fi |
|
645 |
+ setup_systemd_logging $1 |
|
648 | 646 |
} |
649 | 647 |
|
650 | 648 |
# This function sets log formatting options for colorizing log |
651 | 649 |
# output to stdout. It is meant to be called by lib modules. |
652 |
-# The last two parameters are optional and can be used to specify |
|
653 |
-# non-default value for project and user format variables. |
|
654 |
-# Defaults are respectively 'project_name' and 'user_name' |
|
655 |
-# |
|
656 |
-# setup_colorized_logging something.conf SOMESECTION |
|
657 | 650 |
function setup_colorized_logging { |
658 | 651 |
local conf_file=$1 |
659 |
- local conf_section="DEFAULT" |
|
660 |
- local project_var="project_name" |
|
661 |
- local user_var="user_name" |
|
662 | 652 |
# Add color to logging output |
663 |
- 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" |
|
664 |
- 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" |
|
665 |
- iniset $conf_file $conf_section logging_debug_format_suffix "[00;33mfrom (pid=%(process)d) %(funcName)s %(pathname)s:%(lineno)d[00m" |
|
666 |
- iniset $conf_file $conf_section logging_exception_prefix "%(color)s%(asctime)s.%(msecs)03d TRACE %(name)s [01;35m%(instance)s[00m" |
|
653 |
+ 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" |
|
654 |
+ 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" |
|
655 |
+ iniset $conf_file DEFAULT logging_debug_format_suffix "[00;33mfrom (pid=%(process)d) %(funcName)s %(pathname)s:%(lineno)d[00m" |
|
656 |
+ iniset $conf_file DEFAULT logging_exception_prefix "%(color)s%(asctime)s.%(msecs)03d TRACE %(name)s [01;35m%(instance)s[00m" |
|
667 | 657 |
} |
668 | 658 |
|
669 | 659 |
function setup_systemd_logging { |
670 | 660 |
local conf_file=$1 |
671 |
- local conf_section="DEFAULT" |
|
672 | 661 |
# NOTE(sdague): this is a nice to have, and means we're using the |
673 | 662 |
# native systemd path, which provides for things like search on |
674 | 663 |
# request-id. However, there may be an eventlet interaction here, |
... | ... |
@@ -676,16 +665,16 @@ function setup_systemd_logging { |
676 | 676 |
USE_JOURNAL=$(trueorfalse False USE_JOURNAL) |
677 | 677 |
local pidstr="" |
678 | 678 |
if [[ "$USE_JOURNAL" == "True" ]]; then |
679 |
- iniset $conf_file $conf_section use_journal "True" |
|
679 |
+ iniset $conf_file DEFAULT use_journal "True" |
|
680 | 680 |
# if we are using the journal directly, our process id is already correct |
681 | 681 |
else |
682 | 682 |
pidstr="(pid=%(process)d) " |
683 | 683 |
fi |
684 |
- iniset $conf_file $conf_section logging_debug_format_suffix "[00;33m{{${pidstr}%(funcName)s %(pathname)s:%(lineno)d}}[00m" |
|
684 |
+ iniset $conf_file DEFAULT logging_debug_format_suffix "[00;33m{{${pidstr}%(funcName)s %(pathname)s:%(lineno)d}}[00m" |
|
685 | 685 |
|
686 |
- 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" |
|
687 |
- 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" |
|
688 |
- iniset $conf_file $conf_section logging_exception_prefix "ERROR %(name)s [01;35m%(instance)s[00m" |
|
686 |
+ 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" |
|
687 |
+ 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" |
|
688 |
+ iniset $conf_file DEFAULT logging_exception_prefix "ERROR %(name)s [01;35m%(instance)s[00m" |
|
689 | 689 |
} |
690 | 690 |
|
691 | 691 |
function setup_standard_logging_identity { |
... | ... |
@@ -803,13 +803,11 @@ fixup_all |
803 | 803 |
# Install subunit for the subunit output stream |
804 | 804 |
pip_install -U os-testr |
805 | 805 |
|
806 |
-if [[ "$USE_SYSTEMD" == "True" ]]; then |
|
807 |
- pip_install_gr systemd-python |
|
808 |
- # the default rate limit of 1000 messages / 30 seconds is not |
|
809 |
- # sufficient given how verbose our logging is. |
|
810 |
- iniset -sudo /etc/systemd/journald.conf "Journal" "RateLimitBurst" "0" |
|
811 |
- sudo systemctl restart systemd-journald |
|
812 |
-fi |
|
806 |
+pip_install_gr systemd-python |
|
807 |
+# the default rate limit of 1000 messages / 30 seconds is not |
|
808 |
+# sufficient given how verbose our logging is. |
|
809 |
+iniset -sudo /etc/systemd/journald.conf "Journal" "RateLimitBurst" "0" |
|
810 |
+sudo systemctl restart systemd-journald |
|
813 | 811 |
|
814 | 812 |
# Virtual Environment |
815 | 813 |
# ------------------- |
... | ... |
@@ -1521,14 +1519,11 @@ if [[ -n "$DEPRECATED_TEXT" ]]; then |
1521 | 1521 |
echo |
1522 | 1522 |
fi |
1523 | 1523 |
|
1524 |
-# If USE_SYSTEMD is enabled, tell the user about using it. |
|
1525 |
-if [[ "$USE_SYSTEMD" == "True" ]]; then |
|
1526 |
- echo |
|
1527 |
- echo "Services are running under systemd unit files." |
|
1528 |
- echo "For more information see: " |
|
1529 |
- echo "https://docs.openstack.org/devstack/latest/systemd.html" |
|
1530 |
- echo |
|
1531 |
-fi |
|
1524 |
+echo |
|
1525 |
+echo "Services are running under systemd unit files." |
|
1526 |
+echo "For more information see: " |
|
1527 |
+echo "https://docs.openstack.org/devstack/latest/systemd.html" |
|
1528 |
+echo |
|
1532 | 1529 |
|
1533 | 1530 |
# Useful info on current state |
1534 | 1531 |
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" |