OpenStack: Upload Glance Image Via the Command Line

openstack

It seems that every once and a while I run into issues uploading an image into Glance while using the WebUI. The “Create Image” function will just flat out fail without any helpful error messages.

As a work around to the failure listed above, I suggest using the simple example shown below to upload an image. Note that all commands are being run from the Controller Node.

First source your keystone credentials.

[root@rhel7 ~]# source keystonerc_admin

Then run the command below and wait for the output. If your’s looks anything like mine, then you will know that the image uploaded without issue.

NOTE: The commands below have two dashes before each option…. its hard to see this in the output.

[root@rhel7 ~(keystone_admin)]# glance image-create –name Cirros –disk-format qcow2 –container-format bare –is-public True –copy-from http://download.cirros-cloud.net/0.3.3/cirros-0.3.3-x86_64-disk.img

+——————+————————————–+
| Property | Value |
+——————+————————————–+
| checksum | None |
| container_format | bare |
| created_at | 2015-03-29T04:50:38 |
| deleted | False |
| deleted_at | None |
| disk_format | qcow2 |
| id | dd5937ef-c30c-465b-ba45-3f76a59164cd |
| is_public | True |
| min_disk | 0 |
| min_ram | 0 |
| name | Cirros |
| owner | 1d84fe28da3f4e0a830c52929d85c917 |
| protected | False |
| size | 13200896 |
| status | queued |
| updated_at | 2015-03-29T04:50:38 |
| virtual_size | None |
+——————+————————————–+

Feel free to verify this in the WebUI, just make sure that you refresh the page before you think you have been lulled into a false sense of accomplishment.

Alternatively, you can also upload an image directly from local disk. In my particular case I am uploading directly from a locally mounted NFS mount.

root@rhel7 storage(keystone_admin)]# glance image-create –name RHEL7-Guest –disk-format qcow2 –container-format bare –is-public True –file /storage/NAS/storage/rhel-guest-image-7.0-20140930.0.x86_64.qcow2

+——————+————————————–+
| Property | Value |
+——————+————————————–+
| checksum | 4fcc9b2b8db610187a6e7eac02608ab6 |
| container_format | bare |
| created_at | 2015-03-29T05:07:46 |
| deleted | False |
| deleted_at | None |
| disk_format | qcow2 |
| id | 5f6222b2-8b37-45e6-96db-c9fee8cb84b4 |
| is_public | True |
| min_disk | 0 |
| min_ram | 0 |
| name | RHEL7-Guest |
| owner | 1d84fe28da3f4e0a830c52929d85c917 |
| protected | False |
| size | 435639808 |
| status | active |
| updated_at | 2015-03-29T05:08:21 |
| virtual_size | None |
+——————+————————————–+

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.