libvirt: avoid need for lockutils setup running test cases
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

Tehsmash/nova,affo/nova,BeyondTheClouds/nova,mgagne/nova,takeshineshiro/nova,cloudbase/nova,akash1808/nova_test_latest,petrutlucian94/nova,watonyweng/nova,projectcalico/calico-nova,cloudbase/nova-virtualbox,mmnelemane/nova,BeyondTheClouds/nova,vladikr/nova_drafts,kimjaejoong/nova,redhat-openstack/nova,TwinkleChawla/nova,hanlind/nova,akash1808/nova,JianyuWang/nova,mandeepdhami/nova,scripnichenko/nova,vmturbo/nova,double12gzh/nova,belmiromoreira/nova,raildo/nova,Yusuke1987/openstack_template,rajalokan/nova,zaina/nova,ted-gould/nova,blueboxgroup/nova,fnordahl/nova,Francis-Liu/animated-broccoli,JioCloud/nova_test_latest,gooddata/openstack-nova,noironetworks/nova,JioCloud/nova_test_latest,zhimin711/nova,silenceli/nova,CloudServer/nova,klmitch/nova,whitepages/nova,jianghuaw/nova,gooddata/openstack-nova,barnsnake351/nova,LoHChina/nova,felixma/nova,jianghuaw/nova,jeffrey4l/nova,mahak/nova,klmitch/nova,double12gzh/nova,devendermishrajio/nova_test_latest,alexandrucoman/vbox-nova-driver,hanlind/nova,kimjaejoong/nova,gooddata/openstack-nova,Juniper/nova,devendermishrajio/nova_test_latest,yatinkumbhare/openstack-nova,sebrandon1/nova,Metaswitch/calico-nova,zhimin711/nova,watonyweng/nova,bgxavier/nova,Metaswitch/calico-nova,affo/nova,dawnpower/nova,mikalstill/nova,alaski/nova,fnordahl/nova,edulramirez/nova,zzicewind/nova,devendermishrajio/nova,sebrandon1/nova,klmitch/nova,berrange/nova,apporc/nova,eonpatapon/nova,Juniper/nova,akash1808/nova,silenceli/nova,thomasem/nova,Stavitsky/nova,felixma/nova,tealover/nova,vmturbo/nova,cernops/nova,mikalstill/nova,varunarya10/nova_test_latest,joker946/nova,jeffrey4l/nova,joker946/nova,angdraug/nova,barnsnake351/nova,tianweizhang/nova,mikalstill/nova,cloudbase/nova-virtualbox,edulramirez/nova,Francis-Liu/animated-broccoli,tianweizhang/nova,thomasem/nova,mahak/nova,cernops/nova,JianyuWang/nova,zaina/nova,maelnor/nova,ruslanloman/nova,Juniper/nova,mandeepdhami/nova,rajalokan/nova,rajalokan/nova,CCI-MOC/nova,vmturbo/nova,orbitfp7/nova,alvarolopez/nova,sebrandon1/nova,cyx1231st/nova,adelina-t/nova,LoHChina/nova,nikesh-mahalka/nova,eayunstack/nova,iuliat/nova,klmitch/nova,belmiromoreira/nova,openstack/nova,eonpatapon/nova,maelnor/nova,jianghuaw/nova,vladikr/nova_drafts,tudorvio/nova,rahulunair/nova,CEG-FYP-OpenStack/scheduler,dims/nova,cloudbase/nova,mmnelemane/nova,orbitfp7/nova,CCI-MOC/nova,badock/nova,berrange/nova,JioCloud/nova,shail2810/nova,MountainWei/nova,scripnichenko/nova,Tehsmash/nova,vmturbo/nova,projectcalico/calico-nova,tangfeixiong/nova,j-carpentier/nova,j-carpentier/nova,badock/nova,isyippee/nova,rahulunair/nova,alaski/nova,CEG-FYP-OpenStack/scheduler,MountainWei/nova,BeyondTheClouds/nova,yosshy/nova,isyippee/nova,dims/nova,NeCTAR-RC/nova,ruslanloman/nova,iuliat/nova,zzicewind/nova,phenoxim/nova,eayunstack/nova,tudorvio/nova,alvarolopez/nova,bigswitch/nova,angdraug/nova,redhat-openstack/nova,petrutlucian94/nova,cloudbase/nova,TwinkleChawla/nova,yosshy/nova,blueboxgroup/nova,jianghuaw/nova,mgagne/nova,devendermishrajio/nova,alexandrucoman/vbox-nova-driver,apporc/nova,tangfeixiong/nova,Stavitsky/nova,yatinkumbhare/openstack-nova,adelina-t/nova,tealover/nova,phenoxim/nova,noironetworks/nova,rahulunair/nova,hanlind/nova,openstack/nova,whitepages/nova,cyx1231st/nova,akash1808/nova_test_latest,NeCTAR-RC/nova,rajalokan/nova,gooddata/openstack-nova,dawnpower/nova,shail2810/nova,nikesh-mahalka/nova,raildo/nova,JioCloud/nova,varunarya10/nova_test_latest,takeshineshiro/nova,bigswitch/nova,Yusuke1987/openstack_template,ted-gould/nova,mahak/nova,bgxavier/nova,cernops/nova,Juniper/nova,openstack/nova,CloudServer/nova