Ask Your Question
0

Glance is using 'localhost' for mysql connection even if other host is configured

asked 2017-03-29 11:40:57 -0500

Jorge Florencio gravatar image

Hi folks, I'm trying to install OpenStack Newton on CentOS 7.3 and glance fails to create tables on database. After executing this command:

su -s /bin/sh -c "glance-manage db_sync" glance

This error is displayed in the log:

Access denied for user 'glance'@'localhost' (using password: YES)

This is the configuration in glance-registry.conf and glance-api.conf files:

[database]
connection = mysql+pymysql://glance:password@controller/glance

I can sucessfully access database using the right hostname, but I don't know why glance is trying to use 'localhost' instead the hostname configured in files.

Many thanks in advance,

Jorge.

edit retag flag offensive close merge delete

4 answers

Sort by ยป oldest newest most voted
0

answered 2017-03-30 02:36:22 -0500

fifieldt gravatar image

Looks like there's an '=' sign missing in the line:

connection mysql+pymysql://glance:glancedbpassword@newton01/glance

edit flag offensive delete link more

Comments

Great!!! This was the issue.

Thanks your very much for your help!

Jorge Florencio gravatar imageJorge Florencio ( 2017-03-30 05:06:29 -0500 )edit
0

answered 2017-03-30 02:22:10 -0500

Jorge Florencio gravatar image

The hostname used in configuration files is the same name from /etc/hosts file.

192.168.1.11    newton01

Also I've changed the hostname by the IP in configuration files, and the same result. The parameter is being ignored.

This is the content of api.log file:

2017-03-30 11:07:39.078 27711 CRITICAL glance [-] OperationalError: (_mysql_exceptions.OperationalError) (1045, "Access denied for user 'glance'@'localhost' (using password: YES)")
2017-03-30 11:07:39.078 27711 ERROR glance Traceback (most recent call last):
2017-03-30 11:07:39.078 27711 ERROR glance   File "/usr/bin/glance-manage", line 10, in <module>
2017-03-30 11:07:39.078 27711 ERROR glance     sys.exit(main())
...
...
...
2017-03-30 11:07:39.078 27711 ERROR glance     return Connection(*args, **kwargs)
2017-03-30 11:07:39.078 27711 ERROR glance   File "/usr/lib64/python2.7/site-packages/MySQLdb/connections.py", line 193, in __init__
2017-03-30 11:07:39.078 27711 ERROR glance     super(Connection, self).__init__(*args, **kwargs2)
2017-03-30 11:07:39.078 27711 ERROR glance OperationalError: (_mysql_exceptions.OperationalError) (1045, "Access denied for user 'glance'@'localhost' (using password: YES)")
2017-03-30 11:07:39.078 27711 ERROR glance

This is the content of glance-api.conf :

[DEFAULT]
debug = true
verbose = true
[cors]
[cors.subdomain]
[database]
connection mysql+pymysql://glance:glancedbpassword@newton01/glance
[glance_store]
stores = file
default_store = file
filesystem_store_datadir = /var/lib/glance/images/
[image_format]
[keystone_authtoken]
auth_uri = http://newton01:5000
auth_url = http://newton01:35357
memcached_servers = newton01:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = glance
password = glancepassword
[matchmaker_redis]
[oslo_concurrency]
[oslo_messaging_amqp]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_messaging_zmq]
[oslo_middleware]
[oslo_policy]
[paste_deploy]
flavor = keystone
[profiler]
[store_type_location_strategy]
[task]
[taskflow_executor]

And this is the content of glance-registry.conf :

[DEFAULT]
debug = true
verbose = true
[database]
connection = mysql+pymysql://glance:glancedbpassword@newton01/glance
[keystone_authtoken]
auth_uri = http://newton01:5000
auth_url = http://newton01:35357
memcached_servers = newton01:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = glance
password = glancepassword
[matchmaker_redis]
[oslo_messaging_amqp]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_messaging_zmq]
[oslo_policy]
[paste_deploy]
flavor = keystone
[profiler]

Regards, Jorge.

edit flag offensive delete link more

Comments

Are you able to manually log into the SQL database using the glance username? Does the glance database exist there? Type the below command on the controller and login using the glance password. mysql -u glance -p

milo22 gravatar imagemilo22 ( 2017-03-30 08:55:27 -0500 )edit
0

answered 2017-03-29 14:34:21 -0500

milo22 gravatar image

Is your hosts file setup so that it knows what IP address 'controller' is? Are you able to log into the MYSQL database using the glance username?

edit flag offensive delete link more
0

answered 2017-03-30 00:46:28 -0500

yprokule gravatar image

@jorge-florencio - probably wrong entry in /etc/hosts ? Try running command with --verbose/--debug options.

edit flag offensive delete link more

Comments

Failed again, even if I use the IP instead the hostname.

Jorge Florencio gravatar imageJorge Florencio ( 2017-03-30 02:23:22 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2017-03-29 11:40:57 -0500

Seen: 395 times

Last updated: Mar 30 '17