Error when sync glance database

Asked by neo0 on 2012-04-20

Hi all,

I'm following the documents from Openstack to install Essex on Ubuntu server 12.04 beta2.

Everything is okay with Keystone, but with Glance, when I run the command:

# glance-manage version_control 0

ERROR: There was an error migrating the database.
Details: database 'mysql://glance:glance@172.17.2.203/glance_db' is already under migration control

I don't know but is it a problem with mysql-server 5.5? Because from the beginning when I grant the permission on glance_db for 'glance'@'%' it didn't work with @'localhost' like in this describe: http://tech.zhenhua.info/2009/01/mysql-error-104528000-access-denied-for.html

How can I fix this problem?
Thank you!

Question information

Language:
English Edit question
Status:
Solved
For:
Glance Edit question
Assignee:
No assignee Edit question
Solved by:
neo0
Solved:
2012-04-20
Last query:
2012-04-20
Last reply:
smallma (s-rain) said : #1

I saw the following script in glance-registry.postinst. FYI~

if [ ! -e /var/lib/glance/glance.sqlite ] ; then
        su -s /bin/sh -c 'glance-manage version_control 0' glance
fi

neo0 (tungns-inf) said : #2

@smallma
I checked but there is no /var/lib/glance/glance.sqlite in my server.
This command return the same error.
I don't know but maybe problem from mysql-server.

smallma (s-rain) said : #3

Hello neo0,
Please refer the following steps to set up glance.

1. stop glance-api
2. stop glance-registry
3. remove tables from db
4. su -s /bin/sh -c 'glance-manage version_control 0' glance
5. su -s /bin/sh -c 'glance-manage db_sync' glance
6 start glance-api
7. start glance-registry

Regards,

Rain.

neo0 (tungns-inf) said : #4

Thank you smallma.
My problem was fixed.

andy (luo-dan119) said : #5

hello neO0
how to slove it ? My problem is the same with you, can you give me any suggestion?
Details pls see the below.

OS: RHEL6.2 single node openstack

[root@openstack ~]# glance-manage version_control 0
ERROR: There was an error migrating the database.
Details: database 'mysql://glance:glance@192.168.206.130/glance' is already under migration control
[root@openstack ~]#

[root@openstack ~]# glance index
Failed to show index. Got error:
The request returned 500 Internal Server Error

The response body:
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/eventlet/wsgi.py", line 382, in handle_one_response
    result = self.application(self.environ, start_response)
  File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/dec.py", line 147, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/dec.py", line 208, in call_func
    return self.func(req, *args, **kwargs)
  File "/usr/lib/python2.6/site-packages/glance/common/wsgi.py", line 284, in __call__
    response = req.get_response(self.application)
  File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/request.py", line 1053, in get_response
    application, catch_exc_info=False)
  File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/request.py", line 1022, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/lib/python2.6/site-packages/keystone/middleware/auth_token.py", line 176, in __call__
    return self.app(env, start_response)
  File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/dec.py", line 147, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/dec.py", line 208, in call_func
    return self.func(req, *args, **kwargs)
  File "/usr/lib/python2.6/site-packages/glance/common/wsgi.py", line 284, in __call__
    response = req.get_response(self.application)
  File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/request.py", line 1053, in get_response
    application, catch_exc_info=False)
  File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/request.py", line 1022, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/dec.py", line 159, in __call__
    return resp(environ, start_response)
  File "/usr/lib/python2.6/site-packages/Routes-1.12.3-py2.6.egg/routes/middleware.py", line 131, in __call__
    response = self.app(environ, start_response)
  File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/dec.py", line 159, in __call__
    return resp(environ, start_response)
  File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/dec.py", line 147, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/dec.py", line 208, in call_func
    return self.func(req, *args, **kwargs)
  File "/usr/lib/python2.6/site-packages/glance/common/wsgi.py", line 482, in __call__
    request, **action_args)
  File "/usr/lib/python2.6/site-packages/glance/common/wsgi.py", line 499, in dispatch
    return method(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/glance/api/v1/images.py", line 134, in index
    images = registry.get_images_list(req.context, **params)
  File "/usr/lib/python2.6/site-packages/glance/registry/__init__.py", line 129, in get_images_list
    return c.get_images(**kwargs)
  File "/usr/lib/python2.6/site-packages/glance/registry/client.py", line 77, in get_images
    res = self.do_request("GET", "/images", params=params)
  File "/usr/lib/python2.6/site-packages/glance/common/client.py", line 58, in wrapped
    return func(self, *args, **kwargs)
  File "/usr/lib/python2.6/site-packages/glance/common/client.py", line 420, in do_request
    headers=headers)
  File "/usr/lib/python2.6/site-packages/glance/common/client.py", line 75, in wrapped
    return func(self, method, url, body, headers)
  File "/usr/lib/python2.6/site-packages/glance/common/client.py", line 562, in _do_request
    raise exception.ClientConnectionError(e)
ClientConnectionError: There was an error connecting to a server
Details: [Errno 111] ECONNREFUSED

#My config file info
1.glance-api.conf and glance-registry.conf
[paste_deploy]
falvor = keystone

and
[paste_deploy]
falvor = keystone
sql_connection = mysql://glance:glance@192.168.206.130/glance