Glance-client get started - LEGACY

First, create an openstack user through citycontrolpanel: in left menu click API -> Openstack native API. Then the create user button. Choose which projects the user should have access to and choose username / password.

Next up is to install the glance-client. There are several ways to do this depending on operating system. Clone it from GIT and install it using the setup.py that is included in the GIT repo: https://github.com/openstack/python-glanceclient Or install it through a package handler if available. Package is named python-glanceclient in most repos)


Once it is installed, you will need to add your credentials. The easiest way is to export them as environmental variables, but you can also send credentials on command line if you prefer.

Here are the environmental variables that you need to set:

export OS_USERNAME=<username you selected on your api-user> export OS_PASSWORD=<password you selected on your api-user>export OS_AUTH_URL=https://identity1.citycloud.com:5000/v3/export OS_USER_DOMAIN_ID=<domain ID>   #Domain ID can be found at the same place where you created the api user.export OS_REGION_NAME=<region you want to work with> # Available regions at this moment:  Kna1, Sto2 and Lon1 (karlskrona, stockholm, london).  2 regions in the states will be added in July.export OS_PROJECT_ID=<projectId you want to work with>

Once the above environment variables has been set you are all set to start using glance client. Also, please note that the above environment variables can be used for all the different clients available for openstack (neutron, heat, nova, cinder, etc.) To verify that it works, you can try a glance command. For example, "glance image-list". If setup properly you will receive a list of all the available images in the current selected region and project.

To upload your existing image you can run the following command:

glance image-create --name <name of image> --disk-format <iso or qcow2> --container-format <bare, ovf, ova, ami, ari, aki> --file <path to file to upload>


Example

So, for instance, if you have an ubuntu.iso that you want to upload you can run:

glance image-create --name ubuntu_ISO --disk-format iso --container-format bare --file ubuntu.iso



If you want to see progress of upload you can add the flag: --progress.

The uploaded image and the status of the progress are also visible from City Control Panel: left menu -> servers -> private images.