1

我一直在尝试让 SaltStack 与 IPMI 一起工作,查看源代码我看到 ipmi 模块使用pythons pyghmi,无论我尝试什么,我总是会收到以下错误:

Insufficient resources to create new session (wait for existing sessions to timeout)

但是,从命令行(使用相同的用户名和密码)使用 ipmitool 可以正常工作,我能够连接和执行命令。

我也试过一个简单的python脚本:

from pyghmi.ipmi.private import session


def _onlogon(response):
    if 'error' in response:
        raise Exception(response['error'])

s = session.Session(bmc='10.0.0.100',
                    userid='USER',
                    password='PASS',
                    onlogon=_onlogon)

但这失败并出现相同的错误(尝试使用 python 2.7 和 3.5):

Traceback (most recent call last):
  File "/tmp/pycharm_project_858/main.py", line 15, in <module>
    s.wait_for_rsp(timeout=1)
  File "/usr/local/lib/python2.7/dist-packages/pyghmi/ipmi/private/session.py", line 1103, in wait_for_rsp
    relsession.process_pktqueue()
  File "/usr/local/lib/python2.7/dist-packages/pyghmi/ipmi/private/session.py", line 1194, in process_pktqueue
    self._handle_ipmi_packet(pkt[0], sockaddr=pkt[1], qent=pkt)
  File "/usr/local/lib/python2.7/dist-packages/pyghmi/ipmi/private/session.py", line 1261, in _handle_ipmi_packet
    self._handle_ipmi2_packet(data)
  File "/usr/local/lib/python2.7/dist-packages/pyghmi/ipmi/private/session.py", line 1283, in _handle_ipmi2_packet
    return self._got_rmcp_response(data[16:])
  File "/usr/local/lib/python2.7/dist-packages/pyghmi/ipmi/private/session.py", line 1363, in _got_rmcp_response
    self.onlogon({'error': errstr})
  File "/usr/local/lib/python2.7/dist-packages/pyghmi/ipmi/private/session.py", line 537, in onlogon
    waiter(parameter)
  File "/tmp/pycharm_project_858/main.py", line 6, in _onlogon
    raise Exception(response['error'])
Exception: Insufficient resources to create new session (wait for existing sessions to timeout)

欢迎任何见解,不幸的是,我找不到任何关于 pyghmi 的文档。

4

1 回答 1

0

从文档看来您应该使用

https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.ipmi.html#salt.modules.ipmi.fast_connect_test

api_host=127.0.0.1
api_user=admin
api_pass=example
api_port=623
api_kg=None

所以api_pass代替api_password.

于 2017-05-24T15:25:39.457 回答