才疏学浅,若有不当之处敬请雅正, 本文适合刚刚开始看Nova源码的人,先把整个流程串一下,后面再详细介绍一下。
Nova 接收用户请求的入口:nova/api/compute/servers.py
nova/api/compute/servers.py
class ServersController(wsgi.Controller):
"""The Server API base controller class for the OpenStack API."""
.........................
def create(self, req, body):
"""Creates a new server for a given user."""
................................
(instances, resv_id) = self.compute_api.create(context,.....................................
inst_type,
image_uuid,
display_name=name,
display_description=description,
availability_zone=availability_zone,
forced_host=host, forced_node=node,
metadata=server_dict.get('metadata', {}),
admin_password=password,
requested_networks=requested_networks,
check_server_group_quota=True,
**create_kwargs)
class API(base.Base):
"""API for interacting with the compute manager."""
............................................................
def create(self,------------):............................................................
"""Provision instances, sending instance information to the
scheduler. The scheduler will determine where the instance(s)
go and will handle creating the DB entries.
return self._create_instance(跳转到本文件的_create_
context, instance_type,
image_href, kernel_id, ramdisk_id,
min_count, max_count,
display_name, display_description,
key_name, key_data, security_groups,
availability_zone, user_data, metadata,
injected_files, admin_password,
access_ip_v4, access_ip_v6,
requested_networks, config_drive,
block_device_mapping, auto_disk_config,
filter_properties=filter_properties,
legacy_bdm=legacy_bdm,
shutdown_terminate=shutdown_terminate,
check_server_group_quota=check_server_group_quota)