OpenStack里oslo.config的安装

一般在搭建openstack的时候,各个模块都会有相应的requirement以及具体的版本限制,在本地MAC上安装tempest的时候,pbr等都没出现问题,而oslo.config却出现了一个问题

在requirement里,oslo.config的限制为

oslo.config>=1.2.0

那么再用pip进行安装的时候,就直接给安装了个3.x的高版本,而且没报错

$ pip freeze | grep oslo.config
oslo.config==3.12.0

但是再通过nosetests执行用例的时候,会出现一个报错:

Failure: ImportError (No module named oslo.config) ... ERROR

======================================================================
ERROR: Failure: ImportError (No module named oslo.config)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 411, in loadTestsFromName
    addr.filename, addr.module)
  File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/opt/stack/tempest/tempest/api/network/test_extensions.py", line 17, in 
    from tempest.api.network import base
  File "/opt/stack/tempest/tempest/api/network/base.py", line 20, in 
    from tempest import clients
  File "/opt/stack/tempest/tempest/clients.py", line 18, in 
    from tempest import config
  File "/opt/stack/tempest/tempest/config.py", line 22, in 
    from oslo.config import cfg
ImportError: No module named oslo.config

我这里随便执行了一个用例,其它用例也是一样的错误,这就奇怪了,安装是成功的,只有可能版本有问题,难道太新了?

抱着试一试的态度,给版本限制加了一个上限

$ cat oslo.txt
oslo.config>=1.2.0,<=1.7.0

安装一下

$ sudo -H pip install -r oslo.txt
Downloading/unpacking oslo.config>=1.2.0,<=1.7.0 (from -r oslo.txt (line 1))
  Downloading oslo.config-1.7.0-py2.py3-none-any.whl (65kB): 65kB downloaded
Requirement already satisfied (use --upgrade to upgrade): six>=1.9.0 in /usr/local/lib/python2.7/dist-packages (from oslo.config>=1.2.0,<=1.7.0->-r oslo.txt (line 1))
Downloading/unpacking pbr>=0.6,!=0.7,<1.0 (from oslo.config>=1.2.0,<=1.7.0->-r oslo.txt (line 1))
  Downloading pbr-0.11.1-py2.py3-none-any.whl (79kB): 79kB downloaded
Requirement already satisfied (use --upgrade to upgrade): netaddr>=0.7.12 in /usr/local/lib/python2.7/dist-packages (from oslo.config>=1.2.0,<=1.7.0->-r oslo.txt (line 1))
Requirement already satisfied (use --upgrade to upgrade): stevedore>=1.1.0 in /usr/local/lib/python2.7/dist-packages (from oslo.config>=1.2.0,<=1.7.0->-r oslo.txt (line 1))
Requirement already satisfied (use --upgrade to upgrade): argparse in /usr/lib/python2.7 (from oslo.config>=1.2.0,<=1.7.0->-r oslo.txt (line 1))
Requirement already satisfied (use --upgrade to upgrade): pip in /usr/lib/python2.7/dist-packages (from pbr>=0.6,!=0.7,<1.0->oslo.config>=1.2.0,<=1.7.0->-r oslo.txt (line 1))
Installing collected packages: oslo.config, pbr
  Found existing installation: oslo.config 3.12.0
    Uninstalling oslo.config:
      Successfully uninstalled oslo.config
  Found existing installation: pbr 1.10.0
    Uninstalling pbr:
      Successfully uninstalled pbr
Successfully installed oslo.config pbr
Cleaning up...
$ pip freeze | grep oslo.config
oslo.config==1.7.0

验证一下,果然OK了

$ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from oslo.config import cfg
>>>
>>>

再执行下用例,顺利通过

$ nosetests -sv tempest/api/network/test_ports.py
tempest.api.network.test_ports.PortsAdminExtendedAttrsTestJSON.test_create_port_binding_ext_attr ... ok
tempest.api.network.test_ports.PortsAdminExtendedAttrsTestJSON.test_list_ports_binding_ext_attr ... ok
tempest.api.network.test_ports.PortsAdminExtendedAttrsTestJSON.test_show_port_binding_ext_attr ... ok
tempest.api.network.test_ports.PortsAdminExtendedAttrsTestJSON.test_update_port_binding_ext_attr ... ok
tempest.api.network.test_ports.PortsTestJSON.test_create_bulk_port ... ok
tempest.api.network.test_ports.PortsTestJSON.test_create_port_in_allowed_allocation_pools ... ok
tempest.api.network.test_ports.PortsTestJSON.test_create_show_delete_port_user_defined_mac ... ok
tempest.api.network.test_ports.PortsTestJSON.test_create_update_delete_port ... ok
tempest.api.network.test_ports.PortsTestJSON.test_create_update_port_with_second_ip ... ok
tempest.api.network.test_ports.PortsTestJSON.test_list_ports ... ok
tempest.api.network.test_ports.PortsTestJSON.test_list_ports_fields ... ok
tempest.api.network.test_ports.PortsTestJSON.test_port_list_filter_by_router_id ... ok
tempest.api.network.test_ports.PortsTestJSON.test_show_port ... ok
tempest.api.network.test_ports.PortsTestJSON.test_show_port_fields ... ok

----------------------------------------------------------------------
Ran 14 tests in 85.867s

OK

发表回复