How to download images from OpenStack Glance.

Here is the syntax to download images from OpenStack glance

source overcloudrc
openstack image save --file local-file-name.qcow2 image-name

Or if you would like to compress the downloaded image on the fly

source overcloudrc
openstack image save image-name | gzip -c > local-file-name.raw.gz

Example

[stack@ospdir ~]$ source overcloudrc
(admin@overcloud) [stack@ospdir ~]$ openstack image list -c ID -c Name -c "Disk Format" -c Size -f table --long
+--------------------------------------+----------+-------------+-------------+
| ID                                   | Name     | Disk Format |        Size |
+--------------------------------------+----------+-------------+-------------+
| 6c5384f6-cf86-4a41-b9d4-8cafbb9c08fc | CentOS74 | qcow2       |   854851584 |
| 4d43fb6d-16a3-4c85-8eab-f0088a9f5aaa | Win2k16  | raw         | 42954915840 |
| 3bcdeb04-9170-4f2c-8468-8797477b6c02 | cirros   | qcow2       |    13267968 |
+--------------------------------------+----------+-------------+-------------+
(admin@overcloud) [stack@ospdir ~]$ openstack image save Win2K16 | gzip -c > Win2K16.raw.gz
(admin@overcloud) [stack@ospdir ~]$ du -b Win2k16.raw.gz
9151990788    Win2k16.raw.gz
(admin@overcloud) [stack@ospdir ~]$ openstack image save --file  cirros.qcow2 cirros
(admin@overcloud) [stack@ospdir ~]$ du -b cirros.qcow2
13267968    Win2k16.raw.gz

links

social