Updated openstack/openstack
Project: openstack/nova  4c7f71cf2dcd3aa46de0b4a2f48b516a9fc7fe98

libvirt: avoid need for lockutils setup running test cases

Some of the firewall/driver test cases rely on lockutils being
setup, so running tests directly fails:

 $ .venv/bin/python -m testtools.run nova.tests.virt.libvirt
 ...snip...
    Traceback (most recent call last):
      File "nova/tests/virt/libvirt/test_driver.py", line 10182, in test_multinic_iptables
        self.fw.prepare_instance_filter(instance_ref, network_info)
      File "nova/virt/firewall.py", line 184, in prepare_instance_filter
        self.refresh_provider_fw_rules()
      File "nova/virt/firewall.py", line 474, in refresh_provider_fw_rules
        self._do_refresh_provider_fw_rules()
      File "nova/openstack/common/lockutils.py", line 267, in inner
        with lock(name, lock_file_prefix, external, lock_path):
      File "/usr/lib64/python2.7/contextlib.py", line 17, in __enter__
        return self.gen.next()
      File "nova/openstack/common/lockutils.py", line 231, in lock
        ext_lock = external_lock(name, lock_file_prefix, lock_path)
      File "nova/openstack/common/lockutils.py", line 180, in external_lock
        lock_file_path = _get_lock_path(name, lock_file_prefix, lock_path)
      File "nova/openstack/common/lockutils.py", line 171, in _get_lock_path
        raise cfg.RequiredOptError('lock_path')
    RequiredOptError: value required for option: lock_path

The first workaround is to launch using (which run_tests.sh does)

 $ python -m nova.openstack.common.lockutils

but it is nicer to developers if we just avoid the need for using
external lock files during the test suite execution entirely. This
can be done by mocking the 'external_lock' method to use a transient
semaphore instead of external lock file on disk.

Closes-bug: #1369973
Change-Id: I3dcdf6353986ff35c7237644f467ee7e98423f76