48 lines
1.9 KiB
Plaintext
48 lines
1.9 KiB
Plaintext
#
|
|
# Upload the cirros image to the controllers:
|
|
# scp ../cirros/cirros-0.3.0-x86_64-disk.img root@192.168.204.3:/root
|
|
|
|
TENANT_ID=`openstack token issue | grep "| project_id |" | cut -f3 -d'|' | tr -d '[[:space:]]'`
|
|
TOKEN_ID=`openstack token issue | grep "| id |" | cut -f3 -d'|' | tr -d '[[:space:]]'`
|
|
|
|
1. Create an Image
|
|
------------------
|
|
cat > image_request.txt
|
|
{"name": "my-cirros", "container_format": "bare",
|
|
"disk_format": "qcow2", "properties": "{\"test\": \"test\"}",
|
|
"image_data_ref": "file://root/cirros-0.3.0-x86_64-disk.img"}
|
|
|
|
curl -i -X POST -H 'Content-Type: application/json' -H "X-Auth-Token: ${TOKEN_ID}" -H 'Accept: application/json' \
|
|
http://localhost:4545/api/virtualised-resources/images -d @image_request.txt
|
|
|
|
2. Delete an Image
|
|
------------------
|
|
IMAGE_UUID=be865b01-4264-4198-a47f-da33f80b3146
|
|
|
|
curl -i -X DELETE -H 'Content-Type: application/json' -H "X-Auth-Token: ${TOKEN_ID}" -H 'Accept: application/json' \
|
|
http://localhost:4545/api/virtualised-resources/images/${IMAGE_UUID}
|
|
|
|
3. Change Image Data
|
|
--------------------
|
|
IMAGE_UUID=be865b01-4264-4198-a47f-da33f80b3146
|
|
|
|
cat > image_change_request.txt
|
|
{"description": "new cirros image", "minimum_disk_size": "1", "minimum_memory_size": "512",
|
|
"visibility": "private", "protected": false}
|
|
|
|
curl -i -X PUT -H 'Content-Type: application/json' -H "X-Auth-Token: ${TOKEN_ID}" -H 'Accept: application/json' \
|
|
http://localhost:4545/api/virtualised-resources/images/${IMAGE_UUID} -d @image_change_request.txt
|
|
|
|
4. Get an Image
|
|
---------------
|
|
IMAGE_UUID=be865b01-4264-4198-a47f-da33f80b3146
|
|
|
|
curl -i -X GET -H 'Content-Type: application/json' -H "X-Auth-Token: ${TOKEN_ID}" -H 'Accept: application/json' \
|
|
http://localhost:4545/api/virtualised-resources/images/${IMAGE_UUID}
|
|
|
|
5. Get Images
|
|
-------------
|
|
curl -i -X GET -H "X-Auth-Token: ${TOKEN_ID}" -H 'Accept: application/json' \
|
|
http://localhost:4545/api/virtualised-resources/images
|
|
|