Openstack的镜像上传原理
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的临时存储目录的镜像。