文章目录
启动 流程
1. cinder/cmd/scheduler.py
创建 一个 服务 并 等待 它的 退出
server = service.Service.create(binary='cinder-scheduler')
service.serve(server)
service.wait()
2. cinder/service.py
2.1 Class Service : create
在 类 init 之前 执行 , 主要 对 topic 进行了 初始化
从而 拼接 得到了 manager = ‘scheduler_manager’
if not host:
host = CONF.host
if not binary:
binary = os.path.basename(inspect.stack()[-1][1])
if not topic:
topic = binary
if not manager:
subtopic = topic.rpartition('cinder-')[2]
manager = CONF.get('%s_manager' % subtopic, None)
# (Pdb) !print(manager)
# cinder.scheduler.manager.SchedulerManager
2.2 Class Service : init
self.manager_class_name = manager
manager_class = importutils.import_class(self.manager_class_name)