2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-13 11:17:47 +00:00

453 Commits

Author SHA1 Message Date
Jarrod Johnson
d1f48b02c0 Implement support for ThinkSystem servers
Change-Id: Ic45943c4b882bb13390722cca58b8b1785386e86
2017-06-20 13:30:32 -04:00
Jarrod Johnson
4c366d2f47 Move raising sync login exception
By raising it in the callback, another thread doing wait_for_rsp
might get hit by it.  Store the message and then raise in __init__
so that it lands in the correct vicinity.

Change-Id: Id450a4a3f6194d95bb0eac971e0586525c49e490
2017-05-09 15:51:59 -04:00
Jenkins
b5b4e83a39 Merge "Fix get_network_channel for BMCs that dislike 0xe" 2017-04-20 18:35:24 +00:00
Jarrod Johnson
130ef46579 Fix get_network_channel for BMCs that dislike 0xe
For channel 0xe, we can skip checking if the channel
is active, since, obviously, we are connected to that
channel.  Since *current* active channel cannot be
inactive, assume that is good if seen.

Change-Id: I894bd27e6c76bb9ace0959566117ad6a6f8866ad
2017-04-20 13:19:55 -04:00
Jenkins
dba5b9e608 Merge "Fix cleanup loop of changing dictionary" 2017-04-20 14:57:10 +00:00
Jarrod Johnson
42c0422930 Fix cleanup loop of changing dictionary
The dictionary size can change, causing this loop to
fail.  Fix by wrapping the iterator in a list prior to
iterating.

Change-Id: I67dd5b8b69698e67d6fd07ab18114ce144999d7a
2017-04-19 15:04:06 -04:00
Jarrod Johnson
a20566f8e2 Abort MAC decode from FRU if not 'binary'
If the TLV says the mac data is text, then it's not going to be a good day.
Abort in such a case.

Change-Id: I597df429de9af516aa28868d90f31984fa2923e2
2017-04-19 09:38:06 -04:00
Jarrod Johnson
b9b9620a9d Bypass eventlet sendto when detected
Sending a udp datagram doesn't block long enough to be bothered.  On
the flipside, the filehandle sharing can throw eventlet for a loop in
some environments and circumstances.

Change-Id: I2d6f8b79f0e49c5f21b3b0cf1b9956443ece7eea
2017-04-11 13:47:44 -04:00
Jarrod Johnson
324cc6a344 Change the wording of setup event
Circumstances are such that sometimes a BMC
logs being in setup at a time when it is
not strictly 'entering'.  Change wording
to be less specific.

Change-Id: I5863b07640df2a32ff5b1056f20d034fa86c0ae7
2017-03-14 13:52:40 -04:00
Jarrod Johnson
7fc07debf8 Set a 60 second timeout on web
Web connections were defaulting to infinite timeout.  If
a problem happened in the midst of a connection, a request
could hang things indefinitely.  Add a 60 second timeout
to purge these situations.

Change-Id: Ica05e2bfb9242ccc564e39c8631d8bf7e3f230a5
2017-02-27 11:35:19 -05:00
Jenkins
a363bd92fb Merge "Support in-band IPMI for Linux systems" 2017-02-27 16:09:14 +00:00
Jarrod Johnson
26573c1ce5 Support in-band IPMI for Linux systems
This is a subset of pyghmi functionality for use in dealing with BMC
over KCS or similar Linux driver supported IPMI access through
/dev/ipmi0

Change-Id: Ifeb3935cbb3c95e7871b74a2b42e59e71ecb6697
2017-02-27 08:21:19 -05:00
Jarrod Johnson
d77d0a1904 Allow LookupError on decode
If a minimal Python distro does not have
obscure decodes, do not cause a problem.
t review
Change-Id: Ife9631c353ca5b8160019eb26d0fe781a5c2179f
2017-02-26 16:53:32 -05:00
Jarrod Johnson
42b6807840 Add referer header to https requests
Another firmware change becomes sensitive to the value of referer.
This adds the same referer header value that would occur naturally from
a browser.

Change-Id: I20928bbd88a4df281f9fb4f7cc472419a6059f09
2017-02-23 08:55:48 -05:00
Jarrod Johnson
957c6c971e Fix issues with idle behavior
Some BMCs appear to expire a session within 30
seconds, unfortunately.

Also, be careful to always fire events, even if the remote has gone away.

Change-Id: I1b57fa8841ca19c77d36abe3ccc5bf877e09945a
2017-02-08 12:51:13 -05:00
Jenkins
d1318616c6 Merge "Provide more consistent attributes" 1.0.16 2017-01-13 14:11:30 +00:00
Jarrod Johnson
69d786c151 Provide more consistent attributes
When an reading is unavialable, a distinct set of
attributes were available.  Correct this by at
least having the same attributes available.

