# cinder list
+--------------------------------------+-----------+---------------+------+-------------+----------+--------------------------------------+
| ID | Status | Name | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+-----------+---------------+------+-------------+----------+--------------------------------------+
| 011c847e-4f3f-4502-9da7-d23935ebbada | in-use | mojily_927 | 50 | ssd | false | 7642cd0a-7c11-4e3b-9649-0d325be1897f |
| cf9c6390-73bf-469e-805c-4bfa277d46ff | available | mojily_926_56 | 40 | ssd | false | |
| ec430e40-7402-4263-8acc-1fa2ad10b2e3 | in-use | mojily_926 | 40 | ssd | false | 7642cd0a-7c11-4e3b-9649-0d325be1897f |
+--------------------------------------+-----------+---------------+------+-------------+----------+--------------------------------------+
# cinder help upload-to-image
usage: cinder upload-to-image [--force [<True|False>]]
[--container-format <container-format>]
[--disk-format <disk-format>]
<volume> <image-name>
Uploads volume to Image Service as an image.
Positional arguments:
<volume> Name or ID of volume to snapshot.
<image-name> The new image name.
Optional arguments:
--force [<True|False>]
Enables or disables upload of a volume that is
attached to an instance. Default=False.
--container-format <container-format>
Container format type. Default is bare.
--disk-format <disk-format>
Disk format type. Default is raw.
# cinder upload-to-image 011c847e-4f3f-4502-9da7-d23935ebbada jyher --disk-format qcow2
ERROR: Invalid volume: Volume status is in-use. (HTTP 400) (Request-ID: req-a31b2bc2-a0ee-4f6d-a2fc-5fd3658d1f2a)
¡Ø Liberty Version ÀÌÈĺÎÅÍ... enable_force_upload Á¤Ã¥ÀÌ º¯°æµÈµí...
default = False
# vim /etc/cinder/cinder.conf
[Default]
enable_force_upload = True
# service cinder-api restart
# cinder upload-to-image 011c847e-4f3f-4502-9da7-d23935ebbada jyher --disk-format qcow2 --force True
+---------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Property | Value |
+---------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| container_format | bare |
| disk_format | qcow2 |
| display_description | None |
| id | 011c847e-4f3f-4502-9da7-d23935ebbada |
| image_id | 62762551-02e4-41b5-ad8e-732b4ac0bfd0 |
| image_name | jyher |
| size | 50 |
| status | uploading |
| updated_at | 2017-02-07T03:03:05.000000 |
| volume_type | {u'description': None, u'deleted': False, u'created_at': u'2016-12-20T08:59:02.000000', u'updated_at': u'2017-02-02T04:59:12.000000', u'extra_specs': {u'volume_backend_name': u'ceph_ssd'}, u'is_public': True, u'deleted_at': None, u'id': u'3517b201-42d6-4962-b60a-1e554714f071', u'name': u'ssd'} |
+---------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+