diff options
author | Markus Zoeller <mzoeller@de.ibm.com> | 2016-04-08 15:19:59 +0200 |
---|---|---|
committer | Markus Zoeller <mzoeller@de.ibm.com> | 2016-04-08 15:19:59 +0200 |
commit | e42ff5e5ca8c0d72802b5ad8ae7867c2f5ae2fac (patch) | |
tree | 43454c3d5ce1c3e8f8050abb57be3009680bec90 /nova/service.py | |
parent | e6aab744a38395ccbf8faaee80085bd4765edabe (diff) | |
download | nova-e42ff5e5ca8c0d72802b5ad8ae7867c2f5ae2fac.tar.gz |
Add "__repr__" method to class "Service"
The class "Service" doesn't have a "__repr__" method which results
in log outputs like:
DEBUG [...] service = <nova.service.Service object at 0x56eb890>
This is not helpful when analyzing logs. Therefore this change adds a
"__repr__" method.
Change-Id: I49c8b7f0dde298de780808c988e4b50278eed665
Diffstat (limited to 'nova/service.py')
-rw-r--r-- | nova/service.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/nova/service.py b/nova/service.py index dc40de4a0c..9810ce275d 100644 --- a/nova/service.py +++ b/nova/service.py @@ -110,6 +110,15 @@ class Service(service.Service): self.conductor_api = conductor.API(use_local=db_allowed) self.conductor_api.wait_until_ready(context.get_admin_context()) + def __repr__(self): + return "<%(cls_name)s: host=%(host)s, binary=%(binary)s, " \ + "manager_class_name=%(manager)s>" % { + 'cls_name': self.__class__.__name__, + 'host': self.host, + 'binary': self.binary, + 'manager': self.manager_class_name + } + def start(self): verstr = version.version_string_with_package() LOG.info(_LI('Starting %(topic)s node (version %(version)s)'), |