From 6131a76447c564c08f568c566ab3476566869c28 Mon Sep 17 00:00:00 2001 From: lbonatti Date: Mon, 24 Jan 2022 12:14:33 -0300 Subject: [PATCH] Fix failing sysinv services on Debian Modified sysinv to address the following failing services on Debian: sysinv-agent.service sysinv-api.service sysinv-conductor.service sysinv-conf-watcher.service sysinv-fpga-agent.service Note: Sysinv services are dependent on platform.conf and build.info files, currently, those are not available on debian and should be addressed in the near future. They were created manually in order to start the services. Applied fix: - Included modified .service files for debian directly into into the deb_folder. - Changed the script files to account for the different locations of the init-functions. - Included "override_dh_installsystemd" section to rules in order to install services. - Included --no-enable on sysinv-api, sysinv-conductor to prevent failed state after install as is on centOS, the services is started further on bootstrap. Test Plan: PASS: Package installed and ISO built successfully. PASS: Services are on the expected state after iso install: sysinv-api, sysinv-conductor: loaded. sysinv-agent: active. sysinv-conf-watcher, sysinv-fpga-agent: failed. PASS: Services are running after bootstrap on Debian. Story: 2009101 Task: 44348 Depends-on: https://review.opendev.org/c/starlingx/integ/+/826935 Signed-off-by: lbonatti Change-Id: I87e05f2b05a39ff109a2ea18763d4aae9827a8c3 --- sysinv/sysinv-agent/debian/deb_folder/rules | 4 +++- .../debian/deb_folder/sysinv-agent.install | 1 - .../debian/deb_folder/sysinv-agent.service | 15 +++++++++++++++ sysinv/sysinv-agent/sysinv-agent | 2 +- sysinv/sysinv-fpga-agent/debian/deb_folder/rules | 8 +++----- .../debian/deb_folder/sysinv-conf-watcher.path | 5 +++++ .../debian/deb_folder/sysinv-conf-watcher.service | 11 +++++++++++ .../debian/deb_folder/sysinv-fpga-agent.install | 3 --- .../debian/deb_folder/sysinv-fpga-agent.service | 15 +++++++++++++++ sysinv/sysinv/debian/deb_folder/rules | 4 ++-- .../sysinv/debian/deb_folder/sysinv-api.service | 15 +++++++++++++++ .../debian/deb_folder/sysinv-conductor.service | 15 +++++++++++++++ sysinv/sysinv/debian/deb_folder/sysinv.install | 2 -- 13 files changed, 85 insertions(+), 15 deletions(-) create mode 100644 sysinv/sysinv-agent/debian/deb_folder/sysinv-agent.service create mode 100644 sysinv/sysinv-fpga-agent/debian/deb_folder/sysinv-conf-watcher.path create mode 100644 sysinv/sysinv-fpga-agent/debian/deb_folder/sysinv-conf-watcher.service create mode 100644 sysinv/sysinv-fpga-agent/debian/deb_folder/sysinv-fpga-agent.service create mode 100644 sysinv/sysinv/debian/deb_folder/sysinv-api.service create mode 100644 sysinv/sysinv/debian/deb_folder/sysinv-conductor.service diff --git a/sysinv/sysinv-agent/debian/deb_folder/rules b/sysinv/sysinv-agent/debian/deb_folder/rules index c7216f7094..c8bd3b8ed3 100755 --- a/sysinv/sysinv-agent/debian/deb_folder/rules +++ b/sysinv/sysinv-agent/debian/deb_folder/rules @@ -9,8 +9,10 @@ ROOT := $(CURDIR)/debian/tmp override_dh_install: install -p -D -m 755 sysinv-agent ${ROOT}/etc/init.d/sysinv-agent install -p -D -m 644 sysinv-agent.conf ${ROOT}/etc/pmon.d/sysinv-agent.conf - install -p -D -m 644 sysinv-agent.service ${ROOT}/lib/systemd/system/sysinv-agent.service dh_install override_dh_installinit: dh_installinit --only-scripts + +override_dh_installsystemd: + dh_installsystemd --name sysinv-agent diff --git a/sysinv/sysinv-agent/debian/deb_folder/sysinv-agent.install b/sysinv/sysinv-agent/debian/deb_folder/sysinv-agent.install index bc74e34956..3b74ee57a7 100644 --- a/sysinv/sysinv-agent/debian/deb_folder/sysinv-agent.install +++ b/sysinv/sysinv-agent/debian/deb_folder/sysinv-agent.install @@ -1,3 +1,2 @@ etc/init.d/sysinv-agent etc/pmon.d/sysinv-agent.conf -lib/systemd/system/sysinv-agent.service diff --git a/sysinv/sysinv-agent/debian/deb_folder/sysinv-agent.service b/sysinv/sysinv-agent/debian/deb_folder/sysinv-agent.service new file mode 100644 index 0000000000..1badb16bc4 --- /dev/null +++ b/sysinv/sysinv-agent/debian/deb_folder/sysinv-agent.service @@ -0,0 +1,15 @@ +[Unit] +Description=StarlingX System Inventory Agent +After=nfscommon.service sw-patch.service +After=network-online.target systemd-udev-settle.service +Before=pmon.service + +[Service] +Type=forking +RemainAfterExit=yes +ExecStart=/etc/init.d/sysinv-agent start +ExecStop=/etc/init.d/sysinv-agent stop +PIDFile=/var/run/sysinv-agent.pid + +[Install] +WantedBy=multi-user.target diff --git a/sysinv/sysinv-agent/sysinv-agent b/sysinv/sysinv-agent/sysinv-agent index e0aa472376..2bc8fb1ff8 100755 --- a/sysinv/sysinv-agent/sysinv-agent +++ b/sysinv/sysinv-agent/sysinv-agent @@ -14,7 +14,7 @@ # Required-Start: $local_fs # Required-Stop: $local_fs # Default-Stop: 0 1 6 -# Short-Description: Maintenance daemon +# Short-Description: Maintenance daemon ### END INIT INFO . /etc/init.d/functions diff --git a/sysinv/sysinv-fpga-agent/debian/deb_folder/rules b/sysinv/sysinv-fpga-agent/debian/deb_folder/rules index 8f4b8dad61..9eab6d526b 100755 --- a/sysinv/sysinv-fpga-agent/debian/deb_folder/rules +++ b/sysinv/sysinv-fpga-agent/debian/deb_folder/rules @@ -9,14 +9,12 @@ ROOT := $(CURDIR)/debian/tmp override_dh_install: install -p -D -m 755 sysinv-fpga-agent ${ROOT}/etc/init.d/sysinv-fpga-agent install -p -D -m 644 sysinv-fpga-agent.conf ${ROOT}/etc/pmon.d/sysinv-fpga-agent.conf - install -p -D -m 644 sysinv-fpga-agent.service ${ROOT}/lib/systemd/system/sysinv-fpga-agent.service - install -p -D -m 644 sysinv-conf-watcher.service ${ROOT}/lib/systemd/system/sysinv-conf-watcher.service - install -p -D -m 644 sysinv-conf-watcher.path ${ROOT}/lib/systemd/system/sysinv-conf-watcher.path dh_install override_dh_usrlocal: # do nothing override_dh_installsystemd: - dh_installsystemd --name=sysinv-fpga-agent.service - dh_installsystemd --name=sysinv-fpga-watcher.service + dh_installsystemd --name sysinv-fpga-agent.service + dh_installsystemd --name sysinv-conf-watcher.service + dh_installsystemd --name sysinv-conf-watcher.path diff --git a/sysinv/sysinv-fpga-agent/debian/deb_folder/sysinv-conf-watcher.path b/sysinv/sysinv-fpga-agent/debian/deb_folder/sysinv-conf-watcher.path new file mode 100644 index 0000000000..ca3fece52a --- /dev/null +++ b/sysinv/sysinv-fpga-agent/debian/deb_folder/sysinv-conf-watcher.path @@ -0,0 +1,5 @@ +[Path] +PathChanged=/etc/sysinv/sysinv.conf + +[Install] +WantedBy=multi-user.target diff --git a/sysinv/sysinv-fpga-agent/debian/deb_folder/sysinv-conf-watcher.service b/sysinv/sysinv-fpga-agent/debian/deb_folder/sysinv-conf-watcher.service new file mode 100644 index 0000000000..30d3928a4a --- /dev/null +++ b/sysinv/sysinv-fpga-agent/debian/deb_folder/sysinv-conf-watcher.service @@ -0,0 +1,11 @@ +[Unit] +Description=StarlingX conf watcher +After=sysinv-fpga-agent.service +Before=pmon.service + +[Service] +Type=oneshot +ExecStart=/usr/bin/systemctl restart sysinv-fpga-agent.service + +[Install] +WantedBy=multi-user.target diff --git a/sysinv/sysinv-fpga-agent/debian/deb_folder/sysinv-fpga-agent.install b/sysinv/sysinv-fpga-agent/debian/deb_folder/sysinv-fpga-agent.install index d9849758f8..89a7f8760b 100644 --- a/sysinv/sysinv-fpga-agent/debian/deb_folder/sysinv-fpga-agent.install +++ b/sysinv/sysinv-fpga-agent/debian/deb_folder/sysinv-fpga-agent.install @@ -1,5 +1,2 @@ etc/init.d/sysinv-fpga-agent etc/pmon.d/sysinv-fpga-agent.conf -lib/systemd/system/sysinv-fpga-agent.service -lib/systemd/system/sysinv-conf-watcher.service -lib/systemd/system/sysinv-conf-watcher.path diff --git a/sysinv/sysinv-fpga-agent/debian/deb_folder/sysinv-fpga-agent.service b/sysinv/sysinv-fpga-agent/debian/deb_folder/sysinv-fpga-agent.service new file mode 100644 index 0000000000..1bf01cc6f1 --- /dev/null +++ b/sysinv/sysinv-fpga-agent/debian/deb_folder/sysinv-fpga-agent.service @@ -0,0 +1,15 @@ +[Unit] +Description=StarlingX FPGA Agent +After=nfscommon.service sw-patch.service +After=network-online.target systemd-udev-settle.service sysinv-agent.service +Before=pmon.service + +[Service] +Type=forking +RemainAfterExit=yes +ExecStart=/etc/init.d/sysinv-fpga-agent start +ExecStop=/etc/init.d/sysinv-fpga-agent stop +PIDFile=/var/run/sysinv-fpga-agent.pid + +[Install] +WantedBy=multi-user.target diff --git a/sysinv/sysinv/debian/deb_folder/rules b/sysinv/sysinv/debian/deb_folder/rules index abc097fe27..2369c9b77b 100755 --- a/sysinv/sysinv/debian/deb_folder/rules +++ b/sysinv/sysinv/debian/deb_folder/rules @@ -27,8 +27,8 @@ override_dh_python3: dh_python3 --shebang=/usr/bin/python3 override_dh_installsystemd: - dh_installsystemd --name=sysinv-api - dh_installsystemd --name=sysinv-conductor + dh_installsystemd --no-enable --name sysinv-api + dh_installsystemd --no-enable --name sysinv-conductor override_dh_fixperms: dh_fixperms -Xkube-cert-rotation.sh diff --git a/sysinv/sysinv/debian/deb_folder/sysinv-api.service b/sysinv/sysinv/debian/deb_folder/sysinv-api.service new file mode 100644 index 0000000000..d05c07cfea --- /dev/null +++ b/sysinv/sysinv/debian/deb_folder/sysinv-api.service @@ -0,0 +1,15 @@ +[Unit] +Description=System Inventory API +After=network-online.target syslog-ng.service config.service sysinv-conductor.service + +[Service] +Type=simple +RemainAfterExit=yes +User=root +Environment=OCF_ROOT=/usr/lib/ocf +ExecStart=/usr/lib/ocf/resource.d/platform/sysinv-api start +ExecStop=/usr/lib/ocf/resource.d/platform/sysinv-api stop +PIDFile=/var/run/sysinv-api.pid + +[Install] +WantedBy=multi-user.target diff --git a/sysinv/sysinv/debian/deb_folder/sysinv-conductor.service b/sysinv/sysinv/debian/deb_folder/sysinv-conductor.service new file mode 100644 index 0000000000..7c0dae1eee --- /dev/null +++ b/sysinv/sysinv/debian/deb_folder/sysinv-conductor.service @@ -0,0 +1,15 @@ +[Unit] +Description=System Inventory Conductor +After=network-online.target syslog-ng.service config.service rabbitmq-server.service + +[Service] +Type=simple +RemainAfterExit=yes +User=root +Environment=OCF_ROOT=/usr/lib/ocf +ExecStart=/usr/lib/ocf/resource.d/platform/sysinv-conductor start +ExecStop=/usr/lib/ocf/resource.d/platform/sysinv-conductor stop +PIDFile=/var/run/sysinv-conductor.pid + +[Install] +WantedBy=multi-user.target diff --git a/sysinv/sysinv/debian/deb_folder/sysinv.install b/sysinv/sysinv/debian/deb_folder/sysinv.install index 18442de6d1..8f08036c58 100644 --- a/sysinv/sysinv/debian/deb_folder/sysinv.install +++ b/sysinv/sysinv/debian/deb_folder/sysinv.install @@ -6,8 +6,6 @@ etc/sysinv/crushmap-aio-sx.txt etc/sysinv etc/sysinv/delete_load.sh etc/sysinv/upgrades scripts/sysinv-api usr/lib/ocf/resource.d/platform scripts/sysinv-conductor usr/lib/ocf/resource.d/platform -scripts/sysinv-api.service lib/systemd/system -scripts/sysinv-conductor.service lib/systemd/system scripts/partition_info.sh usr/bin scripts/validate-platform-backup.sh usr/bin scripts/manage-partitions usr/bin