nova-api和cinder-api都提供了创建卷的api,图1是使用nova client创建卷的流程,把nova client和nova-api替换成cinder client后即是cinder client创建卷的流程。
图中约定:
图1 create volume flow
1:nova volume-create
nova client向nova-api发送创建卷的http请求;
1.1: parse request body
class VolumeController的create方法(nova-stable-havana/nova/api/openstack/compute/contrib/volumes.py)
1.2: create volume
class API的create方法(nova-stable-havana/nova/volume/cinder.py)
1.2.1: parse request body
class VolumeController中create方法(cinder-stable-havana/cinder/api/v1/volumes.py)
1.2.2: build create volume flow
class API中create方法(cinder-stable-havana/cinder/volume/api.py)
get_api_flow函数(cinder-stable-havana/cinder/volume/flows/create_volume/__init__.py)
1.2.3: create volume(cast)
class VolumeAPI中create_volume(cinder-stable-havana/cinder/volume/rpcapi.py)
1.2.3.1: schedule request
class SchedulerManager中create_volume方法(cinder-stable-havana/cinder/scheduler/manager.py)
get_scheduler_flow函数(cinder-stable-havana/cinder/volume/flows/create_volume/__init__.py)
1.2.3.2: create volume(cast)
class FilterScheduler中FilterScheduler方法(cinder-stable-havana/cinder/scheduler/filter_scheduler.py)
class VolumeManager中create_volume方法(cinder-stable-havana/cinder/volume/manager.py)
1.2.3.2.1: build create volume flow
get_manager_flow函数(cinder-stable-havana/cinder/volume/flows/create_volume/__init__.py)
1.2.3.2.2: create volume
class VolumeDriver中create_volume方法(cinder-stable-havana/cinder/volume)
1.2.3.2.2.1: create volume now
后端存储系统创建卷的方式各不相同,具体实现方式参见相应driver的实现
1.2.3.2.2.2: volume created
卷创建成功,反回
1.2.3.2.3: export volume and update database
导出卷并且更新相应的数据库
1.2.4: volume creating
卷创建请求是异步的,将请求发给cinder-api后不会等待卷创建成功后再返回,而是直接返回正在创建的卷的信息
1.3: volume creating