Creating Mirrors with the OpenStack Rest API

Source: Internet
Author: User

Service endpoint:

Image

Api:

Post/v2/images

Request1:

Method:P OST

Url: http://192.168.31.147:9292/v2/images

Headers:

content-type:application/JsonX-auth-token:4e045ef71a994f8d8caeeab683a11419

Body:

{    "name""registry:5000/centos:v1.0",     " Container_format " " Docker " ,     " Disk_format " " Raw " }
REPONSE1:

Headers:

201

Body:

{    "Status":"Queued",    "name":"registry:5000/centos:v1.0",    "Tags": [],    "Container_format":"Docker",    "Created_at":"2015-05-22t06:38:10z",    "Disk_format":"Raw",    "Updated_at":"2015-05-22t06:38:10z",    "Visibility":"Private",    " Self":"/v2/images/0482eff2-8406-46a7-8bbb-d43e1ca9c14f",    "Min_disk":0,    "protected":false,    "ID":"0482eff2-8406-46a7-8bbb-d43e1ca9c14f",    "file":"/v2/images/0482eff2-8406-46a7-8bbb-d43e1ca9c14f/file",    "owner":"67f095375f414c3b8fde844a5e08b88e",    "Min_ram":0,    "Schema":"/v2/schemas/image"}

Request2:
" X-AUTH-TOKEN:94F2B7BF4CEE4F2C9D2BBE1F2CA785A2 " " Content-type:application/octet-stream "  --upload-file /home/centos. tar http://192.168.31.147:9292/v2/images/0482eff2-8406-46a7-8bbb-d43e1ca9c14f/file
REPONSE2:

Headers:

http/1.1  continuehttp/1.1204  No contentcontent-type:text /html; charset=utf-8Content0X-openstack-request-id:req-98582037-dca6- 4792-8d4a-: £ º GMT

Personal Impressions: OpenStack website to create the image of the API description is really few ah, and only the first step, is the above mentioned Request1. Request2 is the author of Dickens to find, and a start data source upload with the-D @/home/centos.tar this option, but after repeated testing, this option TM upload file is incomplete, 800M files can only upload 230M, repeatedly find problems can not find , and eventually replaced with the--upload-file option, the upload succeeds, and the instance is started normally based on this image.

In addition, for curl in the--upload-file option how to turn into a normal httpclient request, I have no clue, please help us .

Creating Mirrors with the OpenStack Rest API

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.