Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

options -R(retry) request #84

Open
SangHakLee opened this issue Oct 28, 2020 · 1 comment
Open

options -R(retry) request #84

SangHakLee opened this issue Oct 28, 2020 · 1 comment

Comments

@SangHakLee
Copy link

SangHakLee commented Oct 28, 2020

Do you have any plans to provide -R (retry) option?

-R retry Set the number of retries for lan/lanplus interface [default=4]

If ipmitool request to a hostname that does not exist, the following error occurs after about 5 seconds.

ipmitool

$ ipmitool -I lanplus -U user-P password -H 172.16.1.10  chassis status
Error: Unable to establish IPMI v2 / RMCP+ session

python-ipmi

ipmi.get_chassis_status()

Traceback (most recent call last):
  File "ipmitool/ipmi.py", line 16, in <module>
    device_id = ipmi.get_device_id()
  File "pyipmi/bmc.py", line 25, in get_device_id
    return DeviceId(self.send_message_with_name('GetDeviceId'))
  File "pyipmi/init.py", line 206, in send_message_with_name
    rsp = self.send_message(req)
  File "pyipmi/init.py", line 190, in send_message
    rsp = self.interface.send_and_receive(req)
  File "pyipmi/interfaces/ipmitool.py", line 146, in send_and_receive
    rsp_data = self.send_and_receive_raw(req.target, req.lun, req.netfn,
  File "pyipmi/interfaces/ipmitool.py", line 119, in send_and_receive_raw
    raise RuntimeError('ipmitool failed with rc=%d' % rc)
RuntimeError: ipmitool failed with rc=1

Since this time is too long, if i use the -R 1 option, an error is returned within 2 seconds.

$ ipmitool -I lanplus -U user -P password -H 172.16.1.10  chassis status -R 1

So, I want the following change.
https://github.com/kontron/python-ipmi/blob/0.4.2/pyipmi/interfaces/ipmitool.py#L187

...
    cmd += (' -R "%d"' % 1) # '1' is example, to be variable
...

Do you agree to offer these options? If you agree, I will send you an MR.

@hthiery
Copy link
Contributor

hthiery commented Dec 12, 2020

If you make the chane configurable I'm fine with that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants