From 8b4b253c3b8af044acb423bfb99824e6d22ad654 Mon Sep 17 00:00:00 2001 From: Alyson Deives Pereira Date: Wed, 30 Apr 2025 12:13:27 -0300 Subject: [PATCH] Launch keystone with systemd-run instead of start-stop-daemon Change keystone to be launched by sm.service using systemd-run instead of start-stop-daemon. This will enable keystone to be launched as a transient systemd unit under system.slice instead of a subprocess of sm.service. Moreover, it will enable a better visualization and monitoring of cpu consumption via /var/log/collectd.log. The service unit is defined as openstack-keystone.service to not conflict with 'keystone' name already present on /lib/systemd/system/keystone.service which is used during bootstrap process. Signed-off-by: Alyson Deives Pereira --- debian/stx/keystone-all | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/debian/stx/keystone-all b/debian/stx/keystone-all index 8972a6ce7..1f69991e2 100644 --- a/debian/stx/keystone-all +++ b/debian/stx/keystone-all @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (c) 2013-2018 Wind River Systems, Inc. +# Copyright (c) 2013-2018,2025 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # @@ -19,6 +19,9 @@ RETVAL=0 #public 5000 DESC_PUBLIC="openstack-keystone" +SERVICE="$DESC_PUBLIC.service" +SERVICE_CPUSHARES=512 +SERVICE_DESC="OpenStack Keystone" PIDFILE_PUBLIC="/var/run/$DESC_PUBLIC.pid" @@ -90,8 +93,10 @@ start() echo -e "Starting keystone process at port 5000 \n" ; - start-stop-daemon --start --quiet --background --pidfile ${PIDFILE_PUBLIC} \ - --make-pidfile --exec ${PYTHON} -- ${EXEC} --bind ${BIND_PUBLIC} \ + systemd-run --collect --unit=$SERVICE --slice-inherit \ + -p Description="${SERVICE_DESC}" \ + -p CPUShares=${SERVICE_CPUSHARES} -p PIDFile=${PIDFILE_PUBLIC} \ + ${EXEC} --pid ${PIDFILE_PUBLIC} --bind ${BIND_PUBLIC} \ --worker-class ${WORKER} --workers ${TIS_WORKERS} --threads ${THREADS} \ --timeout ${TIMEOUT} --max-requests ${MAX_REQUESTS} \ --max-requests-jitter ${MAX_REQ_JITTER_PUBLIC} \ @@ -109,7 +114,7 @@ start() stop() { if [ -e $PIDFILE_PUBLIC ]; then - start-stop-daemon --stop --quiet --pidfile $PIDFILE_PUBLIC + systemctl stop $SERVICE RETVAL_PUBLIC=$? if [ $RETVAL_PUBLIC -eq 0 ]; then echo "Stopped $DESC_PUBLIC." @@ -124,13 +129,9 @@ stop() status() { - pid_public=`cat $PIDFILE_PUBLIC 2>/dev/null` - - if [ -n "$pid_public" ]; then - echo -e "\033[32m $DESC_PUBLIC is running..\033[0m" - else - echo -e "\033[31m $DESC_PUBLIC is not running..\033[0m" - fi + systemctl -q is-active $SERVICE && \ + echo -e "\033[32m $DESC_PUBLIC is running..\033[0m" || \ + echo -e "\033[31m $DESC_PUBLIC is not running..\033[0m" } -- 2.34.1