From cffeca42fa88c749f122b904ecc2e634d4911576 Mon Sep 17 00:00:00 2001
From: yangjiaqi <yangjiaqi16@huawei.com>
Date: Thu, 28 Dec 2023 15:56:47 +0800
Subject: [PATCH 71/71] iSulad: restart isuald when upgrade active isulad

Signed-off-by: yangjiaqi <yangjiaqi16@huawei.com>
---
 iSulad.spec | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/iSulad.spec b/iSulad.spec
index 0efbf043..71b61c8b 100644
--- a/iSulad.spec
+++ b/iSulad.spec
@@ -196,6 +196,16 @@ if [ -e %{_unitdir}/lcrd.service.rpmsave ]; then
     mv %{_unitdir}/lcrd.service.rpmsave %{_unitdir}/isulad.service
     sed -i 's/lcrd/isulad/g' %{_unitdir}/isulad.service
 fi
+# During the isulad upgrade process, the isulad service may still be running, but the service may be unavailable 
+# due to configuration updates and other reasons.
+# it may fail if the X package is upgraded synchronously with isulad and depends on the isulad command, 
+# For example syscontianer-tools and lxcfs-tools.
+# Therefore, after upgrading isulad, if the original status of isulad is running, 
+# we need to restart isulad to ensure that the service is available during the upgrade process.
+systemctl status isulad | grep 'Active:' | grep 'running'
+if [ $? -eq 0 ]; then
+  systemctl restart isulad
+fi
 %else
 /sbin/service isulad status | grep 'Active:' | grep 'running'
 if [ $? -eq 0 ]; then
-- 
2.25.1

