Openstack的映象上傳原理

CL.TANG發表於2016-10-18

openstack的horizon的上傳映象流程

通過html的form表單上傳檔案

先上傳到horizon指定的臨時目錄,儲存起來

通過glance-api請求介面

實際上glance-api也是提供了一個上傳介面,由前面我們儲存的臨時目錄,上傳到glance-api的映象建立介面;

[root@node-8 images]# glance --debug image-create --name='test'  --is-public=true --disk-format=iso --container-format=ovf  < /root/Fedora-Live-XFCE-x86_64-19-1.iso 
curl -i -X POST -H 'x-image-meta-container_format: ovf' -H 'Transfer-Encoding: chunked' -H 'User-Agent: python-glanceclient' -H 'x-image-meta-size: 651165696' -H 'x-image-meta-is_public: True' -H 'X-Auth-Token: e410553372334a16841e1dfec0b95738' -H 'Content-Type: application/octet-stream' -H 'x-image-meta-disk_format: iso' -H 'x-image-meta-name: test' -d '<open file '<stdin>', mode 'r' at 0x7f8f8286b0c0>' http://172.17.49.12:9292/v1/images

HTTP/1.1 201 Created
content-length: 452
etag: 97c3604967d0ca46ccb4d58e3ecb991d
location: http://172.17.49.12:9292/v1/images/383eb420-5f68-4b47-809f-99f19b3690d3
date: Mon, 28 Jul 2014 02:53:09 GMT
content-type: application/json
x-openstack-request-id: req-aa8d3862-5a1e-4d35-ab2f-22550d832582

{"image": {"status": "active", "deleted": false, "container_format": "ovf", "min_ram": 0, "updated_at": "2014-07-28T02:53:09", "owner": "80c29c88d3c349a78d4ed558e224eac4", "min_disk": 0, "is_public": true, "deleted_at": null, "id": "383eb420-5f68-4b47-809f-99f19b3690d3", "size": 651165696, "name": "test", "checksum": "97c3604967d0ca46ccb4d58e3ecb991d", "created_at": "2014-07-28T02:52:55", "disk_format": "iso", "properties": {}, "protected": false}}

刪除dashboard的臨時儲存

當我們確定映象已經成功後,將刪除dashboard的臨時儲存目錄的映象。

相關文章