Skip to content

Commit

Permalink
avoid parsing heat.conf for each Heat resource
Browse files Browse the repository at this point in the history
This moves heat configuration parsing to module loading time.

Parsing the config for each resource does not seem to be
useful, and profiling with pyflame shows that it is a significant
hit, measurable in tens of seconds on heat stack with a large
number of Contrail heat resources.

Change-Id: Iad81d60e63fdfb554e6c42dbcdf58848586984f1
Closes-Bug: 1779078
  • Loading branch information
tmmorin committed Jun 28, 2018
1 parent 75bf8c5 commit df5389e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions contrail_heat/resources/contrail.py
Expand Up @@ -13,6 +13,8 @@

LOG = logging.getLogger(__name__)

cfg_parser = ConfigParser.ConfigParser()
cfg_parser.read("/etc/heat/heat.conf")

def set_auth_token(func):
def wrapper(self, *args, **kwargs):
Expand All @@ -34,8 +36,6 @@ class ContrailResource(resource.Resource):

def __init__(self, name, json_snippet, stack):
super(ContrailResource, self).__init__(name, json_snippet, stack)
cfg_parser = ConfigParser.ConfigParser()
cfg_parser.read("/etc/heat/heat.conf")
self._user = self._read_cfg(cfg_parser,
'clients_contrail',
'user',
Expand Down

0 comments on commit df5389e

Please sign in to comment.