1. Create a Cinder volume from a base image:
# glance image-list # cinder create --image-id 2dfb6cd2-7a63-4c28-940e-b730969d3040 1
2. After modify the base image, create and upload the newly customized image to Glance:
# cinder list +--------------------------------------+-----------+--------------+------+-------------+----------+-------------+ | ID | Status | Display Name | Size | Volume Type | Bootable | Attached to | +--------------------------------------+-----------+--------------+------+-------------+----------+-------------+ | d7d2abfa-d882-45a3-ac80-ddb24631f666 | available | None | 1 | None | true | | +--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
NOTE: By default the image disk format will be "raw". If your image disk format is not "raw", specify the --disk-format option.
# cinder upload-to-image d7d2abfa-d882-45a3-ac80-ddb24631f666 myCirrosImage --disk-format qcow2 +---------------------+--------------------------------------+ | Property | Value | +---------------------+--------------------------------------+ | container_format | bare | | disk_format | qcow2 | | display_description | None | | id | d7d2abfa-d882-45a3-ac80-ddb24631f666 | | image_id | 04ab89ab-e4e7-4389-bd46-e9e6aaf6de39 | | image_name | myCirrosImage | | size | 1 | | status | uploading | | updated_at | 2014-10-03T20:31:21.000000 | | volume_type | None | +---------------------+--------------------------------------+
3. It may take a while before the image is uploaded to Glance completely.
# glance image-list +--------------------------------------+---------------+-------------+------------------+----------+--------+ | ID | Name | Disk Format | Container Format | Size | Status | +--------------------------------------+---------------+-------------+------------------+----------+--------+ | 2dfb6cd2-7a63-4c28-940e-b730969d3040 | cirros | qcow2 | bare | 13147648 | active | | 04ab89ab-e4e7-4389-bd46-e9e6aaf6de39 | myCirrosImage | qcow2 | bare | | queued | +--------------------------------------+---------------+-------------+------------------+----------+--------+ # glance image-list +--------------------------------------+---------------+-------------+------------------+----------+--------+ | ID | Name | Disk Format | Container Format | Size | Status | +--------------------------------------+---------------+-------------+------------------+----------+--------+ | 2dfb6cd2-7a63-4c28-940e-b730969d3040 | cirros | qcow2 | bare | 13147648 | active | | 04ab89ab-e4e7-4389-bd46-e9e6aaf6de39 | myCirrosImage | qcow2 | bare | 38005440 | active | +--------------------------------------+---------------+-------------+------------------+----------+--------+
NOTE: By default the uploaded image is private. If you are admin and would like to make the customized image public, use glance image-update:
# glance image-show 04ab89ab-e4e7-4389-bd46-e9e6aaf6de39 |grep is_public | is_public | False # glance image-update 04ab89ab-e4e7-4389-bd46-e9e6aaf6de39 --is-public True
The default implementation of this feature is at:
No comments:
Post a Comment