Fix Bug #704038: Unable to start or connect to register server on anything other than 0.0.0.0:9191

This commit is contained in:
jaypipes@gmail.com 2011-01-18 16:01:49 -05:00
parent c4815119a2
commit c9d93d2219
3 changed files with 84 additions and 12 deletions

View File

@ -33,10 +33,6 @@ from glance.common import server
FLAGS = flags.FLAGS
flags.DEFINE_string('registry_host', '0.0.0.0',
'Registry server lives at this address')
flags.DEFINE_integer('registry_port', 9191,
'Registry server listens on this port')
def main(_args):

View File

@ -18,5 +18,70 @@ Image Registries
================
Image metadata made available through Glance can be stored in image
*registries*. Image registries are any web service that adheres to the
Glance RESTful API for image metadata.
`registries`. Image registries are any web service that adheres to the
Glance REST-like API for image metadata.
Glance comes with a server program ``bin/glance-registry`` that acts
as a reference implementation of a Glance Registry.
Using ``bin/glance-registry``
-----------------------------
As mentioned above, ``bin/glance-registry`` is the reference registry
server implementation that ships with Glance. It uses a SQL database
to store information about an image, and publishes this information
via an HTTP/REST-like interface.
Starting the server
*******************
Starting the Glance registry server is trivial. Simply call the program
from the command line, as the following example shows::
jpipes@serialcoder:~/repos/glance/trunk$ ./bin/glance-registry
(5588) wsgi starting up on http://0.0.0.0:9191/
Configuring the server
**********************
There are a few options that can be supplied to the registry server when
starting it up:
* ``verbose``
Show more verbose/debugging output
* ``sql_connection``
A proper SQLAlchemy connection string as described `here <http://www.sqlalchemy.org/docs/05/reference/sqlalchemy/connections.html?highlight=engine#sqlalchemy.create_engine>`_
* ``registry_host``
Address of the host the registry runs on. Defaults to 0.0.0.0.
* ``registry_port``
Port the registry server listens on. Defaults to 9191.
Glance Registry API
-------------------
Any web service that publishes an API that conforms to the following
REST-like API specification can be used by Glance as a registry.
API in Summary
**************
The following is a brief description of the Glance API::
GET /images Return brief information about public images
GET /images/detail Return detailed information about public images
GET /images/<ID> Return metadata about an image in HTTP headers
POST /images Register metadata about a new image
PUT /images/<ID> Update metadata about an existing image
DELETE /images/<ID> Remove an image's metadata from the registry
Examples
********
.. todo:: Complete examples for Glance registry API

View File

@ -20,34 +20,45 @@
Registry API
"""
from glance.common import flags
from glance.registry import client
FLAGS = flags.FLAGS
# TODO(jaypipes): Separate server flags from client flags
# and allow a list of client host/port
# combinations
flags.DEFINE_string('registry_host', '0.0.0.0',
'Registry server lives at this address')
flags.DEFINE_integer('registry_port', 9191,
'Registry server listens on this port')
def get_images_list():
c = client.RegistryClient("0.0.0.0")
c = client.RegistryClient(FLAGS.registry_host, FLAGS.registry_port)
return c.get_images()
def get_images_detail():
c = client.RegistryClient("0.0.0.0")
c = client.RegistryClient(FLAGS.registry_host, FLAGS.registry_port)
return c.get_images_detailed()
def get_image_metadata(image_id):
c = client.RegistryClient("0.0.0.0")
c = client.RegistryClient(FLAGS.registry_host, FLAGS.registry_port)
return c.get_image(image_id)
def add_image_metadata(image_data):
c = client.RegistryClient("0.0.0.0")
c = client.RegistryClient(FLAGS.registry_host, FLAGS.registry_port)
return c.add_image(image_data)
def update_image_metadata(image_id, image_data):
c = client.RegistryClient("0.0.0.0")
c = client.RegistryClient(FLAGS.registry_host, FLAGS.registry_port)
return c.update_image(image_id, image_data)
def delete_image_metadata(image_id):
c = client.RegistryClient("0.0.0.0")
c = client.RegistryClient(FLAGS.registry_host, FLAGS.registry_port)
return c.delete_image(image_id)