【环境信息】
硬件信息:
1) 虚拟机 内存:4 GiB vCPU:1
软件信息:
openeulerversion=openEuler-21.03
compiletime=2021-02-23-17-45-36
gccversion=9.3.1-20210204.16.oe1
kernelversion=5.10.0-2.0.0.11.oe1
openjdkversion=1.8.0.282.b08-5.oe1
arch:arm x86
【问题复现步骤】
1、systemctl start vma
2、systemctl reload vma
出现概率:必现
【预期结果】
reload后的服务状态为active
【实际结果】
reload后的服务状态为inactive
【附件信息】
比如系统message日志/组件日志、dump信息、图片等
Hey street_dust, Welcome to openEuler Community.
All of the projects in openEuler Community are maintained by @openeuler-ci-bot.
That means the developers can comment below every pull request or issue to trigger Bot Commands.
Please follow instructions at https://gitee.com/openeuler/community/blob/master/en/sig-infrastructure/command.md to find the details.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
问题分析 :
这个问题历史版本就存在,reload其实执行的是restart,restart命令先执行stop,再执行start
……
[Service]
Type=forking
Restart=on-failure
ExecStart=@prefix@/sbin/vma start
ExecStop=@prefix@/sbin/vma stop
ExecReload=@prefix@/sbin/vma restart
RestartForceExitStatus=1 SIGTERM
……
……
function do_restart()
{
do_stop
do_start
}
……
case "$1" in
start)
do_check
do_start
;;
stop)
do_check
do_stop
;;
status)
do_status
;;
restart | force-reload)
do_check
do_restart
;;
*)
……
参考:
https://github.com/Mellanox/libvma/blob/5f3329b1ec20801785136d303e489644fcf330d5/contrib/scripts/vma.service.in
https://github.com/Mellanox/libvma/blob/5f3329b1ec20801785136d303e489644fcf330d5/contrib/scripts/vma.init.in
解决思路 :
[root@localhost ipsec.d]# systemctl start vma
[root@localhost ipsec.d]# systemctl status vma
● vma.service - VMA Daemon. Version: 8.9.4-0
Loaded: loaded (/usr/lib/systemd/system/vma.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2021-03-08 18:45:33 CST; 5s ago
Process: 51017 ExecStart=/usr/sbin/vma start (code=exited, status=0/SUCCESS)
Main PID: 51023 (vmad)
Tasks: 1 (limit: 1428)
Memory: 1.9M
CGroup: /system.slice/vma.service
└─51023 /usr/sbin/vmad
3月 08 18:45:32 localhost.localdomain systemd[1]: Starting VMA Daemon. Version: 8.9.4-0...
3月 08 18:45:33 localhost.localdomain vma[51017]: Starting vmad: [ OK ]
3月 08 18:45:33 localhost.localdomain systemd[1]: Started VMA Daemon. Version: 8.9.4-0.
[root@localhost ipsec.d]# systemctl reload vma
[root@localhost ipsec.d]# systemctl status vma
● vma.service - VMA Daemon. Version: 8.9.4-0
Loaded: loaded (/usr/lib/systemd/system/vma.service; enabled; vendor preset: disabled)
Active: inactive (dead) since Mon 2021-03-08 18:45:51 CST; 1s ago
Process: 51017 ExecStart=/usr/sbin/vma start (code=exited, status=0/SUCCESS)
Process: 51029 ExecReload=/usr/sbin/vma restart (code=exited, status=0/SUCCESS)
Process: 51040 ExecStop=/usr/sbin/vma stop (code=exited, status=0/SUCCESS)
Main PID: 51023 (code=exited, status=0/SUCCESS)
3月 08 18:45:32 localhost.localdomain systemd[1]: Starting VMA Daemon. Version: 8.9.4-0...
3月 08 18:45:33 localhost.localdomain vma[51017]: Starting vmad: [ OK ]
3月 08 18:45:33 localhost.localdomain systemd[1]: Started VMA Daemon. Version: 8.9.4-0.
3月 08 18:45:48 localhost.localdomain systemd[1]: Reloading VMA Daemon. Version: 8.9.4-0.
3月 08 18:45:49 localhost.localdomain vma[51029]: Shutting down vmad: [ OK ]
3月 08 18:45:49 localhost.localdomain vmad[51037]: [INFO ] Starting
3月 08 18:45:50 localhost.localdomain vma[51029]: Starting vmad: [ OK ]
3月 08 18:45:51 localhost.localdomain vma[51040]: Shutting down vmad: [ OK ]
3月 08 18:45:51 localhost.localdomain systemd[1]: vma.service: Succeeded.
3月 08 18:45:51 localhost.localdomain systemd[1]: Reloaded VMA Daemon. Version: 8.9.4-0.
vma[51029]先执行stop,然后执行start,之后vma[51040]又执行了stop
多执行的stop,目前未找到原因……
解决方法:
21.03分支PR:!7:Remove ExecReload that is not supported
systemctl reload官方用法是加载服务自身的配置文件,比如xxx.conf、xxxrc,这里的reload按照restart的用法做了,而restart本身就存在,一是重复,二是用法不合理,三是这个命令有问题。
目前libvma本身没有加载配置文件的机制,即不支持这个功能,所以移除。
参考reload官方定义如下 :
reload PATTERN…
Asks all units listed on the command line to reload their configuration.
Note that this will reload the service-specific configuration, not the unit configuration file of systemd.
If you want systemd to reload the configuration file of a unit, use the daemon-reload command.
In other words: for the example case of Apache, this will reload Apache's httpd.conf in the web server, not the apache.service systemd unit file.
This command should not be confused with the daemon-reload command.
https://www.freedesktop.org/software/systemd/man/systemctl.html
备注:其它发行版皆是不支持reload命令的
验证结果:
[root@localhost ipsec.d]# systemctl start vma
[root@localhost ipsec.d]# systemctl status vma
● vma.service - VMA Daemon. Version: 8.9.4-0
Loaded: loaded (/usr/lib/systemd/system/vma.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2021-03-10 10:33:50 CST; 1s ago
Process: 58587 ExecStart=/usr/sbin/vma start (code=exited, status=0/SUCCESS)
Main PID: 58593 (vmad)
Tasks: 1 (limit: 1428)
Memory: 2.0M
CGroup: /system.slice/vma.service
└─58593 /usr/sbin/vmad
3月 10 10:33:49 localhost.localdomain systemd[1]: Starting VMA Daemon. Version: 8.9.4-0...
3月 10 10:33:49 localhost.localdomain vmad[58592]: [INFO ] Starting
3月 10 10:33:50 localhost.localdomain vma[58587]: Starting vmad: [ OK ]
3月 10 10:33:50 localhost.localdomain systemd[1]: Started VMA Daemon. Version: 8.9.4-0.
[root@localhost ipsec.d]# systemctl reload vma
Failed to reload vma.service: Job type reload is not applicable for unit vma.service.
登录 后才可以发表评论