unable to sync database when access-network is configured in percona-cluster charm

Bug #1413862 reported by Alex Kang
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Charm Helpers
Fix Released
High
James Page
cinder (Juju Charms Collection)
Fix Released
Undecided
Unassigned
glance (Juju Charms Collection)
Fix Released
High
Unassigned
keystone (Juju Charms Collection)
Fix Released
Undecided
Unassigned
neutron-api (Juju Charms Collection)
Fix Released
Undecided
Unassigned
nova-cloud-controller (Juju Charms Collection)
Fix Released
Undecided
Unassigned
nova-compute (Juju Charms Collection)
Fix Released
Undecided
Unassigned
quantum-gateway (Juju Charms Collection)
Fix Released
Undecided
Unassigned

Bug Description

I have deployed glance with juju and it didn't create database of glance.
I looked into the juju log and there is sync error of glance

2015-01-23 04:59:36 INFO shared-db-relation-changed Traceback (most recent call last):
2015-01-23 04:59:36 INFO shared-db-relation-changed File "/var/lib/juju/agents/unit-glance-0/charm/hooks/shared-db-relation-changed", line 451, in <module>
2015-01-23 04:59:36 INFO shared-db-relation-changed hooks.execute(sys.argv)
2015-01-23 04:59:36 INFO shared-db-relation-changed File "/var/lib/juju/agents/unit-glance-0/charm/hooks/charmhelpers/core/hookenv.py", line 502, in execute
2015-01-23 04:59:36 INFO shared-db-relation-changed self._hooks[hook_name]()
2015-01-23 04:59:36 INFO shared-db-relation-changed File "/var/lib/juju/agents/unit-glance-0/charm/hooks/charmhelpers/core/host.py", line 268, in wrapped_f
2015-01-23 04:59:36 INFO shared-db-relation-changed f(*args)
2015-01-23 04:59:36 INFO shared-db-relation-changed File "/var/lib/juju/agents/unit-glance-0/charm/hooks/shared-db-relation-changed", line 163, in db_changed
2015-01-23 04:59:36 INFO shared-db-relation-changed migrate_database()
2015-01-23 04:59:36 INFO shared-db-relation-changed File "/var/lib/juju/agents/unit-glance-0/charm/hooks/glance_utils.py", line 179, in migrate_database
2015-01-23 04:59:36 INFO shared-db-relation-changed subprocess.check_call(cmd)
2015-01-23 04:59:36 INFO shared-db-relation-changed File "/usr/lib/python2.7/subprocess.py", line 540, in check_call
2015-01-23 04:59:36 INFO shared-db-relation-changed raise CalledProcessError(retcode, cmd)
2015-01-23 04:59:36 INFO shared-db-relation-changed subprocess.CalledProcessError: Command '['glance-manage', 'db_sync']' returned non-zero exit status 1
2015-01-23 04:59:36 ERROR juju.worker.uniter uniter.go:486 hook failed: exit status 1

I also attached my juju status and glance log/config files

Tags: openstack cts

Related branches

Revision history for this message
Alex Kang (thkang0) wrote :
tags: added: cts openstack
Revision history for this message
Edward Hope-Morley (hopem) wrote :

Alex, I see that you are using a 3-node Percona cluster. Could you please confirm that the cluster formed properly by doing:

juju ssh percona/0 "mysql -uroot -pagoodpassword -e \"show status like 'wsrep_cluster%';\""

and verifying that cluster_size is 3

Also, did you manage to recover from this issue? e.g. by doing 'juju resolved -r glance/0'

Revision history for this message
Edward Hope-Morley (hopem) wrote :

I also see that the database access grants are being created using maas dns names as opposed to ip addresses. Could you please provide the output of:

juju ssh percona/0 pt-show-grants -uroot -p<root-pass> | grep glance

NOTE: you'll need to install percona-toolkit on your db node to do this

Revision history for this message
Alex Kang (thkang0) wrote :

Edward, this is the result as you mentioned

