Skip to content

Commit

Permalink
Fixed openstack_controller
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreYang committed Jan 6, 2020
1 parent e4576d3 commit a6847b2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,11 @@ def _get_paginated_list(self, url, obj, query_params):
# Only catch HTTPErrors to enable the retry mechanism.
# Other exceptions raised by _make_request (e.g. AuthenticationNeeded) should be caught downstream
self.logger.debug(
"Error making paginated request to {}, lowering limit from {} to {}: {}".format(
url, query_params['limit'], query_params['limit'] // 2, e
)
"Error making paginated request to %s, lowering limit from %s to %s: %s",
url,
query_params['limit'],
query_params['limit'] // 2,
e,
)
query_params['limit'] //= 2
retry += 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ def get_stats_for_single_hypervisor(
try:
load_averages = self.get_loads_for_single_hypervisor(hyp['id'])
except Exception as e:
self.warning('Unable to get loads averages for hypervisor {}: {}'.format(hyp['id'], e))
self.warning('Unable to get loads averages for hypervisor %s: %s', hyp['id'], e)
load_averages = []
if load_averages and len(load_averages) == 3:
for i, avg in enumerate([1, 5, 15]):
Expand Down Expand Up @@ -466,7 +466,7 @@ def _is_valid_metric(label):
project_name = project.get('name')
project_id = project.get('id')

self.log.debug("Collecting metrics for project. name: {} id: {}".format(project_name, project['id']))
self.log.debug("Collecting metrics for project. name: %s id: %s", project_name, project['id'])
server_stats = self.get_project_limits(project['id'])
server_tags.append('tenant_id:{}'.format(project_id))

Expand All @@ -479,7 +479,7 @@ def _is_valid_metric(label):
metric_key = PROJECT_METRICS[st]
self.gauge("openstack.nova.limits.{}".format(metric_key), server_stats[st], tags=server_tags)
except KeyError:
self.warning("Unexpected response, not submitting limits metrics for project id {}".format(project['id']))
self.warning("Unexpected response, not submitting limits metrics for project id %s", project['id'])

def get_flavors(self):
query_params = {}
Expand Down Expand Up @@ -612,8 +612,9 @@ def init_api(self, instance_config, keystone_server_url, custom_tags):
)
except KeystoneUnreachable as e:
self.warning(
"The agent could not contact the specified identity server at {} . "
"Are you sure it is up at that address?".format(keystone_server_url)
"The agent could not contact the specified identity server at %s . "
"Are you sure it is up at that address?",
keystone_server_url,
)
self.log.debug("Problem grabbing auth token: %s", e)
self.service_check(
Expand Down Expand Up @@ -748,9 +749,9 @@ def check(self, instance):
if isinstance(e, IncompleteIdentity):
self.warning(
"Please specify the user via the `user` variable in your init_config.\n"
+ "This is the user you would use to authenticate with Keystone v3 via password auth.\n"
+ "The user should look like:"
+ "{'password': 'my_password', 'name': 'my_name', 'domain': {'id': 'my_domain_id'}}"
"This is the user you would use to authenticate with Keystone v3 via password auth.\n"
"The user should look like: "
"{'password': 'my_password', 'name': 'my_name', 'domain': {'id': 'my_domain_id'}}"
)
else:
self.warning("Configuration Incomplete: %s! Check your openstack.yaml file", e)
Expand Down

0 comments on commit a6847b2

Please sign in to comment.