openstack组件服务的入口寻找方法
Posted potato-chip
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了openstack组件服务的入口寻找方法相关的知识,希望对你有一定的参考价值。
在centos7系统上,安装openstack服务以后,可以通过以下命令,查找到该系统上,已经安装的openstack服务
[[email protected] ~]# systemctl list-unit-files | grep openstack openstack-cinder-api.service enabled openstack-cinder-backup.service disabled openstack-cinder-scheduler.service enabled openstack-cinder-volume.service disabled openstack-glance-api.service enabled openstack-glance-glare.service disabled openstack-glance-registry.service enabled openstack-glance-scrubber.service disabled openstack-nova-api.service enabled openstack-nova-conductor.service enabled openstack-nova-console.service disabled openstack-nova-consoleauth.service disabled openstack-nova-metadata-api.service disabled openstack-nova-novncproxy.service enabled openstack-nova-os-compute-api.service disabled openstack-nova-scheduler.service enabled openstack-nova-xvpvncproxy.service disabled [[email protected] ~]#
neutron服务命名比较特殊,通过如下命令行进行查找
[[email protected] ~]# systemctl list-unit-files | grep neutron neutron-dhcp-agent.service disabled neutron-l3-agent.service disabled neutron-linuxbridge-cleanup.service disabled neutron-metadata-agent.service disabled neutron-netns-cleanup.service disabled neutron-openvswitch-agent.service disabled neutron-ovs-cleanup.service disabled neutron-server.service enabled
所有可用的单元文件存放在 /usr/lib/systemd/system/ 和 /etc/systemd/system/ 目录(后者优先级更高),openstack各服务的文件一般放在/usr/lib/systemd/system/目录下,命令如下:
[[email protected] ~]# ls -lh /usr/lib/systemd/system/ | grep openstack -rw-r--r-- 1 root root 343 Nov 12 2017 openstack-cinder-api.service -rw-r--r-- 1 root root 335 Nov 12 2017 openstack-cinder-backup.service -rw-r--r-- 1 root root 344 Nov 12 2017 openstack-cinder-scheduler.service -rw-r--r-- 1 root root 389 Nov 12 2017 openstack-cinder-volume.service -rw-r--r-- 1 root root 285 Mar 21 2017 openstack-glance-api.service -rw-r--r-- 1 root root 256 Mar 21 2017 openstack-glance-glare.service -rw-r--r-- 1 root root 258 Mar 21 2017 openstack-glance-registry.service -rw-r--r-- 1 root root 254 Mar 21 2017 openstack-glance-scrubber.service -rw-r--r-- 1 root root 230 Oct 15 10:43 openstack-nova-api.service -rw-r--r-- 1 root root 242 Oct 15 10:43 openstack-nova-conductor.service -rw-r--r-- 1 root root 251 Oct 15 10:43 openstack-nova-consoleauth.service -rw-r--r-- 1 root root 244 Oct 15 10:43 openstack-nova-console.service -rw-r--r-- 1 root root 248 Oct 15 10:43 openstack-nova-metadata-api.service -rw-r--r-- 1 root root 304 Oct 15 10:43 openstack-nova-novncproxy.service -rw-r--r-- 1 root root 248 Oct 15 10:43 openstack-nova-os-compute-api.service -rw-r--r-- 1 root root 242 Oct 15 10:43 openstack-nova-scheduler.service -rw-r--r-- 1 root root 216 Oct 15 10:43 openstack-nova-xvpvncproxy.service [[email protected] ~]# cd /usr/lib/systemd/system/ [[email protected] system]# pwd /usr/lib/systemd/system
查看neutron服务文件,ls -lh /usr/lib/systemd/system/ | grep neutron,命令行如下:
[[email protected] system]# ls -lh /usr/lib/systemd/system/ | grep neutron -rw-r--r-- 1 root root 516 Oct 15 11:23 neutron-dhcp-agent.service -rw-r--r-- 1 root root 512 Oct 15 11:23 neutron-l3-agent.service -rw-r--r-- 1 root root 1.1K Oct 15 11:23 neutron-linuxbridge-cleanup.service -rw-r--r-- 1 root root 536 Oct 15 11:23 neutron-metadata-agent.service -rw-r--r-- 1 root root 987 Oct 15 11:23 neutron-netns-cleanup.service -rw-r--r-- 1 root root 734 Oct 15 11:23 neutron-openvswitch-agent.service -rw-r--r-- 1 root root 1.0K Oct 15 11:23 neutron-ovs-cleanup.service -rw-r--r-- 1 root root 569 Oct 15 11:23 neutron-server.service
通过服务文件找对应的启动脚本
[[email protected] system]# cat openstack-nova-api.service [Unit] Description=OpenStack Nova API Server After=syslog.target network.target [Service] Type=notify NotifyAccess=all TimeoutStartSec=0 Restart=always User=nova ExecStart=/usr/bin/nova-api [Install] WantedBy=multi-user.target [[email protected] system]# pwd /usr/lib/systemd/system [[email protected] system]#
重点是红线部分,openstack-nova-api的启动命令,启动脚本为/usr/bin/nova-api
通过启动命令找对应的入口代码
[[email protected] system]# cat /usr/bin/nova-api #!/usr/bin/python2 # PBR Generated from u‘console_scripts‘ import sys from nova.cmd.api import main if __name__ == "__main__": sys.exit(main()) [[email protected] system]# pwd /usr/lib/systemd/system
以上是关于openstack组件服务的入口寻找方法的主要内容,如果未能解决你的问题,请参考以下文章