installing glance with swift backend

Asked by chistopher on 2011-10-06

I am trying to configure glance to use swift.I have installed swift based on the instructions http://swift.openstack.org/howto_installmultinode.html and it works works . I then installed glance and changed the /etc/glance/glance-api.config to look as follows :

DEFAULT]
# Show more verbose log output (sets INFO log level output)
verbose = True

# Show debugging output in logs (sets DEBUG log level output)
debug = False

# Which backend store should Glance use by default is not specified
# in a request to add a new image to Glance? Default: 'file'
# Available choices are 'file', 'swift', and 's3'
default_store =swift

# Address to bind the API server
bind_host = 0.0.0.0

# Port the bind the API server to
bind_port = 9292

# Address to find the registry server
registry_host = 0.0.0.0

# Port the registry server is listening on
registry_port = 9191

# Log to this file. Make sure you do not set the same log
# file for both the API and registry servers!
log_file = /var/log/glance/api.log

# Send logs to syslog (/dev/log) instead of to file specified by `log_file`
use_syslog = False

# ============ Filesystem Store Options ========================

# Directory that the Filesystem backend store
# writes image data to
filesystem_store_datadir = /var/lib/glance/images/

# ============ Swift Store Options =============================
swift_store_auth_address = https://146.141.78.76:8080/auth/v1.0

# User to authenticate against the Swift authentication service
swift_store_user = system:root

# Auth key for the user authenticating against the
# Swift authentication service
swift_store_key = testpass

# Container within the account that the account should use
# for storing images in Swift
swift_store_container = glance

# Do we create the container if it does not exist?
swift_store_create_container_on_put = true

# Whether to use ServiceNET to communicate with the Swift storage servers.
# (If you aren't RACKSPACE, leave this False!)
#
# To use ServiceNET for authentication, prefix hostname of
# `swift_store_auth_address` with 'snet-'.
# Ex. https://example.com/v1.0/ -> https://snet-example.com/v1.0/
swift_enable_snet = False

# ============ Image Cache Options ========================

image_cache_enabled = False

# Directory that the Image Cache writes data to
# Make sure this is also set in glance-pruner.conf
image_cache_datadir = /var/lib/glance/image-cache/

# Number of seconds after which we should consider an incomplete image to be
# stalled and eligible for reaping
image_cache_stall_timeout = 86400

# ============ S3 Store Options =============================

# Address where the S3 authentication service lives
s3_store_host = 127.0.0.1:8080/v1.0/

# User to authenticate against the S3 authentication service
s3_store_access_key = <20-char AWS access key>

# Auth key for the user authenticating against the
# S3 authentication service
s3_store_secret_key = <40-char AWS secret key>

# Container within the account that the account should use
# for storing images in S3. Note that S3 has a flat namespace,
# so you need a unique bucket name for your glance images. An
# easy way to do this is append your AWS access key to "glance".
# S3 buckets in AWS *must* be lowercased, so remember to lowercase
# your AWS access key if you use it in your bucket name below!
s3_store_bucket = <lowercased 20-char aws access key>glance
# Do we create the bucket if it does not exist?
s3_store_create_bucket_on_put = False

# ============ Delayed Delete Options =============================

# Turn on/off delayed delete
delayed_delete = False

[pipeline:glance-api]
pipeline = versionnegotiation context apiv1app

# To enable Image Cache Management API replace pipeline with below:
# pipeline = versionnegotiation imagecache apiv1app

[pipeline:versions]
pipeline = versionsapp

[app:versionsapp]
paste.app_factory = glance.api.versions:app_factory

[app:apiv1app]

# ============ Delayed Delete Options =============================

# Turn on/off delayed delete
delayed_delete = False

[pipeline:glance-api]
pipeline = versionnegotiation context apiv1app

# To enable Image Cache Management API replace pipeline with below:
# pipeline = versionnegotiation imagecache apiv1app

[pipeline:versions]
pipeline = versionsapp

[app:versionsapp]
paste.app_factory = glance.api.versions:app_factory

[app:apiv1app]
paste.app_factory = glance.api.v1:app_factory

[filter:versionnegotiation]
paste.filter_factory = glance.api.middleware.version_negotiation:filter_factory

[filter:imagecache]
paste.filter_factory = glance.api.middleware.image_cache:filter_factory

[filter:context]
paste.filter_factory = glance.common.context:filter_factory

When I run :
glance-api glance-api.conf --debug

I get :
Traceback (most recent call last):
  File "/usr/bin/glance-api", line 66, in <module>
    server.start(app, int(conf['bind_port']), conf['bind_host'])
  File "/usr/lib/pymodules/python2.6/glance/common/wsgi.py", line 65, in start
    socket = eventlet.listen((host, port), backlog=backlog)
  File "/usr/lib/pymodules/python2.6/eventlet/convenience.py", line 38, in listen
    sock.bind(addr)
  File "<string>", line 1, in bind
socket.error: [Errno 98] Address already in use

The log :

