镜像创建

POST /v2/images

Request

名称 位于 类型 描述
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
curl \
-X POST \
-H 'Content-Type: application/json; charset=UTF-8' \
-H 'X-Auth-Token: 1f682c33d4ed442faecd6103f42fb9eb' \
-d '{
"container_format": "bare",
"disk_format": "qcow2",
"min_disk": 10,
"min_ram": 1024,
"name": "image_test",
"protected": false,
"visibility": "public",
"image_label": "CentOS",
"image_type": "distribution"
}' \
http://2.3.3.54:9292/v2/images | python -m json.tool

Response

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{
"checksum": null,
"container_format": "bare",
"created_at": "2019-05-15T02:30:31Z",
"disk_format": "qcow2",
"file": "/v2/images/993bc534-3973-492c-979b-403aea654fd0/file",
"id": "993bc534-3973-492c-979b-403aea654fd0",
"locations": [],
"min_disk": 10,
"min_ram": 1024,
"name": "image_test",
"owner": "e1163a30a063441cad01e392be6eb57e",
"protected": false,
"schema": "/v2/schemas/image",
"self": "/v2/images/993bc534-3973-492c-979b-403aea654fd0",
"size": null,
"status": "queued",
"tags": [],
"updated_at": "2019-05-15T02:30:31Z",
"virtual_size": null,
"visibility": "public"
}

镜像上传

PUT /v2/images/{image_id}/file

a
1
2
3
4
5
6
curl -i \
-X PUT \
-H "X-Auth-Token: 1f682c33d4ed442faecd6103f42fb9eb" \
-H "Content-Type: application/octet-stream" \
-d @/root/images/centos7.qcow2 \
http://2.3.3.54:9292/v2/images/993bc534-3973-492c-979b-403aea654fd0/file| python -m json.tool