0

根据 Openstack Official Heat/Plugins wiki https://wiki.openstack.org/wiki/Heat/Plugins的指示,我们只需要“安装插件,将 Python 模块复制到配置的插件目录之一。注意此后必须重新启动 heat-engine 才能加载新插件。”。但是我在重新启动热机后遇到以下错误消息..

[root@cs14 heat]# heat-engine
2015-05-04 06:02:09.774 20839 WARNING heat.common.config [-] HT-A65A0DF The "instance_user" option in heat.conf is deprecated and will be removed in the Juno release.
[05/04/2015 06:02:10 EDT]heatCRITICAL : ImportError: No module named my_heat_plugin.client
Traceback (most recent call last):
  File "/usr/bin/heat-engine", line 67, in <module>
    srv = engine.EngineService(cfg.CONF.host, rpc_api.ENGINE_TOPIC)
  File "/usr/lib/python2.6/site-packages/heat/engine/service.py", line 288, in __init__
    resources.initialise()
  File "/usr/lib/python2.6/site-packages/heat/engine/resources/__init__.py", line 44, in initialise
    _load_global_environment(global_env)
  File "/usr/lib/python2.6/site-packages/heat/engine/resources/__init__.py", line 49, in _load_global_environment
    _load_global_resources(env)
  File "/usr/lib/python2.6/site-packages/heat/engine/resources/__init__.py", line 54, in _load_global_resources
    manager = plugin_manager.PluginManager(__name__)
  File "/usr/lib/python2.6/site-packages/heat/engine/plugin_manager.py", line 58, in __init__
    self.modules = list(modules())
  File "/usr/lib/python2.6/site-packages/heat/common/plugin_loader.py", line 91, in load_modules
    module = _import_module(importer, module_name, package)
  File "/usr/lib/python2.6/site-packages/heat/common/plugin_loader.py", line 72, in _import_module
    module = loader.load_module(module_name)
  File "/usr/lib64/python2.6/pkgutil.py", line 238, in load_module
    mod = imp.load_module(fullname, self.file, self.filename, self.etc)
  File "/usr/lib/heat/abc_heat_plugin/resources/abc/abc_server.py", line 24, in <module>
    from abc_heat_plugin.client import constants as const
ImportError: No module named abc_heat_plugin.client

为了解决这个问题,我想出了两种可行的方法。方法 1. 将 abc_heat_plugin 复制到 /usr/lib/python2.6/site-packages 并重启 heat-engine 方法 2. 使用 .pth 文件。1)创建一个文件/usr/lib/python2.6/site-packages/.pth,下面三行(如果存在则不需要)

/usr/lib/heat
/usr/lib/heat/abc_heat_plugin
/usr/lib/heat/abc_heat_plugin/client

2) 将插件“my_heat_plugin”复制到/usr/lib/heat

3) 重启热服务

但是两种方式都必须比官方指南做的更多,所以我想知道我是否错过了任何重要的事情。有什么建议么?谢谢。(顺便说一句,my_heat_plugin 运行良好。)

4

1 回答 1

0

我认为基本思想是您将资源放入 中/usr/lib/heat,但是资源使用的任何模块或包都必须以通常的方式安装。您可以通过将文件移动到站点包来手动完成此操作。

例如,查看heat/contrib中的任何插件。有一些依赖关系,例如客户端到其他 OpenStack 服务,并且在所有情况下都假设这些客户端是单独安装的。

因此,如果可以,只需为您的客户端包创建一个 setup.py,然后将其与 heat 插件分开安装。

于 2015-05-26T18:23:01.473 回答