There was a problem where the io thread could exist, but not yet
be ready. Fix this by adding an iothreadready bool and a list of
events to fire when iothread is ready.
Change-Id: I4eb13e2210fa07bddbe717f56b12c736c99938dc
IPMI 2.0 rev 1.1 adds support for modeling standby power supplies
and OS installation. Add the appropriate constants.
Change-Id: I60ff394dad5209cedc6030afd740348db79c7f17
Notably, optical was the canonical output but not a recognized input.
'safe' and 'bios' added by request as well.
Change-Id: I061bbc6bce47fcdd2f3b7e9a3d3fb5f74569df15
In certain circumstances, the account desired for use with pyghmi will
be merely operator. Accomodate this without configuration required by
going for admin and then falling back to operator by default. For now
try to go no lower than operator. It would be conceivable to go down
to user, but most everything one would want a service processor for
at that point isn't feasible anyway.
Change-Id: I775aee5db0ca5b8f18bebc2210d342e3d629016d
Go through the IPMI spec and just add as much of table 42-3 as
is reasonable. This should greatly improve usefulness of data
for a wider variety of circumstance.
Change-Id: I05693a609ddeecb49f18d7602403af72565b1a61
Add more information from table 42-3 to the codes understood by pyghmi.
A sensor reporting status on version/revision changes now resolves
to something meaningful.
Change-Id: Ib60b08e2762ece194c0905e4bf840b9a23257360
Previously, pyghmi would incur a KeyError in the event of
something like sensor specific event not in the lookup tables.
Fix this by catching the error and putting in generic description
of state and flagging as 'warning'. This sort of warning suggests
a bug in pyghmi that pyghmi needs to have its event descriptions
updated.
Change-Id: Ia5f4645e30a341a93456dae2b8d75d9fda542e1b
This allows pyghmi to accurately describe events pertaining to event log being
disabled for one reason or another.
Change-Id: Ieebbaa1d836ea115872e4bb6611ff1e9ade6e2c2
Implement sending break over SOL. A BMC may elect
to reply to this with a NACK saying 'break happened',
so have code treat that as 'ACK', since that was after all
the whole intent.
Change-Id: I84c85962fd80901bdef3fa22c3df4936420fb108
This seems to be a wash performance and functionality wise. It does however
mean one less segment of code that incurs an external dependency.
Change-Id: I6691d95172d7d83eae4b4ed1265ba398b220f501
In case of unicode username and password values, just utf-8 encode them.
Here, the encoding shouldn't matter much. All parties must agree
on encoding, but UTF-8 is fine.
Change-Id: Ia4a8a4fcbc5ea9b12ee45ebcc566abe4713b544a
The 'command' variant of raw_command did not recognize the delay_xmit
parameter. When code was changed to go through self instead of through
session, this facet was missed. Fix the problem by adding hook to
pass through that information.
Change-Id: I6c5a13940e753c4300b18500bad60f216e08ad43
When something other than the IO worker thread requests a delay,
there was an interval between pending requests and the new
deadline being calculated during which the non-IO thread would
erroneously consider the old rather than upcoming deadline.
Address by creating a worst case deadline prior to evaluating
pending requests.
Change-Id: Iabde555eb81d2155f4bc4562f0b3a209e1be42a9
If data was sent prior to the activate payload response, the code
to calculate the maximum chunk could not suceed. Correct this
by having sent data accumulate as pending until connected state reached.
Change-Id: I7c9aed67209b3526bd10cafeee0bae6b1b0ab85f
While pyghmi was recording the maximum size the BMC advertised as accepting,
it was not honoring it. Correct this by having the sendpendingpayload function
only send the first 'self.maxoutcount' bytes. This actually turns into a loop
because the ACK coming back for the chunk of data triggers a send of pending
data, which includes the leftovers of the last attempt.
Change-Id: I8e443e08a6eb4ed89eb74412cca92e2138cf9d00
console at least needed the assignment to the session to occur
prior to its callback working. Move the responsibility of the
mandatory loop iteration up a layer so that pyghmi won't break,
but calling code won't have to worry about this either.
Change-Id: I6711acf97574581bb389259563e82e4430bb3f98
Previously, calling code had to manually force an event loop iteration
after making an asynchronous session creation request. Address that
by making a non blocking iteration request happen automatically.
Change-Id: I64f814401cb5ac397ac9ca4a1ae1d434976a2b01
When calling from various threading code strategies, pyghmi
would cause confusion and eventlet to print debug output.
Create a dedicated IO thread to isolate the shared socket
usage from calling code thread behavior. Currently, it still
requires that calling code loop on wait_for_rsp to assure session
liveness and/or to do SOL.
Change-Id: I66164adbfd867200af53269553210a70a0619a85
If the console layer sends an SOL payload with zero data (which is
valid to do) the session object would treat that as keeping the
session alive on the BMC side. Many BMCs do not consider empty
SOL payload packets toward session activity. Accomodate by having
the keepalive deferral not be triggered by such packets.
Change-Id: I8d278dbc48fae296c754ce9bc8f05bc92b560374
When establishing a session, there is not much to lose.
If three get channel authentication capabilities fail, it's
almost certainly because it just isn't going to work (bad IP,
rebooting BMC, something like that). However, once signs of life
have been displayed, the likely cause of an outage shifts toward
a transient network outage (e.g. link speed negotiation after
rebooting a shared nic configured solution). Particularly with SOL,
there is a high chance of inflight data worth trying to recover the
session to get. For that we go to tolerating up to ~20 seconds of
outage. Much longer than that and we are pretty much certain to run
afoul of BMC timeout anyway, so no hope of withstanding something like
spanning tree with blocking by default, but it can withstand moderately
well configured networks.
Change-Id: I783d13eaee4360cfd780e28b2b4cbf77cc980945
If a caller tries to send data immediately after getting their
Console object, they can trigger a problem since the session is not
yet established. Correct this by spinning in send_payload until
session is either established or fails.
Change-Id: Ia3a2582563d5385212202c036c0716a3cf36b80c
Previous changes resulted in construction of a new dict nesting the
dict of interest. Correct this by passing through dict rather than
embedding it within another dict.
Change-Id: I77969097f530c866cb00d07844393676ac254907
The IPMI session layer now, with more constants defined, catches the SOL
error and populates 'error' message. Move the generic handler code
to come after the specific condition handler to allow things like forced
sessions to work as expected.
Change-Id: I62ab5fc16a9af631317eff78b8445b06a76b56d8
If a client attempts connection to a BMC that is not there,
unusual KeyError would get thrown. Correct this by only
attempting to deregister the element if it is registered.
Change-Id: I3febb92ae8bc40c2847758797f179e85d58d97b1
If a session becomes non viable, alert the calling code to the condition.
Calling code needs to be able to recognize non string data if registering
a callback for this to work.
Change-Id: I0bb921c5b88edd1ca2e4ba2594e28e9e0ce5ca81
When a session is broken for whatever reason, make it possible for
a long running user of the library to reasonably recover by
having a broken Session object detect the situation and disqualify
itself from the mechanisms to reuse sessions.
Change-Id: Id63c3490d6bbeab7d5de7f92c1eae012a648c416
If a Session object is broken (e.g. BMC goes away or network outage),
then its keepalive timer would cause an application to be starved
of being able to do any IPMI related work. Address this scenario
by having the instance deregister its keepalive at the point it
reports itself as broken.
Change-Id: I6b7af8ad03759c676110fb4f0b7bfa41642152f3
Previously support was added for 'analog' sensors. This incorporates
support for 'discrete' sensors. Those are sensors without a particular
numeric value, but a set of states to assert.
Change-Id: Ia8087ded8699f6f59853ffc93cc1842f8867faca
Support BMC bridge request, users can specify
target slave address and channel number for the command
Change-Id: Idf4c4567013e769ab71350db4cea947b2dc820ed
Provide a convenience function that summarizes the overall health
of the managed system based. Currently, it just enumerates all
SDR indicated sensors seeking unhealthy readings.
Change-Id: Ifce6d05623acc86b6bf42ceb57824b65eefa36ae
This patch implements SDR retrieval and the foundation to use the data
to translate raw sensor reading data to usable information.
Change-Id: Ic77fcde6a283a2ee7745a9c159038d2655911b0a
Having previously forgotten about the callback option in logout, programs
could generally not actually complete. Fix it so that logout() works as
intended.
Change-Id: I04394821646074c734438b7de6970c8282e2c761
In the private session module, there was originally a thought
that a callback model was going to be the path for code to implement
interleaved execution. However, since that point a coroutine pattern
has proven to afford the same benefits with simpler looking calling code.
With this in mind, remove some of the disused code in order to make
the session module a little easier to follow.
Change-Id: Ice697df409dd188d7e3361d278f8b1ce1358a419
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