2011-10-06 14:10:26 DEBUG [glance-api] ********************************************************************************
2011-10-06 14:10:26 DEBUG [glance-api] Configuration options gathered from config file:
2011-10-06 14:10:26 DEBUG [glance-api] /etc/glance/glance-api.conf
2011-10-06 14:10:26 DEBUG [glance-api] ================================================
2011-10-06 14:10:26 DEBUG [glance-api] bind_host 0.0.0.0
2011-10-06 14:10:26 DEBUG [glance-api] bind_port 9292
2011-10-06 14:10:26 DEBUG [glance-api] debug True
2011-10-06 14:10:26 DEBUG [glance-api] default_store swift
2011-10-06 14:10:26 DEBUG [glance-api] delayed_delete False
2011-10-06 14:10:26 DEBUG [glance-api] filesystem_store_datadir /var/lib/glance/images/
2011-10-06 14:10:26 DEBUG [glance-api] image_cache_datadir /var/lib/glance/image-cache/
2011-10-06 14:10:26 DEBUG [glance-api] image_cache_enabled False
2011-10-06 14:10:26 DEBUG [glance-api] image_cache_stall_timeout 86400
2011-10-06 14:10:26 DEBUG [glance-api] log_file /var/log/glance/api.log
2011-10-06 14:10:26 DEBUG [glance-api] registry_host 0.0.0.0
2011-10-06 14:10:26 DEBUG [glance-api] registry_port 9191
2011-10-06 14:10:26 DEBUG [glance-api] s3_store_access_key <20-char AWS access key>
2011-10-06 14:10:26 DEBUG [glance-api] s3_store_bucket <lowercased 20-char aws access key>glance
2011-10-06 14:10:26 DEBUG [glance-api] s3_store_create_bucket_on_put False
2011-10-06 14:10:26 DEBUG [glance-api] s3_store_host 127.0.0.1:8080/v1.0/
2011-10-06 14:10:26 DEBUG [glance-api] s3_store_secret_key <40-char AWS secret key>
2011-10-06 14:10:26 DEBUG [glance-api] swift_enable_snet False
2011-10-06 14:10:26 DEBUG [glance-api] swift_store_auth_address https://146.141.78.76:8080/auth/v1.0
2011-10-06 14:10:26 DEBUG [glance-api] swift_store_container glance
2011-10-06 14:10:26 DEBUG [glance-api] swift_store_create_container_on_put true
2011-10-06 14:10:26 DEBUG [glance-api] swift_store_key testpass
2011-10-06 14:10:26 DEBUG [glance-api] swift_store_user system:root
2011-10-06 14:10:26 DEBUG [glance-api] use_syslog False
2011-10-06 14:10:26 DEBUG [glance-api] verbose True
2011-10-06 14:10:26 DEBUG [glance-api] ********************************************************************************
2011-10-06 14:10:26 DEBUG [routes.middleware] Initialized with method overriding = True, and path info altering = True
The IP address is the proxy ip where the authentication is done. Can someone please help me , I am not sure what is causing the problem.

Question information

Language:
English Edit question
Status:
Solved
For:
Glance Edit question
Assignee:
No assignee Edit question
Solved by:
chistopher
Solved:
2011-10-07
Last query:
2011-10-07
Last reply:
2011-10-06
Jay Pipes (jaypipes) said : #1

Hi!

That error means that another service is running on port 9292 on localhost. Are you sure that you haven't already started the Glance API server? The log file output you show above indicates that the Glance API service is started...

If you do a netstat -tnlp call, like so, you should see the service holding the port:

jpipes@serialcoder:~/repos/glance$ sudo netstat -tlnp | grep 9292
tcp 0 0 0.0.0.0:9292 0.0.0.0:* LISTEN 19010/python

jpipes@serialcoder:~/repos/glance$ ps aux | grep 19010
jpipes 19010 0.2 0.2 75068 23220 pts/2 S+ 09:31 0:00 python ./bin/glance-api --verbose ../swift.conf

Cheers,
-jay

I have changed my binding port to 9192 for the glance-api and 9193 for the registry (the registry returned the same error when it was started). I ran both commands that you posted and got

tcp 0 0 0.0.0.0:9292 0.0.0.0:* LISTEN 777/python when running "netstat -tlnp | grep 9292" - not sure if this output means that glance is using the port.
and
root 1678 0.0 0.0 7624 908 pts/4 S+ 10:53 0:00 grep --color=auto 19010 when running the second command. I suspect that glance-api is started when the computer starts the only problem is that nothing is logged in the api.log when this happens, and that seems to help, not sure if this will be a problem later though, when i intergrate nova .
Thanks alot!

Please ignore the comment above it does not make sense:
What I am trying to say is :

I ran netstat -tlnp | grep 9292" as suggested by jay and got
tcp 0 0 0.0.0.0:9292 0.0.0.0:* LISTEN 777/python
i then ran
ps -ef |grep 777 and got
glance 777 771 0 10:24 ? 00:00:00 /usr/bin/python /usr/bin/glance-api , and realised that glance had started as suggested by Jay. I have changed the ports to make sure that I can read the logs.

Thank you Jay.

changed debug=true in glance-api and reverted to port 9292 and all is well .