glance-api start failed with using cache

Asked by smallma

Hello all,
I got a problem about glance-cache can't enable. I have used the glance-cache-document (http://glance.openstack.org/configuring.html) to set the cache up, but it occurred a error as below. Please help me to clarify where the problem is. Thank you.
ERROR: Error trying to load config /etc/glance-api.conf: <module 'glance.common.wsgi' from '/usr/lib/pymodules/python2.7/glance/common/wsgi.pyc'> has no 'filter_factory' attribute

glance-api.conf :

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

# Base directory that the Image Cache uses
image_cache_dir = /cache2

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

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

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

[filter:cache]
#paste.filter_factory = glance.api.middleware.cache:filter_factory
paste.filter_factory = glance.common.wsgi:filter_factory
glance.filter_factory = glance.api.middleware.cache:CacheFilter

[filter:cachemanage]
paste.filter_factory = glance.api.middleware.cache_manage:filter_factory

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

[filter:authtoken]
paste.filter_factory = keystone.middleware.auth_token:filter_factory
service_protocol = http
service_host = 127.0.0.1
service_port = 5000
auth_host = 127.0.0.1
auth_port = 35357
auth_protocol = http
auth_uri = http://127.0.0.1:5000/
admin_token = 999888777666

[filter:auth-context]
paste.filter_factory = keystone.middleware.glance_auth_token:filter_factory

By the way, Why doesn't glance-api.conf include all of cache setting by default?

Question information

Language:
English Edit question
Status:
Solved
For:
Glance Edit question
Assignee:
No assignee Edit question
Solved by:
smallma
Solved:
Last query:
Last reply:
Revision history for this message
Brian Waldon (bcwaldon) said :
#1

Make sure you're running code at or newer than commit 68de11cdab473036dfdf17df48deafd4677d926b. That's the commit that changed the location of the filter_factory object that your failures seem to point to.

As for your question about why the cache config options aren't in glance-api.conf: as I understand it, most of the options belong in glance-cache.conf. There are specific options, however, that need to be in glance-api.conf for the middlewares to use. I'll look into cleaning this up a bit so its clearer in the future.

Revision history for this message
smallma (s-rain) said :
#2

Brian, Thank you.
The common/wsgi.py doesn't include filter_factory function in glance-2012.1~e2, so that this problem has occurred. I will check that and report it. Thanks.

Revision history for this message
smallma (s-rain) said :
#3

Hello Brian,
After download openstack-glance_7d61fef and install,There is two errors of glance-api below.

Error-1:
# glance-control all restart
No glance-api running
No glance-registry running
No glance-scrubber running
Traceback (most recent call last):
  File "/usr/bin/glance-control", line 233, in <module>
    do_start(server, conf, args)
  File "/usr/bin/glance-control", line 146, in do_start
    conf_file = conf.config_file[-1]
IndexError: list index out of range

Error-2:
# glance-api start
ERROR: Unable to load glance-api from configuration file /etc/glance-api.conf.
Got: ImportError("<module 'glance.api.v1.router' from '/usr/lib/pymodules/python2.7/glance/api/v1/router.pyc'> has no 'app_factory' attribute",)

Is there any problem?

Thanks,
Rain

Revision history for this message
Brian Waldon (bcwaldon) said :
#4

1) glance-control hasn't been fully functional for a while, now. I would suggest you use glance-control to start each service individually (don't use 'all') or just call the upstart scripts directly.

2) In your glance-api.conf, make sure you update the follwing sections:

[app:apiv1app]
paste.app_factory = glance.common.wsgi:app_factory
glance.app_factory = glance.api.v1.router:API

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

[filter:cachemanage]
paste.filter_factory = glance.common.wsgi:filter_factory
glance.filter_factory = glance.api.middleware.cache_manage:CacheManageFilter

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

[filter:auth-context]
paste.filter_factory = glance.common.wsgi:filter_factory
glance.filter_factory = keystone.middleware.glance_auth_token:KeystoneContextMiddleware

Revision history for this message
smallma (s-rain) said :
#5

Brian, Thanks.

1) glance-control still has some problems for starting each service individually. there is a error below.
# glance-control api start
Traceback (most recent call last):
  File "/usr/bin/glance-control", line 219, in <module>
    do_start(server, conf, args)
  File "/usr/bin/glance-control", line 146, in do_start
    conf_file = conf.config_file[-1]
IndexError: list index out of range

2) After updated the configure which you provided, The glance-api set up normally.
I have two questions.
a) How do I know that how to set the conf file if I do not study glance code? These settings seem too complex for user. If it is possible, would you please make this conf file to become easy for setting?
b) Are these settings necessary in the conf?

Thank you.

Revision history for this message
Brian Waldon (bcwaldon) said :
#6

1) So it seems like glance-control may be completely non-functional now. You might as well file a bug on that failure you're seeing.

2) As for the configuration changes:
a) You don't necessarily have to study glance code, you just need to be able to look at the published example config files. Additionally, this only applies if you're installing trunk or from source. You should be able to depend on packages to provide correctly formatted configs.
b) The settings you updated ideally would be separated into another config file that you will never have to update by hand. We just aren't quite there!

Revision history for this message
smallma (s-rain) said :
#7

Thank you. ^^