Sometimes, you already have stored the virtual machine image in some non-Glance location -- perhaps even a location you have no write access to -- and you want to tell Glance where this virtual machine image is located and some metadata about it. The add command can do this for you.

When registering an image in this way, the only difference is that you do not use a shell redirect to stream a virtual machine image file into Glance, but instead, you tell Glance where to find the existing virtual machine image by setting the location field. Below is an example of doing this.

Let's assume that there is a virtual machine image located at the URL http://example.com/images/myimage.vhd. We can register this image with Glance using the following:

$> glance --verbose add name="Some web image" disk_format=vhd container_format=ovf\
   location="http://example.com/images/myimage.vhd"
Added new image with ID: 1
Returned the following metadata for the new image:
               container_format => ovf
                     created_at => 2011-02-23T00:42:04.688890
                        deleted => False
                     deleted_at => None
                    disk_format => vhd
                             id => 1
                      is_public => True
                       location => http://example.com/images/myimage.vhd
                           name => Some web image
                     properties => {}
                           size => 0
                         status => active
                     updated_at => None
Completed in 0.0356 sec.


loading table of contents...