Alex Zel
Alex Zel

Reputation: 688

Python pyghmi (IPMI) unable to connect to server

I've been trying to get SaltStack to work with IPMI, looking at the source code I see the ipmi module uses pythons pyghmi, no matter what I try I always get the following error:

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

However, using ipmitool from command line (with the same username and password) works fine, I'm able to connect and execute commands.

Also I've tried with a simple python script:

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)

But that fails with the same error (tried with python 2.7 and 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)

Any insight would be welcome, I couldn't find any documentation about pyghmi unfortunately.

Upvotes: 1

Views: 1373

Answers (1)

gtmanfred
gtmanfred

Reputation: 593

From the docs it looks like you should be using

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

So api_pass instead of api_password.

Upvotes: 0

Related Questions