Change-Id: I9fc351d804f638a2535a2c9be9d9e9929f2be6ba
2017-01-12 07:26:37 -05:00
Jenkins
8eb72b9df1 Merge "Only complain about Device SDR if no SDRR" 1.0.15 2017-01-11 16:35:59 +00:00
Jarrod Johnson
f81a934fe4 Only complain about Device SDR if no SDRR
Some implementations offer device SDRs, but also
SDRR.  For such cases, gleefully ignore the device SDRs,
and move the 'needs implementing' down to a scenario where
it could both work and would be needed.

Change-Id: I2219ba7407f2e0030817d93f394657266e70deda
2017-01-10 08:59:50 -05:00
Jarrod Johnson
17fe93826f Refactor Lenovo OEM support
Rearrange things such that in the future, distinct generations
of IMM that are very similar may be supported with common
code through inheritence while deviating in the ways that are
needed.

This also removes the redundancy of registering the certificate
 callback in the OEM layer and standard layer and instead just
has it in the standard layer.

Change-Id: Ic386553d080163ed63b6e4f2294839654e377269
2017-01-06 12:51:27 -05:00
Lucas Alvares Gomes
de59a8e2e7 Add base for unittests and fix docs
Change-Id: Id130e6ea29523fd46ff795be1219016029127945
2017-01-05 15:52:14 +00:00
Jarrod Johnson
2963ecf466 Correct offset of a capability bit
Specification has corrected an internal bit offset,
so our implementation must adapt.

Change-Id: I62cf562cfd80b0bc680f41881bf64e421f503432
2016-12-07 14:25:50 -05:00
Jenkins
369f8440fa Merge "Raise IpmiException on error checking power state" 1.0.14 2016-12-01 18:14:26 +00:00
Jenkins
d77b4caa75 Merge "IpmiServer to allow using IP version 4" 2016-12-01 15:13:07 +00:00
Lucas Alvares Gomes
8322cf4628 IpmiServer to allow using IP version 4
This patch is changing the IpmiServer and Session classes to figure out
which IP version has been passed to it and create the correct socket.

Change-Id: I802c4e2dbe140da40f3f3111aa84d692d4374bb1
2016-12-01 08:35:12 -05:00
Lucas Alvares Gomes
1e6809fec9 Improve .gitignore
This patch is improving the .gitignore files to not track things like:
Python compiled code, Python eggs, VIM swap/backup files, etc...

Change-Id: I2b82d0a54c2584f5a5f7e8792ea8c71aaba48183
2016-11-30 17:02:33 +00:00
Jay Carman
b8ceb224f9 Raise IpmiException on error checking power state
To be consistent with the rest of the method this conditional should
raise an exception instead of returning a dictionary with error. Also a
:raises: note was added to the set_power docstring.

Change-Id: I3d99d630019bb180c0ce3cd4cdb7652b32651352
2016-11-16 16:17:31 -06:00
Jarrod Johnson
4fcc75899e Consolidate IMM date string parsing
Various strings/date formats may be used
in different places, and in fact the same place.
Use a consolidated catch-all parser to convert
the strings to a datetime.

Change-Id: Ie84229056ba55806bce1527ea263a80c29ff7048
1.0.13
2016-11-15 10:45:26 -05:00
Jarrod Johnson
2cfec95558 Ignore KeyError on delete of missing sensor
The duplicate sensor code can result in an id that never
gets added.  As such, do not worry if trying to delete
something that is already not there.

Change-Id: I77af1054097d4225ad8bff68a046c6ed28791e9b
2016-11-04 09:45:48 -04:00
Jenkins
563b15decf Merge "Implement IMM remote media mount" 1.0.12 2016-10-31 13:31:17 +00:00
Miles Gould
b6cac4cc46 Fix bullet points in README.md
Each line was getting its own bullet point, leading to bullet points in
the middle of sentences. This patch removes the excess bullet points.

Change-Id: Ifb3a5e66fe6796236efe46e4dbda0ee2e89b0fcc
2016-10-28 13:57:44 +01:00
Jarrod Johnson
fd92a734be Correct mistake with image name abbreviation
It was incorrectly trying to abbreviate names that
are already short enough, causing a problem for certain
name lengths.

Change-Id: Iebb977bef3db0131cad3d923f5943f9bfa9247a6
2016-10-27 14:11:13 -04:00
Jarrod Johnson
932087b5a6 Implement IMM remote media mount
New IMM firmware provides a mechanism to
specify a mount by URL.

Change-Id: Ib8575bd9fe6e81f0a3880f39a319e4fc53d15aef
2016-10-27 08:43:17 -04:00
Jarrod Johnson
a27d28fb0a Recognize and use CSRF token
Newer versions of IMM firmware implement a mechanism to guard
against CSRF.  Use the provided token via custom header to prove
that our requests are not CSRF.

Change-Id: I6cc030302ecacdfedc8e2fcf6e7588a82db957e7
2016-10-25 14:22:29 -04:00
Jenkins
87be4c8a41 Merge "Have range become xrange where available" 2016-10-12 17:17:02 +00:00
Jenkins
cfe511a594 Merge "Add script to help build rpms" 2016-10-12 16:45:07 +00:00
Jarrod Johnson
d76301be95 Have range become xrange where available
To have python 2 act more like python 3 and look
like python 3, make range = xrange where xrange exists.

Change-Id: I9918604a619f33682aee3b9896a3bb6afcd8aa8d
2016-10-12 12:38:11 -04:00
Jenkins
f354a3cc2c Merge "Fix webclient viability after error" 2016-10-12 15:26:04 +00:00
Jenkins
afdb132ac0 Merge "Check for buffer and use memoryview if missing" 2016-10-12 15:06:48 +00:00
Jarrod Johnson
66e0b916e4 Fix webclient viability after error
When error encountered, we still need to consume
the response with rsp.read(), or else a subsequent
request will fail.

Change-Id: Ica4f69cadf32a204af3e69a1ee6d336e08f7fc78
2016-10-12 10:48:08 -04:00
Luong Anh Tuan
cd5e8a1a88 Remove xrange for run both Python 2 and Python 3
In python 3, range() does what xrange() used to do and xrange() does not
exist. If you want to write code that will run on both Python 2 and
Python 3, you can't use xrange().

range() can actually be faster in some cases - eg. if iterating over the
same sequence multiple times. xrange() has to reconstruct the integer
object every time, but range() will have real integer objects.
(It will always perform worse in terms of memory however)

xrange() isn't usable in all cases where a real list is needed.
For instance, it doesn't support slices, or any list methods.

Change-Id: I15369a8b9335f5221a52d292a4aa1e36a0850b8f
2016-10-12 12:40:46 +07:00
Jarrod Johnson
dad54d5db5 Check for buffer and use memoryview if missing
Python 3 does not implement buffer.  Use memoryview
as a standin if buffer would induce a NameError.

Change-Id: Id36e8253fffee9dc22bd982e00554f1c25bc95b4
2016-10-11 11:09:08 -04:00
Jarrod Johnson
3f4185fa60 Add script to help build rpms
setup.py bdist_rpm is not very good.
Instead, provide a script to create an rpm.

Change-Id: If6773ee4938e981a14c38e4e4eabad6b5cb2b6ae
2016-10-11 11:08:06 -04:00
Jarrod Johnson
aee3ae36b0 Extend FPC status
FPC PSU status reporting requires OEM commands. Provide
OEM to pyghmi sensor model translation. to enable normal
applications to read it.

Change-Id: I63b950db7ffa5a5a2ba2ed3a2f2be33a53221b03
2016-10-04 10:18:20 -04:00
Jarrod Johnson
e52c0e3405 Improve SOL responsiveness
In a multi-SOL multiplex case, keepalives could
bring the whole thing to a grinding halt.
Fix this by having a way to request raw_command do
'waitall', which is really just running wait_for_rsp
recursively, as used to happen.  This is not done by default
as for normal synchronous requests, it is a much more expensive
approach at scale.  Reserve it for the special case of wait_for_rsp
which should not hang up on any one response going south.

Change-Id: If8890bf959c2376f58c2b36f0445a5b800280b2b
1.0.11
2016-09-16 16:01:43 -04:00
Jarrod Johnson
77d7d373c3 Handle disconnect notification without session
If session no longer exists, do not try to manipulate it's keepalives.
Remove instances of calling the function where it would be redundant.

Change-Id: I2011f8012175ef12ce83eb34fbf4de9650fb157e
1.0.10
2016-09-14 15:18:18 -04:00
Jarrod Johnson
c35781d4cf Fix error behavior when target has no SOL session
When a system did not have any custom keep alive, the
code to mark the esssion broken erroneously tries to
dereference.

Change-Id: Ic4efe3c65ee4c09c97ef9f08dc30603c4c15d872
2016-09-14 13:02:26 -04:00
Jarrod Johnson
657b75cc86 Fix multiple console object behavior
Software could end up creating duplicate console
objects.  Try to adapt by assuring only the most
recently created one is the sol_handler (by using
existing sol_handler to reach old instance).  Also
unhook a keepalive when we go broken.  When the ipmi
session breaks, notify all custom keepalives active,
rather than just the one currently holding SOL session.

Some of these changes in principle may be duplicate, but
it should be more robust this way.

Change-Id: Id8d3869917de3db723a4b6a79e02643345111b3a
2016-09-13 09:18:21 -04:00
Jenkins
b9dde55f49 Merge "Tolerate client reuse of UDP ports" 1.0.9 2016-08-30 18:33:58 +00:00
Jarrod Johnson
e6bad76e94 Tolerate client reuse of UDP ports
If a system runs many ipmi clients, over time
it may reuse UDP ports.  We currently take this
as a sign of an established relationship in
the same manner we have client to server, but
here clients can be ephemeral.  Cope by
clearing out the current session state
and allowing a new session to come alive.

Change-Id: I2496716d535354616461460f47196d733cde1a87
2016-08-30 13:04:49 -04:00