Comment 1 for bug 1674196

Revision history for this message
licanwei (li-canwei2) wrote :

We have two controllers as HA in our OpenStack environment. There are watcher-applier and watcher-decision-engine in each controller.
So there are two same name in the services table. In this case, the objects.Service.get_by_name(context, name) will trigger exception of MultipleResultsFound.
We should use objects.Service.get(context, id) replace of objects.Service.get_by_name(context, name).

MariaDB [watcher]> select * from services;
+---------------------+---------------------+------------+---------+----+-------------------------+--------------------+---------------------+
| created_at | updated_at | deleted_at | deleted | id | name | host | last_seen_up |
+---------------------+---------------------+------------+---------+----+-------------------------+--------------------+---------------------+
| 2017-03-15 05:01:56 | 2017-03-15 06:23:05 | NULL | 0 | 1 | watcher-applier | host-10-43-203-132 | 2017-03-15 06:23:05 |
| 2017-03-15 05:01:57 | 2017-03-15 06:23:06 | NULL | 0 | 2 | watcher-decision-engine | host-10-43-203-132 | 2017-03-15 06:23:06 |
| 2017-03-15 05:01:57 | NULL | NULL | 0 | 3 | watcher-applier | controller04 | NULL |
| 2017-03-15 05:01:58 | NULL | NULL | 0 | 4 | watcher-decision-engine | controller04 | NULL |
+---------------------+---------------------+------------+---------+----+-------------------------+--------------------+---------------------+