Fix a few nits from the main volume-based patch

I had a few minor nits on the volume-based patch. This patch
corrects those.

Co-Authored-By: Adam Harwell <flux.adam@gmail.com>

Change-Id: I5f9ce36c878973f4ed96527af6f1024a362421d8
changes/44/681144/9
Michael Johnson 3 years ago committed by Carlos Goncalves
parent 510525a92b
commit 05f5257075
  1. 1
      octavia/cmd/health_manager.py
  2. 1
      octavia/cmd/octavia_worker.py
  3. 2
      octavia/common/config.py
  4. 2
      octavia/common/jinja/haproxy/combined_listeners/jinja_cfg.py
  5. 2
      octavia/common/jinja/haproxy/split_listeners/jinja_cfg.py
  6. 12
      octavia/compute/drivers/nova_driver.py
  7. 6
      octavia/controller/worker/v1/tasks/database_tasks.py
  8. 6
      octavia/controller/worker/v2/tasks/database_tasks.py
  9. 1
      octavia/db/migration/alembic_migrations/env.py
  10. 1
      octavia/tests/common/constants.py
  11. 2
      octavia/tests/functional/api/v2/test_l7rule.py
  12. 4
      octavia/tests/functional/api/v2/test_listener.py
  13. 2
      octavia/tests/functional/api/v2/test_load_balancer.py
  14. 2
      octavia/tests/functional/api/v2/test_quotas.py
  15. 1
      octavia/tests/unit/controller/worker/v1/tasks/test_compute_tasks.py
  16. 1
      octavia/tests/unit/controller/worker/v2/tasks/test_compute_tasks.py
  17. 1
      tools/create_flow_docs.py
  18. 6
      tox.ini

@ -123,5 +123,6 @@ def main():
except KeyboardInterrupt:
process_cleanup()
if __name__ == "__main__":
main()

@ -40,5 +40,6 @@ def main():
oslo_config_glue.setup(sm, CONF, reload_method="mutate")
sm.run()
if __name__ == "__main__":
main()

@ -584,7 +584,7 @@ cinder_opts = [
default=False,
help=_('Disable certificate validation on SSL connections')),
cfg.IntOpt('volume_size', default=16,
help=_('Size of volume for Amphora instance')),
help=_('Size of volume, in GB, for Amphora instance')),
cfg.StrOpt('volume_type', default=None,
help=_('Type of volume for Amphorae volume root disk')),
cfg.IntOpt('volume_create_retry_interval', default=5,

@ -140,7 +140,7 @@ class JinjaTemplater(object):
log_format = log_format.replace('%{+Q}ST', '-')
log_format = log_format.replace('%ST', '-')
log_format = log_format.replace(' ', '\ ')
log_format = log_format.replace(' ', '\\ ')
return log_format
def render_loadbalancer_obj(self, host_amphora, listeners,

@ -139,7 +139,7 @@ class JinjaTemplater(object):
log_format = log_format.replace('%{+Q}ST', '-')
log_format = log_format.replace('%ST', '-')
log_format = log_format.replace(' ', '\ ')
log_format = log_format.replace(' ', '\\ ')
return log_format
def render_loadbalancer_obj(self, host_amphora, listener,

@ -151,8 +151,8 @@ class VirtualMachineManager(compute_base.ComputeBase):
for i in range(CONF.nova.random_amphora_name_length - 1)]
))
block_device_mapping = {}
if CONF.controller_worker.volume_driver != \
constants.VOLUME_NOOP_DRIVER:
if (CONF.controller_worker.volume_driver !=
constants.VOLUME_NOOP_DRIVER):
# creating volume
LOG.debug('Creating volume for amphora from image %s',
image_id)
@ -180,8 +180,8 @@ class VirtualMachineManager(compute_base.ComputeBase):
return amphora.id
except Exception as e:
if CONF.controller_worker.volume_driver != \
constants.VOLUME_NOOP_DRIVER:
if (CONF.controller_worker.volume_driver !=
constants.VOLUME_NOOP_DRIVER):
self.volume_driver.delete_volume(volume_id)
LOG.exception("Nova failed to build the instance due to: %s", e)
raise exceptions.ComputeBuildException(fault=e)
@ -269,8 +269,8 @@ class VirtualMachineManager(compute_base.ComputeBase):
'os-interfaces extension failed.')
fault = getattr(nova_response, 'fault', None)
if CONF.controller_worker.volume_driver == \
constants.VOLUME_NOOP_DRIVER:
if (CONF.controller_worker.volume_driver ==
constants.VOLUME_NOOP_DRIVER):
image_id = nova_response.image.get("id")
else:
try:

@ -1587,9 +1587,9 @@ class GetListenersFromLoadbalancer(BaseDatabaseTask):
"""
listeners = []
for listener in loadbalancer.listeners:
l = self.listener_repo.get(db_apis.get_session(), id=listener.id)
l.load_balancer = loadbalancer
listeners.append(l)
lb = self.listener_repo.get(db_apis.get_session(), id=listener.id)
lb.load_balancer = loadbalancer
listeners.append(lb)
return listeners

@ -1587,9 +1587,9 @@ class GetListenersFromLoadbalancer(BaseDatabaseTask):
"""
listeners = []
for listener in loadbalancer.listeners:
l = self.listener_repo.get(db_apis.get_session(), id=listener.id)
l.load_balancer = loadbalancer
listeners.append(l)
lb = self.listener_repo.get(db_apis.get_session(), id=listener.id)
lb.load_balancer = loadbalancer
listeners.append(lb)
return listeners

@ -82,6 +82,7 @@ def run_migrations_online():
finally:
connection.close()
if context.is_offline_mode():
run_migrations_offline()
else:

@ -18,6 +18,7 @@ class MockNovaInterface(object):
port_id = None
fixed_ips = []
MOCK_NETWORK_ID = 'mock-network-1'
MOCK_NETWORK_ID2 = 'mock-network-2'
MOCK_NETWORK_NAME = 'TestNet1'

@ -1014,7 +1014,7 @@ class TestL7Rule(base.BaseAPITest):
response = self.put(self.l7rule_path.format(
l7rule_id=api_l7rule.get('id')),
self._build_body(new_l7rule)).json.get(self.root_tag)
self.assertEqual(False, response.get('invert'))
self.assertFalse(response.get('invert'))
def test_delete(self):
api_l7rule = self.create_l7rule(

@ -1691,7 +1691,7 @@ class TestListener(base.BaseAPITest):
auth_strategy=constants.TESTING)
with mock.patch.object(octavia.common.context.Context, 'project_id',
uuidutils.generate_uuid()):
api_listener = self.put(listener_path, body, status=403)
api_listener = self.put(listener_path, body, status=403)
self.conf.config(group='api_settings', auth_strategy=auth_strategy)
self.assertEqual(self.NOT_AUTHORIZED_BODY, api_listener.json)
self.assert_correct_lb_status(self.lb_id, constants.ONLINE,
@ -1816,7 +1816,7 @@ class TestListener(base.BaseAPITest):
self.conf.config(group='api_settings', auth_strategy=constants.TESTING)
with mock.patch.object(octavia.common.context.Context, 'project_id',
uuidutils.generate_uuid()):
self.delete(listener_path, status=403)
self.delete(listener_path, status=403)
self.conf.config(group='api_settings', auth_strategy=auth_strategy)
self.assert_correct_lb_status(self.lb_id, constants.ONLINE,
constants.ACTIVE)

@ -1988,7 +1988,7 @@ class TestLoadBalancer(base.BaseAPITest):
self.conf.config(group='api_settings', auth_strategy=constants.TESTING)
with mock.patch.object(octavia.common.context.Context, 'project_id',
uuidutils.generate_uuid()):
response = self.app.put(path, status=403)
response = self.app.put(path, status=403)
self.conf.config(group='api_settings', auth_strategy=auth_strategy)
self.assertEqual(self.NOT_AUTHORIZED_BODY, response.json)

@ -152,7 +152,7 @@ class TestQuotas(base.BaseAPITest):
self.conf.config(group='api_settings', auth_strategy=constants.TESTING)
with mock.patch.object(octavia.common.context.Context, 'project_id',
uuidutils.generate_uuid()):
response = self.get(self.QUOTAS_PATH, status=403)
response = self.get(self.QUOTAS_PATH, status=403)
self.conf.config(group='api_settings', auth_strategy=auth_strategy)
self.assertEqual(self.NOT_AUTHORIZED_BODY, response.json)

@ -49,6 +49,7 @@ class TestException(Exception):
def __str__(self):
return repr(self.value)
_amphora_mock = mock.MagicMock()
_amphora_mock.id = AMPHORA_ID
_amphora_mock.compute_id = COMPUTE_ID

@ -49,6 +49,7 @@ class TestException(Exception):
def __str__(self):
return repr(self.value)
_amphora_mock = mock.MagicMock()
_amphora_mock.id = AMPHORA_ID
_amphora_mock.compute_id = COMPUTE_ID

@ -146,5 +146,6 @@ def generate(flow_list, output_directory):
def getDiagKey(item):
return item[0] + '-' + item[1]
if __name__ == "__main__":
main()

@ -141,7 +141,9 @@ basepython = python3
commands = bandit -r octavia -ll -ii -x octavia/tests {posargs}
[flake8]
ignore = H104
# [H104]: Empty file with only comments
# [W504]: Line break after binary operator
ignore = H104,W504
show-source = true
builtins = _
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build
@ -150,7 +152,7 @@ import-order-style = pep8
# [H203]: Use assertIs(Not)None to check for None
# [H204]: Use assert(Not)Equal to check for equality
# [H205]: Use assert(Greater|Less)(Equal) for comparison
# [H904] Delay string interpolations at logging calls.
# [H904]: Delay string interpolations at logging calls
enable-extensions=H106,H203,H204,H205,H904
[hacking]

Loading…
Cancel
Save