Openstack Glance Image Download, download Openstack images
Published: 25-02-2015 | Author: Remy van Elst | Text only version of this article
❗ This post is over six years old. It may no longer be up to date. Opinions may have changed.
Table of Contents
This guide shows you how download Openstack Images to your local machine using the command line Glance client. You can use this, for example, to download a copy of an image created from a VM, or to download the images your Openstack provider provides and adapt those.
You can see all my Openstack related articles here. For example, how to use Duplicity to create Encrypted backups to the Openstack Swift Object Store
Consider sponsoring me on Github. It means the world to me if you show your appreciation and you'll help pay the server costs.
You can also sponsor me by getting a Digital Ocean VPS. With this referral link you'll get $100 credit for 60 days.
Command Line tools
Make sure you have the Openstack command line tools installed. Follow the
official openstack guide here. If you have
pip installed you can use that
to install the tools:
pip install python-novaclient pip install python-cinderclient pip install python-glanceclient pip install python-keystoneclient pip install python-neutronclient pip install python-swiftclient
Save yourself some time and create a file named
computerc with the below
export OS_AUTH_URL="https://identity.stack.cloudvps.com/v2.0" export OS_TENANT_NAME="<tenant name>" export OS_USERNAME="<username>" export OS_PASSWORD="<password>" export OS_TENANT_ID="<tenant id>"
When you are going to do stuff with the Openstack command line clients, load this file:
That way, your authentication data are loaded and you don't have to give
--os-username and such.
Openstack is a datacenter virtualization plaform consisting out of many different tools and services. Here is a short overview of the different services you might encounter.
This is the virtualization service. It works with a hypervisor to create and manage virtual machines. You can create a VM based on a specific "Flavour", which is just a definition of specs like disk, cpu and ram.
Block Storage (Cinder)
This is the service which makes block devices (volumes) available to services. A flavour can not be changed, just resized. If you want extra storage you need to create a volume, attach it to the VM and mount it there for use.
This is the service which holds all the images. Images can be used to boot a VM
from. Images can be prepared with tools like
cloud-init to make them behave
better in a cloud environment, for example, setting an SSH key or password at
When you've created a
computerc file and loaded it up in your shell you can
start the process. You need the UUID of the image you want to download. Get a
list of all images using the
glance image-list command:
$ glance image-list
+------------+---------------------+--------+-----------+------------+--------+ | ID | Name | Disk | Container | Size | Status | +------------+---------------------+--------+-----------+------------+--------+ | 0a[...]5dd | example-test | raw | bare | 4843700224 | active | | 13[...]b30 | example-2 | qcow2 | bare | 4762632192 | active | | 22[...]eeb | FreeBSD-10.1 | qcow2 | bare | 736981504 | active | | d2[...]625 | pfSense 2.1.5 | iso | bare | 403243008 | active | +------------+---------------------+--------+-----------+------------+--------+
ID part is what you need. In this example it is trimmed.
glance image-download command to download the image. By default it
will go to STDOUT, use the
--file parameter to place the output in a file.
$ glance image-download --file ./example-test.img 0a[...]5dd
The command syntax is:
$ glance image-download --file $FILENAME $UUID
If you get the following error:
object of type 'generator' has no len()
Try executing the command without the