块存储服务:提供实时的读写功能,端口号8776
Cinder架构: 1.cinder-api:run on controller node 向外部提供RestfulAPI,是一个WSGI服务。 API节点只是接受请求,并不执行相应的操作,当执行某些操作的时候,API节点会通过RabbitMQ,将信息转发至相应的节点上,完成操作。 PS:API节点上提供了RestfulAPI,除此之外的其他节点都是通过RabbitMQ进行通信的。 2.cinder-scheduler daemon:run on controllernode 提供调度服务。Cinder块存储系统中可以存在多个Scheduler节点 3.cinder-volume:run on controllernode,compute node or standalone stroage node Volume节点主要是提供实时的读写操作等真正的块存储服务,意味着CInder服务提供的磁盘存储空间是位于Volume Node的。可以支持各种Cinder driver:NAS/SAN,NFS,ISCS,Ceph 4.cidner-backup daemon 提供了volume的备份功能 5.Messaging queue 在Blockstorage中传递信息 优点:模块之间可以灵活地相互协调工作,使得架构容易扩展 缺点:所有模块都严重依赖RabbitMQ消息通信机制
快操作API统计 操作类: 1.创建块设备(包括从快照恢复出块设备,可以指定块设备availability zone。需要提供用户ID) 2.删除块设备(需要提供用户ID和块设备ID) 3.挂载块设备(需要指定用户ID、云主机ID、块设备ID) 4.卸载块设备(需要指定用户ID、云主机ID、块设备ID) 5.给块设备创建快照(需要提供用户ID和块设备ID) 6.删除快照(需要提供用户ID和快照ID) 查询类: 1.列出云主机上挂载的块设备(需要指定用户ID和云主机ID) 2.根据云主机ID及挂载在其上的块设备ID查询挂载详细信息(需要指定用户ID、云主机ID、块设备ID) 3.查询用户所有的块设备(需要提供用户ID) 4.根据块设备ID查询用户某个块设备的详细信息(需要提供用户ID和块设备ID) 5.查询用户所有的块设备快照(需要提供用户ID) 6.查询用户所有的块设备快照详细信息(需要提供用户ID和快照ID)
创建一个Volume步骤: 1.Client向cinder-api发送创建Volume的请求(此处是通过RestfulAPI进行通信) 2.cinder-api接收到此此请求之后,检查并验证此请求是否合法 3.API节点将合法的请求转给Scinder-scheduler(此处采用RabbitMQ消息转发机制进行远程函数调用)。如果存在多个Scheduler节点,随机选择其中一个,向此节点转发消息 4.接收到消息的cinder-scheduler会查看正常运行的cinder-volume,然后将创建Volume的消息转发到一个合适的Volume节点 5.被cinder-scheduler选中的Volume节点会准备资源并创建Volume,然后返回创建的结果 6.之前的cinder-scheduler接收到创建结果,返回给cinder-api,然后再返回给Client
Block Storage API v2 API version List API versions curl-s http://controller:8776/ | python -mjson.tool Show API versiondetails curl-s http://controller:8776/v2 | python -mjson.tool API extensions List API extensions curl-s -H "X-Auth-Token:$user_token" http://controller:8776/v2/{tenant_id}/extensions| python -mjson.tool Limits Show absolute limits curl-s -H "X-Auth-Token: $user_token " http://controller:8776/v2/{tenant_id}/limits| python -mjson.tool Volumes Create volume curl-s -H "Content-Type: application/json" -H "X-Auth-Token: $user_token" -d '{"volume": {"status":"creating","description": "this newvolume","availability_zone": null,"source_volid":null,"consistencygroup_id": null,"snapshot_id":null,"source_replica": null,"size": 1,"user_id": null,"name":"new volume","imageRef": null,"attach_status":"detached","volume_type": null,"project_id":null,"metadata": {}}}' http://controller:8776/v2/{tenant_id}/volumes| python -mjson.tool List volumes curl-s -H "X-Auth-Token: $user_token " http://controller:8776/v2/{tenant_id}/volumes| python -mjson.tool List volumes(detailed) curl-s -H "X-Auth-Token: $user_token " http://controller:8776/v2/{tenant_id}/volumes/detail| python -mjson.tool Show volumeinformation curl-s -H "X-Auth-Token: $user_token " http://controller:8776/v2/{tenant_id}/volumes/{volume_id} | python -mjson.tool Update volume curl-s -X PUT -H "Content-Type: application/json" -H "X-Auth-Token: $user_token" -d '{"volume":{"name":"vol-001","description":"this is ananother new volume insteat."}}' http://controller:8776/v2/{tenant_id}/volumes/{volume_id}| python -mjson.tool Delete volume curl-s -X DETELE -H "X-Auth-Token:$user_token "http://controller:8776/v2/{tenant_id}/volumes/{volume_id} | python-mjson.tool Volume type access Create private volume curl-s -H "Content-Type: application/json" -H "X-Auth-Token: $user_token" -d '{"volume": {"availability_zone":null,"source_volid": null,"description": "privatevolume","snapshot_id": null,"size":1,"name": "my_volume","imageRef":null,"volume_type": null,"metadata":{},"os-volume-type-access: is_public": false}}'http://controller:8776/v2/{tenant_id}/volumes | python -mjson.tool Volume actions Extend volume curl-s -H "Content-Type: application/json" -H "X-Auth-Token: $user_token" -d '{"os-extend": {"new_size": 2}}'http://controller:8776/v2/{tenant_id}/volumes/{volume_id}/action Reset volume statuses curl-s -H "Content-Type: application/json" -H "X-Auth-Token: $user_token" -d ' {"os-reset_status": {"status":"available","attach_status":"detached","migration_status": "migrating"}}'http://controller:8776/v2/{tenant_id}/volumes/{volume_id}/action Set image metadatafor volume curl-s -H "Content-Type: application/json" -H "X-Auth-Token: $user_token" -d ' {"os-set_image_metadata":{"metadata":{"image_id":"521752a6-acf6-4b2d-bc7a-119f9148cd8c","image_name":"image","kernel_id":"155d900f-4e14-4e4c-a73d-069cbf4541e6","ramdisk_id":"somedisk"}}}'http://controller:8776/v2/{tenant_id}/volumes/{volume_id}/action Remove image metadatafrom volume curl-s -H "Content-Type: application/json" -H "X-Auth-Token: $user_token" -d '{"os-unset_image_metadata":{"key":"ramdisk_id"}}'http://controller:8776/v2/{tenant_id}/volumes/{volume_id}/action Attach volume curl-s -H "Content-Type: application/json" -H "X-Auth-Token: $user_token" -d '{"os-attach":{"instance_uuid":"95D9EF50-507D-11E5-B970-0800200C9A66","host_name":"cinder-2","mountpoint":"/dev/vdc"}}' http://controller:8776/v2/{tenant_id}/volumes/{volume_id}/action Unmanage volume curl-s -H "Content-Type: application/json" -H "X-Auth-Token: $user_token" -d ' {"os-unmanage": {}}'http://controller:8776/v2/{tenant_id}/volumes/{volume_id}/action Backups Create backup List backups curl–s -H "X-Auth-Token: $user_token" http://controller:8776/v2/{tenant_id}/backups| python -mjson.tool List backups(detailed) curl–s -H "X-Auth-Token: $user_token" http://controller:8776/v2/{tenant_id}/backups/detail| python -mjson.tool Show backup details curl–s -H "X-Auth-Token: $user_token" http://controller:8776/v2/{tenant_id}/backups/{backup_id}| python -mjson.tool Delete backup curl-s -X DETELE -H "X-Auth-Token:$user_token" http://controller:8776/v2/{tenant_id}/backups/{backup_id}
Volume types List volume types curl-s -H "X-Auth-Token: $user_token " http://controller:8776/v2/{tenant_id}/types| python -mjson.tool Create volume type curl-s -H "Content-Type: application/json" -H "X-Auth-Token: $user_token" -d '{"volume_type": {"name":"vol-type-001","extra_specs": {"capabilities":"gpu"}}}' http://controller:8776/v2/{tenant_id}/types | python-mjson.tool Update volume type curl-s -X PUT -H "Content-Type: application/json" -H "X-Auth-Token: $user_token" -d '{"volume_type":{"description":"volumetype","name":"vol-type-001","extra_specs":{"capabilities":"gpu"}}}' http://controller:8776/v2/{tenant_id}/types/{types_id} |python -mjson.tool Show volume typeinformation curl-s -H "X-Auth-Token: $user_token " http://controller:8776/v2/{tenant_id}/types/{types_id}| python -mjson.tool Delete volume type Volume snapshots Create snapshot curl-s -H "Content-Type: application/json" -H "X-Auth-Token: $user_token" -d '{"snapshot": {"name":"snap-001","description": "Dailybackup","volume_id":"{volume_id}","force":true}}' http://controller:8776/v2//{tenant_id}/snapshots | python -mjson.tool List snapshots curl-s -H "X-Auth-Token: $user_token "http://controller:8776/v2/{tenant_id}/snapshots | python -mjson.tool List snapshots(detailed) curl-s -H "X-Auth-Token: $user_token "http://controller:8776/v2/{tenant_id}/snapshots/detail | python -mjson.tool Show snapshotinformation curl-s -H "X-Auth-Token: $user_token " http://controller:8776/v2/{tenant_id}/snapshots/{snapshot_id} | python -mjson.tool Update snapshot curl-s -H "Content-Type: application/json" -H "X-Auth-Token: $user_token" -d '{"snapshot": {"name": "snap-002","description":"another snapshot", }}'http://controller:8776/v2//{tenant_id}/snapshots/{snapshot_id} | python-mjson.tool Delete snapshot curl-s -X DETELE -H "X-Auth-Token: $user_token" http://controller:8776/v2//{tenant_id}/snapshots/{snapshot_id} Show snapshotmetadata curl-s -H "X-Auth-Token: $user_token " http://controller:8776/v2/{tenant_id}/snapshots/{snapshot_id}/metadata | python -mjson.tool Update snapshotmetadata curl-s -X PUT -H "Content-Type: application/json" -H "X-Auth-Token: $user_token" -d '{"metadata": {"key": "v2"}}'http://controller:8776/v2/{tenant_id}/snapshots/{snapshot_id}/metadata |python -mjson.tool Volume manage extension Manage existingvolume curl-s -X PUT -H "Content-Type: application/json" -H "X-Auth-Token:$user_token " -d '{"volume": {"host":"geraint-VirtualBox","ref":{"source-volume-name": "existingLV","source-volume-id":"1234"},"name": "NewVolume","availability_zone":"az2","description": "Volume imported fromexistingLV","volume_type": null,"bootable":"True","metadata": {"key1":"value1","key2": "value2"}}}'http://controller:8776/v2/{tenant_id}/os-volume-manage Volume image metadataextension Show image metadatafor volume curl-s -H "Content-Type: application/json" -H "X-Auth-Token:$user_token " -d '{"volume": {"host":"geraint-VirtualBox","ref":{"source-volume-name": "existingLV","source-volume-id":"1234"},"name": "NewVolume","availability_zone":"az2","description": "Volume imported fromexistingLV","volume_type": null,"bootable":"True","metadata": {"key1":"value1","key2": "value2"}}}'http://controller:8776/v2/{tenant_id}/os-volume-manage
|