Start the process
1. cinder/cmd/scheduler.py
Create a service and wait for its exit
server = service.Service.create(binary='cinder-scheduler')
service.serve(server)
service.wait()
Copy the code
2. cinder/service.py
2.1 Class Service: create
Executed before init, the main topic is initialized to concatenate 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
Copy the code
2.2 Class Service: init
self.manager_class_name = manager
manager_class = importutils.import_class(self.manager_class_name)
Copy the code