共计 5708 个字符,预计需要花费 15 分钟才能阅读完成。
这篇文章将为大家详细讲解有关 OpenStack Nova 调度服务学习及其过滤器编写的示例分析,丸趣 TV 小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。
初步分析查看相关进程
$ ps -aux | grep nova | awk {for(i=11;i i++) printf %s , $i};NF =11 {print }
/usr/bin/python /usr/bin/nova-compute --config-file=/etc/nova/nova.conf --config-file=/etc/nova/nova-compute.conf
--log-file=/var/log/nova/nova-compute.log
/usr/bin/python /usr/bin/nova-api --config-file=/etc/nova/nova.conf --log-file=/var/log/nova/nova-api.log
/usr/bin/python /usr/bin/nova-conductor --config-file=/etc/nova/nova.conf --log-file=/var/log/nova/nova-conductor.log
/usr/bin/python /usr/bin/nova-scheduler --config-file=/etc/nova/nova.conf --log-file=/var/log/nova/nova-scheduler.log
/usr/bin/python /usr/bin/nova-consoleauth --config-file=/etc/nova/nova.conf --log-file=/var/log/nova/nova-consoleauth.log
/usr/bin/python /usr/bin/nova-novncproxy --config-file=/etc/nova/nova.conf --log-file=/var/log/nova/nova-novncproxy.log
/usr/bin/python /usr/bin/nova-conductor --config-file=/etc/nova/nova.conf --log-file=/var/log/nova/nova-conductor.log
/usr/bin/python /usr/bin/nova-conductor --config-file=/etc/nova/nova.conf --log-file=/var/log/nova/nova-conductor.log
/usr/bin/python /usr/bin/nova-api --config-file=/etc/nova/nova.conf --log-file=/var/log/nova/nova-api.log
/usr/bin/python /usr/bin/nova-api --config-file=/etc/nova/nova.conf --log-file=/var/log/nova/nova-api.log
/usr/bin/python /usr/bin/nova-api --config-file=/etc/nova/nova.conf --log-file=/var/log/nova/nova-api.log
/usr/bin/python /usr/bin/nova-api --config-file=/etc/nova/nova.conf --log-file=/var/log/nova/nova-api.log
/usr/bin/python2.7 /usr/bin/privsep-helper --config-file /etc/nova/nova.conf --config-file /etc/nova/nova-compute.conf
--privsep_context vif_plug_linux_bridge.privsep.vif_plug --privsep_sock_path /tmp/tmpZtOLbU/privsep.sock
/usr/bin/python2.7 /usr/bin/privsep-helper --config-file /etc/nova/nova.conf --config-file /etc/nova/nova-compute.conf
--privsep_context os_brick.privileged.default --privsep_sock_path /tmp/tmpjXCHkt/privsep.sock
pluma /usr/lib/python2.7/dist-packages/nova/scheduler/filters/retry_filter.py
查看相关服务
查看所有 Nova 服务:
$ systemctl list-units | grep nova
nova-api.service loaded active running OpenStack Compute API
nova-compute.service loaded active running OpenStack Compute
nova-conductor.service loaded active running OpenStack Compute Conductor
nova-consoleauth.service loaded active running OpenStack Compute Console
nova-novncproxy.service loaded active running OpenStack Compute novncproxy
nova-scheduler.service loaded active running OpenStack Compute Scheduler
查看服务所属软件包:
$ apt-get install apt-file
$ apt-file update
$ apt-file search /lib/systemd/system/nova-api.service
nova-api: /lib/systemd/system/nova-api.service
$ apt-file search /lib/systemd/system/nova-compute.service
nova-compute: /lib/systemd/system/nova-compute.service
$ apt-file search /lib/systemd/system/nova-conductor.service
nova-conductor: /lib/systemd/system/nova-conductor.service
$ apt-file search /lib/systemd/system/nova-consoleauth.service
nova-consoleauth: /lib/systemd/system/nova-consoleauth.service
$ apt-file search /lib/systemd/system/nova-novncproxy.service
nova-novncproxy: /lib/systemd/system/nova-novncproxy.service
$ apt-file search /lib/systemd/system/nova-scheduler.service
nova-scheduler: /lib/systemd/system/nova-scheduler.service
查看 Nova 调度器服务状态:
$ systemctl status nova-scheduler.service
● nova-scheduler.service - OpenStack Compute Scheduler
Loaded: loaded (/lib/systemd/system/nova-scheduler.service; enabled; vendor preset: enabled)
Active: active (running) since 三 2017-12-06 23:23:39 CST; 10h ago
Process: 3150 ExecStartPre=/bin/chown nova:adm /var/log/nova (code=exited, status=0/SUCCESS)
Process: 3076 ExecStartPre=/bin/chown nova:nova /var/lock/nova /var/lib/nova (code=exited, status=0/SUCCESS)
Process: 3016 ExecStartPre=/bin/mkdir -p /var/lock/nova /var/log/nova /var/lib/nova (code=exited, status=0/SUCCESS)
Main PID: 3241 (nova-scheduler)
CGroup: /system.slice/nova-scheduler.service
└─3241 /usr/bin/python /usr/bin/nova-scheduler --config-file=/etc/nova/nova.conf
--log-file=/var/log/nova/nova-scheduler.
12 月 07 09:59:13 UbuntuStack nova-scheduler[3241]: 2017-12-07 09:59:13.690 3241 INFO
nova.scheduler.host_manager [req-27631738-6333-
...
查看 Nova 调度器服务配置脚本:
$ cat /lib/systemd/system/nova-scheduler.service
[Unit]
Description=OpenStack Compute Scheduler
After=postgresql.service mysql.service keystone.service
[Service]
User=nova
Group=nova
Type=simple
WorkingDirectory=/var/lib/nova
PermissionsStartOnly=true
ExecStartPre=/bin/mkdir -p /var/lock/nova /var/log/nova /var/lib/nova
ExecStartPre=/bin/chown nova:nova /var/lock/nova /var/lib/nova
ExecStartPre=/bin/chown nova:adm /var/log/nova
ExecStart=/etc/init.d/nova-scheduler systemd-start
Restart=on-failure
LimitNOFILE=65535
TimeoutStopSec=15
[Install]
WantedBy=multi-user.target
查看 Nove 调度器服务 init 脚本:
$ cat /etc/init.d/nova-scheduler
#!/bin/sh
### BEGIN INIT INFO
# Provides: nova-scheduler
# Required-Start: $network $local_fs $remote_fs $syslog
# Required-Stop: $remote_fs
# Should-Start: postgresql mysql keystone
# Should-Stop: postgresql mysql keystone
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Nova Scheduler
# Description: Schedules instances, volumes, etc. for Nova
### END INIT INFO
# Author: Julien Danjou acid@debian.org
DESC= OpenStack Compute Scheduler
PROJECT_NAME=nova
NAME=nova-scheduler
if [ -z ${DAEMON} ] ; then
DAEMON=/usr/bin/${NAME}
if [ -z ${NO_OPENSTACK_CONFIG_FILE_DAEMON_ARG} ] ; then
DAEMON_ARGS= --config-file=${CONFIG_FILE} ${DAEMON_ARGS}
do_systemd_start() {
exec $DAEMON $DAEMON_ARGS
systemd-start)
do_systemd_start
;;
exit 0
查看 Nova 调度器启动脚本:
$ cat /usr/bin/nova-scheduler
#!/usr/bin/python
# PBR Generated from u console_scripts
import sys
from nova.cmd.scheduler import main
正文完