mysql> show status like 'wsrep_cluster%';
+--------------------------+--------------------------------------+
| Variable_name | Value |
+--------------------------+--------------------------------------+
| wsrep_cluster_conf_id | 3 |
| wsrep_cluster_size | 3 |
| wsrep_cluster_state_uuid | 57c2a09d-a2ab-11e4-addc-979d5ab3b3ac |
| wsrep_cluster_status | Primary |
+--------------------------+--------------------------------------+

ubuntu@db01:~$ pt-show-grants -uroot -pubuntu | grep glance
-- Grants for 'glance'@'10.100.1.170'
GRANT USAGE ON *.* TO 'glance'@'10.100.1.170' IDENTIFIED BY PASSWORD '*3F5426F710A7D88B2337302C169A453136248B15';
GRANT ALL PRIVILEGES ON `glance`.* TO 'glance'@'10.100.1.170';
-- Grants for 'glance'@'10.100.1.171'
GRANT USAGE ON *.* TO 'glance'@'10.100.1.171' IDENTIFIED BY PASSWORD '*3F5426F710A7D88B2337302C169A453136248B15';
GRANT ALL PRIVILEGES ON `glance`.* TO 'glance'@'10.100.1.171';
-- Grants for 'glance'@'172.100.2.99'
GRANT USAGE ON *.* TO 'glance'@'172.100.2.99' IDENTIFIED BY PASSWORD '*3F5426F710A7D88B2337302C169A453136248B15';
GRANT ALL PRIVILEGES ON `glance`.* TO 'glance'@'172.100.2.99';

mysql> select host,user from user;
+---------------+------------------+
| host | user |
+---------------+------------------+
| 10.100.1.161 | keystone |
| 10.100.1.162 | keystone |
| 10.100.1.164 | neutron |
| 10.100.1.164 | nova |
| 10.100.1.165 | neutron |
| 10.100.1.165 | nova |
| 10.100.1.170 | glance |
| 10.100.1.171 | glance |
| 10.100.1.172 | cinder |
| 10.100.1.173 | cinder |
| 127.0.0.1 | root |
| 172.100.2.103 | neutron |
| 172.100.2.103 | nova |
| 172.100.2.105 | cinder |
| 172.100.2.106 | neutron |
| 172.100.2.106 | nova |
| 172.100.2.95 | cinder |
| 172.100.2.96 | keystone |
| 172.100.2.97 | keystone |
| 172.100.2.99 | glance |
| ::1 | root |
| db01 | root |
| ip6-localhost | sstuser |
| localhost | debian-sys-maint |
| localhost | root |
| localhost | sstuser |
+---------------+------------------+
26 rows in set (0.00 sec)

as you see this result, only one glance node didn't get grant thorugh public network in db.
ohter services are all fine to sync databases. (even another glance node got the grant )

juju resolve still failed to resolve because of grant

James Page (james-page)
Changed in glance (Juju Charms Collection):
milestone: none → 15.01
milestone: 15.01 → 15.04
James Page (james-page)
Changed in glance (Juju Charms Collection):
milestone: 15.04 → none
Revision history for this message
Ante Karamatić (ivoks) wrote :

2015-01-23 04:59:36 INFO shared-db-relation-changed 2015-01-23 04:59:36.703 18407 CRITICAL glance [-] OperationalError: (OperationalError) (1130, "Host '172-100-2-98.maas' is not allowed to connect to this MySQL server") None None

If you look at grant tables, you'll notice that .98 is not in it. My questions would be:

1) if .98 is VIP, why is glance accessing DB with VIP
2) if .98 is not VIP, why isn't charm creating proper grant rights in DB

In both cases, bug would be in the charm, cause glance binds to *any* address on the host due to bind_host = 0.0.0.0.

Revision history for this message
Alex Kang (thkang0) wrote :

here is mysql query result. one of glance node has a grant but anothere doesn't have it.
.98 is nova glance ha vip.

mysql> select host,user from user;
+---------------+------------------+
| host | user |
+---------------+------------------+
[...]

| 10.100.1.170 | glance |
| 10.100.1.171 | glance |

| 172.100.2.99 | glance |
| ::1 | root |
| db01 | root |

+---------------+------------------+

