[英]openstack API python - no module named version
I'm trying to instanciate VM on openstack using the NovaClient API in python. 我正在尝试使用python中的NovaClient API在openstack上实例化VM。 More precisely with mq-rabbit celery tasks.
使用mq-rabbit芹菜任务更精确。
Unfortunatly I got this error : 不幸的是我得到了这个错误:
from novaclient import client
File "/usr/local/lib/python2.7/dist-packages/novaclient/__init__.py", line 15, in <module>
import pbr.version
ImportError: No module named version
I already tested with a simple python file and it works, my VM was created but when I try to do this throught a celery tash I got the error above... 我已经用一个简单的python文件进行了测试,并且可以正常工作,创建了我的VM,但是当我尝试通过芹菜色做此操作时,出现了上面的错误...
My version is the latest python-novaclient-6.0.2, but as our servers are in version 2 I use the version 2 API. 我的版本是最新的python-novaclient-6.0.2,但是由于我们的服务器处于版本2中,所以我使用版本2 API。 Here is my code in my celery task, who works when I test in python shell :
这是我的celery任务中的代码,当我在python shell中测试时,该代码可以工作:
loader = loading.get_plugin_loader('password')
auth = loader.load_from_options(auth_url=auth_url, username=username, password=password, project_name=tenant_name)
sess = session.Session(auth=auth)
nova = client.Client('2', session=sess) #API version and session
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.