Browse code

make USE_SCREEN=False imply USE_SYSTEMD=True

In order to start making the transition in the gate make
USE_SCREEN=False also mean USE_SYSTEMD=True. We'll never actually
declare USE_SYSTEMD=True in the gate (as that doesn't exist for stable
branches), but this will let us roll over the existing transition.

We also have to install systemd-python 234 because we are recording
exception info in the journal, and all versions before that had a bug
in processing that.

Remove the somewhat pointless screen following journalctl commands. We
really don't want or need those, and they tend to build up over time.

Depends-On: I24513f5cbac2c34cf0130bf812ff2df6ad76657c

Change-Id: I6af6d1857effaf662a9d72bd394864934eacbe70

Sean Dague authored on 2017/04/26 19:57:58
Showing 5 changed files
... ...
@@ -17,6 +17,7 @@ libjpeg-dev # Pillow 3.0.0
17 17
 libmysqlclient-dev  # MySQL-python
18 18
 libpq-dev  # psycopg2
19 19
 libssl-dev # for pyOpenSSL
20
+libsystemd-dev # for systemd-python
20 21
 libxml2-dev  # lxml
21 22
 libxslt1-dev  # lxml
22 23
 libyaml-dev
... ...
@@ -26,10 +27,8 @@ openssl
26 26
 pkg-config
27 27
 psmisc
28 28
 python2.7
29
-python3-systemd
30 29
 python-dev
31 30
 python-gdbm # needed for testr
32
-python-systemd
33 31
 screen
34 32
 tar
35 33
 tcpdump
... ...
@@ -29,7 +29,7 @@ pyOpenSSL # version in pip uses too much memory
29 29
 python-devel
30 30
 redhat-rpm-config # missing dep for gcc hardening flags, see rhbz#1217376
31 31
 screen
32
-systemd-python
32
+systemd-devel # for systemd-python
33 33
 tar
34 34
 tcpdump
35 35
 unzip
... ...
@@ -1495,22 +1495,6 @@ function _run_under_systemd {
1495 1495
 
1496 1496
     $SYSTEMCTL enable $systemd_service
1497 1497
     $SYSTEMCTL start $systemd_service
1498
-    _journal_log $service $systemd_service
1499
-}
1500
-
1501
-function _journal_log {
1502
-    local service=$1
1503
-    local unit=$2
1504
-    local logfile="${service}.log.${CURRENT_LOG_TIME}"
1505
-    local real_logfile="${LOGDIR}/${logfile}"
1506
-    if [[ -n ${LOGDIR} ]]; then
1507
-        $JOURNALCTL_F $2 > "$real_logfile" &
1508
-        bash -c "cd '$LOGDIR' && ln -sf '$logfile' ${service}.log"
1509
-        if [[ -n ${SCREEN_LOGDIR} ]]; then
1510
-            # Drop the backward-compat symlink
1511
-            ln -sf "$real_logfile" ${SCREEN_LOGDIR}/screen-${service}.log
1512
-        fi
1513
-    fi
1514 1498
 }
1515 1499
 
1516 1500
 # Helper to remove the ``*.failure`` files under ``$SERVICE_DIR/$SCREEN_NAME``.
... ...
@@ -1700,8 +1684,10 @@ function stop_process {
1700 1700
             # Only do this for units which appear enabled, this also
1701 1701
             # catches units that don't really exist for cases like
1702 1702
             # keystone without a failure.
1703
-            $SYSTEMCTL stop devstack@$service.service
1704
-            $SYSTEMCTL disable devstack@$service.service
1703
+            if $SYSTEMCTL is-enabled devstack@$service.service; then
1704
+                $SYSTEMCTL stop devstack@$service.service
1705
+                $SYSTEMCTL disable devstack@$service.service
1706
+            fi
1705 1707
         fi
1706 1708
 
1707 1709
         if [[ -r $SERVICE_DIR/$SCREEN_NAME/$service.pid ]]; then
... ...
@@ -746,6 +746,9 @@ fi
746 746
 # Do the ugly hacks for broken packages and distros
747 747
 source $TOP_DIR/tools/fixup_stuff.sh
748 748
 
749
+if [[ "$USE_SYSTEMD" == "True" ]]; then
750
+    pip_install_gr systemd-python
751
+fi
749 752
 
750 753
 # Virtual Environment
751 754
 # -------------------
... ...
@@ -157,6 +157,15 @@ elif [[ -f $RC_DIR/.localrc.auto ]]; then
157 157
     source $RC_DIR/.localrc.auto
158 158
 fi
159 159
 
160
+# if we are forcing off USE_SCREEN (as we do in the gate), force on
161
+# systemd. This allows us to drop one of 3 paths through the code.
162
+if [[ "$USE_SCREEN" == "False" ]]; then
163
+    # Remove in Pike: this gets us through grenade upgrade
164
+    if [[ "$GRENADE_PHASE" != "target" ]]; then
165
+        USE_SYSTEMD="True"
166
+    fi
167
+fi
168
+
160 169
 # Default for log coloring is based on interactive-or-not.
161 170
 # Baseline assumption is that non-interactive invocations are for CI,
162 171
 # where logs are to be presented as browsable text files; hence color