Revision history for this message
Alex Kang (thkang0) wrote :

Additional Information of my env is that
Machines have 2 network interfaces which one is 10.100.1.x, another is 172.100.2.x
As above comment 1 glance node has successful grant right, and another glance has only grant right with 10.100.1.x network

here is my openstack bundle file
https://pastebin.canonical.com/124513/

Revision history for this message
James Page (james-page) wrote :

I think I see the issue here; the SharedDB helper context deals with switching from private-address to an address on the 'access-network' if the percona-cluster charm presents that data over the relation.

The code that does this simply returns {} during this process:

  http://bazaar.launchpad.net/~charm-helpers/charm-helpers/devel/view/head:/charmhelpers/contrib/openstack/context.py#L177

however 'context_complete' thinks this is still a complete context, as it does not contain any keys which are either None or '':

  http://bazaar.launchpad.net/~charm-helpers/charm-helpers/devel/view/head:/charmhelpers/contrib/openstack/context.py#L91

which results in:

  http://bazaar.launchpad.net/~openstack-charmers/charms/precise/glance/trunk/view/head:/hooks/glance_relations.py#L145

return true, even though the context is not actually complete yet.

Revision history for this message
James Page (james-page) wrote :

Returning None instead of {} for the SharedDB context in this case is the right thing todo; I'm reticent to change context_complete to deal with empty dicts....

James Page (james-page)
Changed in charm-helpers:
importance: Undecided → High
Changed in glance (Juju Charms Collection):
importance: Undecided → High
James Page (james-page)
Changed in glance (Juju Charms Collection):
status: New → Triaged
Changed in charm-helpers:
status: New → In Progress
assignee: nobody → James Page (james-page)
Revision history for this message
James Page (james-page) wrote :

Charmhelper resync pushed to all openstack charms - Marking Fix Committed for Glance.

Now doing the stable branches.

Changed in charm-helpers:
status: In Progress → Fix Committed
Changed in glance (Juju Charms Collection):
status: Triaged → Fix Committed
James Page (james-page)
no longer affects: cinder (Ubuntu)
Changed in neutron-api (Juju Charms Collection):
status: New → Fix Committed
Changed in cinder (Juju Charms Collection):
status: New → Fix Committed
milestone: none → 15.04
Changed in glance (Juju Charms Collection):
milestone: none → 15.04
Changed in neutron-api (Juju Charms Collection):
milestone: none → 15.04
James Page (james-page)
Changed in nova-cloud-controller (Juju Charms Collection):
status: New → Fix Committed
no longer affects: quantum-gateway (Ubuntu)
Changed in nova-compute (Juju Charms Collection):
status: New → Fix Committed
Changed in quantum-gateway (Juju Charms Collection):
status: New → Fix Committed
Changed in keystone (Juju Charms Collection):
status: New → Fix Committed
milestone: none → 15.04
Changed in nova-cloud-controller (Juju Charms Collection):
milestone: none → 15.04
Changed in nova-compute (Juju Charms Collection):
milestone: none → 15.04
Changed in quantum-gateway (Juju Charms Collection):
milestone: none → 15.04
summary: - glance couldn't sync database
+ enable to sync database when access-network is configured in percona-
+ cluster charm
James Page (james-page)
summary: - enable to sync database when access-network is configured in percona-
+ unable to sync database when access-network is configured in percona-
cluster charm
James Page (james-page)
Changed in cinder (Juju Charms Collection):
status: Fix Committed → Fix Released
Changed in glance (Juju Charms Collection):
status: Fix Committed → Fix Released
Changed in keystone (Juju Charms Collection):
status: Fix Committed → Fix Released
Changed in neutron-api (Juju Charms Collection):
status: Fix Committed → Fix Released
Changed in nova-cloud-controller (Juju Charms Collection):
status: Fix Committed → Fix Released
Changed in nova-compute (Juju Charms Collection):
status: Fix Committed → Fix Released
James Page (james-page)
Changed in quantum-gateway (Juju Charms Collection):
status: Fix Committed → Fix Released
Changed in charm-helpers:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.