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.

Test-Plan (AIO-SX/AIO-DX):
PASS: build-pkgs
PASS: Install ISO and bootstrap
PASS: systemd-cgls show openstack-keystone.service under system.slice
PASS: /var/log/collectd.log shows cpu consumption for openstack-keystone
      service
Test-Plan (AIO-DX):
PASS: Perform host-swact and check:
      - no alarms in <fm alarm-list> command
      - no unexpected logs in sm-customer.log and sm.log

Story: 2011377
Task: 52077

Change-Id: I6f481891e51ca1730554d2bc067ee60ea7bdd331
Signed-off-by: Alyson Deives Pereira <alyson.deivespereira@windriver.com>
This commit is contained in:
Alyson Deives Pereira
2025-04-30 12:20:55 -03:00
parent 151e86f721
commit a9bce65acf
2 changed files with 86 additions and 1 deletions

View File

@@ -0,0 +1,84 @@
From 8b4b253c3b8af044acb423bfb99824e6d22ad654 Mon Sep 17 00:00:00 2001
From: Alyson Deives Pereira <alyson.deivespereira@windriver.com>
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 <alyson.deivespereira@windriver.com>
---
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

View File

@@ -1,3 +1,4 @@
0001-Add-stx-support.patch
0002-Add-login-fail-lockout-security-compliance-options.patch
0003-Enforce-new-password-rules-to-keystone-accounts.patch
0003-Enforce-new-password-rules-to-keystone-accounts.patch
0004-Launch-keystone-with-systemd-run-instead-of-start-st.patch