In command.py, settled on coroutine structure as the sole design
pattern to support. To be consistent, abolish the use of callback
from console.py as well so that SOL does not needlessly act so different
from command.py in the scenarios where it can act the same.
Change-Id: I7a26a7c9b929ef7e63ca23c595a28baeb7f1e1b9
If a command payload is pending, fix calls to raw_command by
deferring instance modification until the last command was settled.
Fix a deadlock scenario where packet transmit gets blocked by
waiting on incoming packets that will never come by avoiding
calling out to caller custom handlers which might expect to be
submitting new requests during transmit.
Fix a problem if command is requested while awaiting for an SOL
acknowledgement.
Change-Id: Ia352566819cce06c6e4e5279afeb6191838e0488
When multiple session objects would be created by calling code,
avoid creating a conflict on bmc_handlers that would result
in trying to use a corrupt instance. Either it reuses the
existing object, or else it detects that some parameters are
different and erases old pointers to the now defunct instance.
Change-Id: I883934ae984b2ad0369458bea15f62862c6e97ca
During atexit time, do not wait for BMCs to acknowledge logout.
This is generally a waste of time and can cause things like eventlet
to complain since atexit won't exit in a coordinated way with
greenthread context
Change-Id: I295215614ee6a20ce63f5a9ac37bbe3d9b2d9848
If a SOL target sends a packet with no new data (e.g. spurious retry), do not
bother the caller with such empty data. It's a waste of their attention at
best and if the caller is doing something like trying to write the data
straight to a TLS socket, it will trigger EOF exception.
Change-Id: I1d751331bc0fa0087bf671de12507b7fe011f5fa
Caller is likely going to want to catch certain conditions. For those,
use more specific exception classes. Exceptions indicating either TODO
or usage errors are being left as 'Exception' for the time being.
Change-Id: I4d68a2dbc394b534d54586b9f770160c1409f720
Previously, pyghmi only could have file objects registered. Accept
and adjust as appropriate to accomodate plain int filedescriptors.
This allows, for example, os.pipe() construct to be hooked.
Change-Id: Ie5e81a2276c68e9235d373d4a662f7b1aef153f5
When BMC sent NACK, pyghmi incorrectly attempted to construct new payload
by concatenating a tuple and str. Fix by converting the tuple to
str prior to sending.
Change-Id: Ia07384651870bf01e7dc24757e1e00018ab84556
Trying to remove usage of d2to1 - it can cause breakages.
Also, had to fix hacking 102. Turns out it expects copyright headers in
comments, not docstrings.
Change-Id: I3494349ffe2d4cba9c8bcb73408d60bbc12eff5e
In complicated uses of pyghmi, it becomes useful to call into the
otherwise private event loop iteration. This exposes the
wait_for_rsp method so that it may be consumed without violating
the expectations of private.
Change-Id: Iee64615f0577b00895f8c3db25676c877107b0be
In changing to select, the nature of the return value failed.
When using poll(), we got file descriptor number. However select
provides the object and so we have to consult the fileno() method.
Change-Id: Ic525b315024b164eed22238ad1e4a89eed0fcf0c
poll is not available in all platforms. Additionally, eventlet
does not handle poll in a monkey patching scenario. Use select()
as the greatest common factor.
Change-Id: I170d6efb1636249df4b7ed42eac6378ae317cb35
Previously, callback had to be a function. This misses a lot of things,
notably instance methods. Change to recognize any callable.
Change-Id: I9d2a00fe53f7e8039f0badeb4af0fdd3c6339b89
In the case of using function callin/callout, the console module was missing
a callin. Correct that omission.
Change-Id: I233b43eadf115ad617958148878b96f38bff1971
It is possible and in some cases required for an implementation to deviate
from the IPMI standard port of 623. This enables the library to actually
support that case.
Change-Id: I62e322410924153cebde9827d7ba0d0583aa1d83
The test harness was incorrectly throwing string values at the library.
Correct that by explicitly converting from hex string to int.
Additionally, command.py was failing to pass data through.
Change-Id: Iceda4c3b4a382992d445f90dfbc19f6c75b528df
set_power failed to raise when error encountered. The behavior is
amended to be consistent with other functions.
set_power requested on/off state even if system already was in requested
state. Change to simply report success in that scenario.
Change-Id: I6feb8f4384705136a5ab1fae0899ea27b2d3511c
Some have expressed a concern that ipmi is both too generic a term
and too limiting in scope. Change python-ipmi to pyghmi to more
easily allow the project to be specifically be referenced and denote
the likelihood of non-ipmi protocols being supported
Change-Id: I9c96f2154050a2970fc217e0eeae733605a38bde
Change from poll() to select() for the potentially long wait in ipmi
event loop. This is to facilitate interop with being monkey patched
with eventlet, as eventlet does not currently monkey patch poll(), but
does monkey patch select()
Change-Id: I8d6f42193ee82e2c5de7ad112232c2c77ef78825
Previously, wait would always be indefinite and act in many ways like
a busy wait. The check for completion now takes one second between
every check. The default behavior now goes for 300 seconds, but
wait can now take an int to indicate a different preference by the
caller. 300 seconds may seem like a lot, but the 'softoff' request
in particular suggests waiting for OS shutdown process to complete.
Additionally, some bugs in the retry logic were noted in the process
of having the retry timer drive the delay and are corrected.
Change-Id: Ibe34e87c2a58f13981d60e5f80b4b636e67ac3f9
It has been expressed as a concern that 'ipmi' is too generic a name.
Additionally, it is also the case that non-ipmi capability is likely
to be incorporated as it goes along (e.g. Enclosure management and
virtual media are frequently not IPMI based).
Move existing content under the 'pyghmi' namespace. pyghmi stands for
'python general hardware management infrastructure' and is pronounced
'pygmy'
Change-Id: Ib549a9f5b7dd549c7dc5ddbab251a2e06c572e41
After some contemplation, I realized that given the underlying behavior of 'wait_for_rsp', that
synchronous and asynchronous calls play well with each other. The pattern of considering an 'onlogon'
function as running in a sort of greenthread works well and leads to much more comprehensible code
for the average person. While removing those arguments, the module contents were reorganized to
serve as an example of how more straightforward code written in this fashion may be.
Change-Id: I9c83660e4d3c68ad8ae0c016a3377b2a0e7ee6ec
Previously the ipmi session was using time.time(). This means
that retries and keepalives could be thrown off by things like ntp
or manual time corrections.
Ideally, we'd use the baked in time.monotonic(), but that doesn't exist
aside from python 3.3
Change-Id: Ia00026cef6df214f9463909309de44767c3752b5
Assure that a live session shows activity at least once every 25-29.9 seconds.
The interval is randomized to mitigate risk of some synchronized activity
bringing on a wave of activity all at once. The spec indicated timeout is
'about' 60 seconds by default, but an implementation could lower it to 30
seconds within reason within the constraints of the spec.
Change-Id: I74dc78757b11571c23cb309c99eee667787ffc79
I realized that I had never pushed __init__.py for private.
While doing tests locally, I noticed that the pep changes broke at least one
place in code, correct that.
Change-Id: Ia31cb8a75a7109a6d002524e08ef335e1c5018d4
Rename '_pack_payload' in private module to 'send_payload' as it is more
descriptive of what is happening and will be called by console.py
Change-Id: Ifa70d269c8a1e37cc5b6466845931f22cd97d6c3
Ran autopep8 on the four .py files in this module.
Manully fixed many additional pep8 errors as well,
Turned some long-line-comments into proper NOTE lines,
but there are more to do...
Change-Id: I657ba037863860ec3956150931c2c0e41085bd63
Rearranged Sphinx.
Put project under PBR control.
Added tox file.
Added .testr.conf file in anticipation of testr testing.
Change-Id: I55180a6a3d224816c82999bf66156c7874786b17