2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-14 19:57:47 +00:00

484 Commits

Author SHA1 Message Date
Jarrod Johnson
69b70441ac Connect backend completion to OEM handler
The OEM handler was not wired up all the way, correct
this oversight.

Change-Id: I30fcf011d0d82f0fb863aaccb3d7e4db41d19aea
2017-08-14 17:08:03 -04:00
Jarrod Johnson
e8f368d648 Implement state feedback on firmware update
Provide a means to indicate through string return to show user
what the next step should be.

Change-Id: Id6b9c2bb6e6a46d6eb653622294ae93e858b8356
2017-08-14 13:34:56 -04:00
Jarrod Johnson
d5fddf022b Set referer in IMM web
IMM web has now started rejecting http without referer.  Provide
a reasonable referer for that situation.

Change-Id: Id6d537252646122005a78a92c8a0122f28d379ae
2017-08-11 14:34:44 -04:00
Jarrod Johnson
1a60269df7 Implement SMM data extension
Do the SMM specific commands to get the serial number and model
number.

Change-Id: Iddc84c386996a2f93974e65980ed6f928105d87f
2017-08-09 13:31:19 -04:00
Jarrod Johnson
c341814267 Implement firmware update for ThinkSystem SMM
Provide similar support for ThinkSystem SMM as the XCC
devices.

Change-Id: I9173ef1c509b2965469ee610cca58590fe42cb69
2017-08-07 09:42:28 -04:00
Jarrod Johnson
a8e523cc11 Gracefully disable localsession without fcntl
Windows does not have fcntl, but can work out of
band.  Allow out of band on Windows to work even
though localsession cannot.

Change-Id: Ia3c188b33582f2c62bef6cb1f9576ccec314506d
2017-08-03 10:03:00 -04:00
Jarrod Johnson
f454c086ff Replace IPv4 inet_p functions with inet_a
On windows especially, inet_p functions are rare in python.  For AF_INET, inet_a functions
do the same thing and are more easily found.

Change-Id: I26f6e1015e9e82aad9b3c05ab7a45af6d11555cb
2017-08-02 17:00:24 -04:00
Jarrod Johnson
56e3eb5cb7 Replace waitall mechanism with never wait
Previously waitall was used as a way to have wait_for_rsp be able to
call out for specifically keepalive, to prevent a wait_for_rsp from
hanging.  The thought was to create a new wait_for_rsp by recursing.
However, if things go really bad with enough systems, it runs afoul of
python's recursion limit.  The alternative strategy is to provide a way
to never wait, and asynchronously do cleanup in a callback.  This
returns to the original wait_for_rsp instance rather than recursing
to a new one, keeping the stack shallow.

Change-Id: I54450bfc5bf57563a0a8bd986d9aea887bf36e53
2017-08-02 15:32:12 -04:00
Jarrod Johnson
19ae81f1dc Request a small MSS in web connection explicitly
Sometimes equipment will not handle some header data, such as 802.1q tag.  Other times,
there's a jumbo NIC talking to a BMC that is not jumbo.

Workaround such situations by setting the MSS to 1456 explicitly, which fits in MTU 1500 plus
4 bytes for dot1q tag, if some intermediat device fails to handle that.

Change-Id: I7db1c8feac1c094871723026771792432a3daaf4
2017-08-01 15:04:17 -04:00
Jarrod Johnson
2d517cf113 Provide support for event only SDR
Sensor numbers can have a lookup table in SDR without being a sensor.
Support these for eventlog decode, without adding noise to the sensor
enumeration.

Change-Id: If635512616da1a98ab7ca9d2352aea55ea2da5e3
2017-08-01 10:45:27 -04:00
Jarrod Johnson
d494390945 Localize console lock
The console code was using a global lock, but the data protected
is per instance.  Change to using a local version.  I couldn't figure out
a generic way for the decorator approach to dereference 'self'
without creating a specific requirement on the class name, so
I changed to using it as a context manager directly for now.

Change-Id: I304b75572fecd3326723d981fec67207d87d0742
2017-07-31 09:17:09 -04:00
Jarrod Johnson
faec94834a Provide more specific info on update process
The update process has a number of common errors and a lengthy
validation phase, provide more detail on the process.

Change-Id: I814d512814c132e95bb018cd622cff3c2efdf2c2
2017-07-27 08:57:08 -04:00
Jarrod Johnson
3adae44c07 Reduce memory usage for uploading
A per instance copy of data was kept in scope throughout download
process.  Minimize that to once regardless of instances, and have
lifetime of the extra copy be very short.

Change-Id: Ife3c7f83bf9b97925cf079597f014db648b227ba
2017-07-26 14:30:20 -04:00
Jarrod Johnson
fcdfdd763c Fix concurrent firmware updates
If another instance deletes the form, it's ok.  Ignore
the exception and continue on.

Change-Id: I3c92e5c657d6b16daa70f26dd450e3b9c6e55a11
2017-07-26 13:01:18 -04:00
Jarrod Johnson
6b3694f01a Make XCC update process more robust
The stray progress call and/or unexpected token expiry resulted
in failures.  Consistently logout on completion or abortion of process
as well.

Change-Id: I862036962cc83e31b2f426a9c7572325da173586
2017-07-26 09:50:17 -04:00
Jarrod Johnson
2ec9260110 Fix support for absolute pathname
The library was failing to work when the basename
matched, but full path did not.

Change-Id: I92c06be3dbb1166de6d4e53daef6e67345be1e66
2017-07-25 16:53:40 -04:00
Jarrod Johnson
6b4cf30a98 Support XCC variations for inventory
XCC is structurally the same, but vocabulary changed.
Adjust by abstracting vocabulary at the class level.

Change-Id: I7352f089683bbabdb87d86d87a7f399cd8241fc4
2017-07-25 09:55:29 -04:00
Jenkins
316f4bf26c Merge "Apply firmware update through XCC" 2017-07-24 20:49:15 +00:00
Jarrod Johnson
05754f9977 Apply firmware update through XCC
Automate from API the process of applying a firmware update to
XCC.

Change-Id: If32044431380b90ac47e1b3642fb5013da199f70
2017-07-24 15:27:50 -04:00
Jarrod Johnson
01ad6710c4 Correct a typo in dictionary name
At some point, bmc_handlers was mispelled, affecting graceful handling of
detecting a broken port.  Correct the mispelling.

Change-Id: I80e86b9d98fb211a3f1195658b93eaa5a2e88c61
2017-07-20 11:14:37 -04:00
Jarrod Johnson
52f5224ca1 Correct the offset to adjust for IPMIv2
For IPMIv2 sessionless data, there is not 13 bytes
to strip out, but instead only 2.  I suspect because
reading the sample packet, the last row unique values
were added without looking at the context.  Correcting
for context, the IPMIv2 header is only two bytes longer.

Change-Id: I9b99417c39f519dfa68b59a90a3ef7ca0232e97e
1.0.22
2017-07-14 16:43:26 -04:00
Jarrod Johnson
45a8facadd Allow things like multiple distinct users
A new set of credentials would break existing sessions.
Support concurrent use of multiple users/passwords, since
there are valid use cases.

Change-Id: Ic63364f05ec9270e06656d13bbb02d7c88fd21d4
2017-07-14 08:44:52 -04:00
Jenkins
b423b68233 Merge "Improve (de)activate payload in virshbmc" 2017-07-12 14:39:01 +00:00
Akira Yoshiyama
4999068c3e Improve (de)activate payload in virshbmc
This patch adds LibvirtBMC.check_console() to manage a
libvirt event-monitoring thread properly.

Change-Id: Ie365db150a74cf987cfb9d2a6fea2ffc26e4c606
2017-07-12 17:24:49 +09:00
Akira Yoshiyama
a49bb1da9d Protect Session.*_sessions operations
Multi-thread application like virshbmc can break
Session.keepalive_sessions and Session.waiting_sessions
with their concurrent operations.
This patch adds exclusive locks to avoid the problem.

Change-Id: I191ed066f02fd329da5a210e2383fa72481916ef
2017-07-12 11:57:56 +09:00
Akira Yoshiyama
80db136674 Protect Console.pendingoutput operations
Multi-thread application like virshbmc can break
Console.pendingoutput with its concurrent operations.
This patch adds an exclusive lock to avoid the problem.

Change-Id: I776c2a09069e4af129c865acc1bf47ba021b4e39
2017-07-12 11:42:25 +09:00
Akira Yoshiyama
3e6ca2dcb1 Implement util.protect() lock manager
protect() handles exclusive locks. It can be used as a context
manager and as a decorator. Multi-thread applications like virshbmc
require exclusive locks to protect list operations and references.

Usage:

   import threading
   from pyghmi.ipmi.private import util

   LOCK = threading.Lock()

   @util.protect(LOCK)
   def foo():
       ...

or

   def foo():
       with util.protect(LOCK):
           ...

Change-Id: I96eb1fac17a519b4e864731f4fa0285ccc2edb08
2017-07-12 10:59:59 +09:00
Akira Yoshiyama
756ebdbffb Implement Serial-over-LAN (SOL) in BMC
This patch adds a BMC-side SOL-related class and methods:

  console.ServerConsole:
    Sub-class of console.Console for BMC

  bmc.Bmc.is_active():
    returns whether the BMC is active

  bmc.Bmc.activate_payload():
    activates SOL session

  bmc.Bmc.deactive_payload():
    deactivates SOL session

See bin/fakebmc and bin/virshbmc for examples.

Change-Id: I0e649ee0e2b45824a34c9634b00fd4f94c46c8de
2017-07-11 13:15:01 +09:00
lijingxin
d363fb3821 Pyghmi does not follow the pep8 standard
Pep8 check is necessory for our code, it also makes your
code easy to readable and understandable and beautiful.

Change-Id: I4bb8434db07bf8fe82a4f65dfdfe7f2114b00083
Closes-Bug: #1699298
2017-06-23 08:37:20 +08:00
Jenkins
616fbe8276 Merge "Implement support for ThinkSystem servers" 1.0.20 2017-06-20 18:52:17 +00:00
Jarrod Johnson
d1f48b02c0 Implement support for ThinkSystem servers
Change-Id: Ic45943c4b882bb13390722cca58b8b1785386e86
2017-06-20 13:30:32 -04:00
Jarrod Johnson
d489b151fb Do not reuse an expired session
If a caller does not do a keepalive, but instead
creates new Command objects or similar, accomodate
by ditching the session that was not kept alive
rather than trying to use it.

Change-Id: I94fba08e3b2c03862b053c11aa3ee6b810db6f21
2017-05-16 13:59:44 -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