Misleading exception when lock_path is not provided

Bug #1966320 reported by Thiago Paiva Brito
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo.concurrency
Fix Released
Undecided
Unassigned

Bug Description

When lock_file is not present on the [oslo_concurrency] section of the config file, we are getting a misleading error saying that it is not preset on the DEFAULT group:

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    Traceback (most recent call last):

      File "/home/tbrito/workspace/openstack/nova/nova/tests/unit/virt/test_block_device.py", line 725, in test_volume_attach_with_shared_targets
    self.test_volume_attach(include_shared_targets=True)

      File "/home/tbrito/workspace/openstack/nova/nova/tests/unit/virt/test_block_device.py", line 721, in test_volume_attach
    self._test_volume_attach(test_bdm, self.volume_bdm, volume,

      File "/home/tbrito/workspace/openstack/nova/.tox/py39/lib/python3.9/site-packages/mock/mock.py", line 1346, in patched
    return func(*newargs, **newkeywargs)

      File "/home/tbrito/workspace/openstack/nova/nova/tests/unit/virt/test_block_device.py", line 623, in _test_volume_attach
    driver_bdm.attach(self.context, instance,

      File "/home/tbrito/workspace/openstack/nova/nova/virt/block_device.py", line 46, in wrapped
    ret_val = method(obj, context, *args, **kwargs)

      File "/home/tbrito/workspace/openstack/nova/nova/virt/block_device.py", line 668, in attach
    with brick_utils.guard_connection(volume):

      File "/usr/lib/python3.9/contextlib.py", line 119, in __enter__
    return next(self.gen)

      File "/home/tbrito/workspace/openstack/nova/.tox/py39/lib/python3.9/site-packages/os_brick/initiator/utils.py", line 45, in guard_connection
    with lockutils.lock(device['service_uuid'], 'os-brick-',

      File "/usr/lib/python3.9/contextlib.py", line 119, in __enter__
    return next(self.gen)

      File "/home/tbrito/workspace/openstack/nova/.tox/py39/lib/python3.9/site-packages/oslo_concurrency/lockutils.py", line 297, in lock
    ext_lock = external_lock(name, lock_file_prefix, lock_path)

      File "/home/tbrito/workspace/openstack/nova/.tox/py39/lib/python3.9/site-packages/oslo_concurrency/lockutils.py", line 189, in external_lock
    lock_file_path = _get_lock_path(name, lock_file_prefix, lock_path)

      File "/home/tbrito/workspace/openstack/nova/.tox/py39/lib/python3.9/site-packages/oslo_concurrency/lockutils.py", line 183, in _get_lock_path
    raise cfg.RequiredOptError('lock_path')

    oslo_config.cfg.RequiredOptError: value required for option lock_path in group [DEFAULT]

https://github.com/openstack/oslo.concurrency/blob/master/oslo_concurrency/lockutils.py#L180

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to oslo.concurrency (master)
Changed in oslo.concurrency:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to oslo.concurrency (master)

Reviewed: https://review.opendev.org/c/openstack/oslo.concurrency/+/835111
Committed: https://opendev.org/openstack/oslo.concurrency/commit/11210a957c7f21defbbc46826210d93b295cce18
Submitter: "Zuul (22348)"
Branch: master

commit 11210a957c7f21defbbc46826210d93b295cce18
Author: Thiago Brito <email address hidden>
Date: Thu Mar 24 15:11:57 2022 -0300

    Fix RequiredOptError when missing lock_path

    When lock_file is not present on the [oslo_concurrency] section of the
    config file, we are getting a misleading error saying that it is not
    preset on the DEFAULT group. This commit fixes it by providing the group
    arg to the RequiredOptError constructor.

    Closes-Bug: #1966320

    Signed-off-by: Thiago Brito <email address hidden>
    Change-Id: Idee6987739917c7eae4faee15a66085a9ef7f6d2

Changed in oslo.concurrency:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/oslo.concurrency 4.5.1

This issue was fixed in the openstack/oslo.concurrency 4.5.1 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.