diff options
author | Nikola Dipanov <ndipanov@redhat.com> | 2015-03-05 17:42:01 +0000 |
---|---|---|
committer | Nikola Dipanov <ndipanov@redhat.com> | 2015-03-06 11:00:22 +0000 |
commit | f92cbfde9d386adeed52bb02c5fa051edf965d2b (patch) | |
tree | f60b7ea9a3a901890fd1120194b7327459716079 /nova/service.py | |
parent | d8c2e74f69a5924e757265fbde21e0ceed682fca (diff) | |
download | nova-f92cbfde9d386adeed52bb02c5fa051edf965d2b.tar.gz |
Remove usage of db.service_get_by_args
After the change:
https://review.openstack.org/#/c/155832
It has become apparent that get_service_by_args method of the DB api
does basically the same thing as the newly introduced
service_get_by_host_and_binary, with several subtle differences. (whether
deleted records are returned, whether disabled services are considered
etc.)
Leaving this as is is likely to lead to confusion, and introduction of
subtle bugs.
The proposed solution is to keep only one. Seeing that the subtleties of
how get_service_by_args works, and the fact that it is really poorly
named, it is deemed better to remove it.
This patch makes all the places that used it now use
get_service_by_host_and_binary instead.
Change-Id: I243236c8feacec5e6edbbbf4cee2ec4e40405bf1
Diffstat (limited to 'nova/service.py')
-rw-r--r-- | nova/service.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/nova/service.py b/nova/service.py index ac851a3b77..3ae307ce90 100644 --- a/nova/service.py +++ b/nova/service.py @@ -165,8 +165,9 @@ class Service(service.Service): self.model_disconnected = False ctxt = context.get_admin_context() try: - self.service_ref = self.conductor_api.service_get_by_args(ctxt, - self.host, self.binary) + self.service_ref = ( + self.conductor_api.service_get_by_host_and_binary( + ctxt, self.host, self.binary)) self.service_id = self.service_ref['id'] except exception.NotFound: try: @@ -175,8 +176,9 @@ class Service(service.Service): exception.ServiceBinaryExists): # NOTE(danms): If we race to create a record with a sibling # worker, don't fail here. - self.service_ref = self.conductor_api.service_get_by_args(ctxt, - self.host, self.binary) + self.service_ref = ( + self.conductor_api.service_get_by_host_and_binary( + ctxt, self.host, self.binary)) self.manager.pre_start_hook() |