summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* Filter results of GetSubTreeMatt Spinler2018-09-281-9/+37
| | | | | | | | | | | GetSubTree should only return service names and their interfaces for services that implement the interfaces passed into the function. The previous code would return every service/interface list if any service implemented the specified interfaces. Change-Id: I351af0aedd553e45125bffe2dd72aa352ec8d403 Signed-off-by: Matt Spinler <spinler@us.ibm.com>
* Add service and interface whitelist/blacklistsMatt Spinler2018-09-284-6/+182
| | | | | | | | | | | | | This allows service whitelists and blacklists, and interface whitelists to be passed into the application. The whitelists can be prefixes, like xyz.openbmc_project. The blacklist is the full service name. A future commit can add support for interface blacklists. Change-Id: I91f6ef2f7be63e4d13ac03d570bba18ef8277fae Signed-off-by: Matt Spinler <spinler@us.ibm.com>
* Implement Mapper in C++/sdbusplus/asioEd Tanous2018-09-285-4/+849
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit attempts to reimplement the mapper using C++/sdbusplus in the hopes of improving performance both at startup (lower priority) and runtime (higher priority). After this patch, performance seems to be greatly improved. On an unloaded system, full introspection of all daemons clocks in at 2.23 seconds for the worst case. Prelimiary tests show this to be 7X faster than the existing client. Expect this to come down slightly once associations are implemented, as that will introduce some overhead. It should not yet be considered complete although it does function. The things that still need doing are: 1. Implement the configurable whitelist/blacklist that the existing manage implements. Today they are compiled in. Tested By: time busctl call xyz.openbmc_project.ObjectMapper /xyz/openbmc_project/object_mapper xyz.openbmc_project.ObjectMapper GetSubTree sias "/" 0 1 xyz.openbmc_project.State.Chassis a{sa{sas}} 1 "/xyz/openbmc_project/state/chassis0" 1 "xyz.openbmc_project.State.Chassis" 2 "org.freedesktop.DBus.ObjectManager" "xyz.openbmc_project.State.Chassis" C++ implementation real 0m0.092s user 0m0.040s sys 0m0.010s Python implementation real 0m0.416s user 0m0.010s sys 0m0.030s Also has been tested using reboots, daemon dropouts and reconnects. Change-Id: I46ca8c273df09261cb2a2448a3570a601ea8e9f4 Signed-off-by: Ed Tanous <ed.tanous@intel.com> Signed-off-by: James Feist <james.feist@linux.intel.com> Signed-off-by: Matt Spinler <spinler@us.ibm.com>
* clang-format updatesMatt Spinler2018-09-1910-141/+163
| | | | | | | | Pick up latest clang-format from the docs repo and rerun with clang-format-6.0 Change-Id: I2f0411bb01d78f096563d63b197ce12daf43bcbd Signed-off-by: Matt Spinler <spinler@us.ibm.com>
* Remove dead MapperBusyExceptionBrad Bishop2018-06-271-8/+0
| | | | | | | | This exception class was not removed when its usage disappeared in d43087f294949583507b5520c8f0b2c359296aa1. Change-Id: I937f78ac37018ad59e8cb5fc65819497126f02d9 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* libmapper: Retry when receiving ENOBUFSWilliam A. Kennington III2018-06-261-7/+4
| | | | | | | | | | | The dbus daemon can return ENOBUFS if a server has too many outstanding requests that have not yet been serviced. We've noticed during boot that the load on the mapper is great enough that we will hit this dbus limit. Since this condition eventually improves, we want to retry just like with EBUSY. Change-Id: Ia21d87fba1793016e7c9dfa835fbe7bac0085f10 Signed-off-by: William A. Kennington III <wak@google.com>
* app: Drop mapper call subcommandBrad Bishop2018-06-251-68/+0
| | | | | | | | Equivalent function can be simulated with busctl call and mapper get-service _and_ doesn't rely on systemd patches. Change-Id: Ia0c3c8d7d0290de2b6e79f18df72cac97f2b14fa Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* libmapper: Retry with exponential backoffWilliam A. Kennington III2018-06-151-14/+15
| | | | | | | | | We don't want to keep retrying every 1 second for 5 tries. This would allow the timeout to lapse for a very busy BMC and just cause more congestion. Instead backoff at exponentially increasing intervals. Change-Id: I9780d9a3dc787a6936aca2c2af30418dd2b0bf4b Signed-off-by: William A. Kennington III <wak@google.com>
* libmapper: Actually examine read errorsWilliam A. Kennington III2018-06-151-3/+17
| | | | | | | | | | | | | | | Don't rely on undefined behavior in failed read calls where some of the message is read. Right now the subtree remove callback parses the message of type "as" into a 1 element array. It uses this to determine if the array is empty or not. This depends on the underlying implementation to populate one of the array elements in the case where it has more than one and produces an error. Instead, properly enter the array container and check to see if it is empty while doing error handling for the calls. Change-Id: I542c488524a5dce5466d6196879159d888e47346 Signed-off-by: William A. Kennington III <wak@google.com>
* Add MAINTAINERS fileAndrew Jeffery2018-06-051-0/+46
| | | | | Change-Id: I17831666541617209514efaa8b1fa512aa9831ca Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* Speed up enumerate_subtree()Matt Spinler2018-06-041-13/+15
| | | | | | | | | | | | | | | Searching a set is faster than searching a list, and changing this particular spot to a set cut the function's overall execution time by half when enumerating 200 /xyz/openbmc_project/logging objects, from ~15s down to about 6 (with system power off). Also removed the list() conversions that tend to be slow and aren't really needed for python3 anyway. Resolves openbmc/openbmc#3199 Change-Id: Id4534b7c3aee1017164f6d01e9028a8bcf0e9cd2 Signed-off-by: Matt Spinler <spinler@us.ibm.com>
* clang-format this repoEd Tanous2018-05-3010-897/+930
| | | | | | | | Use the proper-clang-format file on this repository as required by the openbmc documentation. Change-Id: I4f1e0d707388605f1e818dfdc647533a335e5f2d Signed-off-by: Ed Tanous <ed.tanous@intel.com>
* server: Only update_interfaces() if process_old_owner() finds an ownerAndrew Jeffery2018-05-151-3/+4
| | | | | | | | This avoids a large number of set operations that clearly work on empty sets, but serve no purpose in the circumstance. Change-Id: Idda0ddac2e2df5bef44a3ff3a5790f0ba9c5a47a Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* server: Rework filter_interfaces() for less lambdaAndrew Jeffery2018-05-151-15/+19
| | | | | | | | | | | | | | The pyflame flamegraphs were highlighting the lambdas as the performance bottleneck, so break them out procedural style to gain a better understanding of where the problem lies. Further, the functional style was almost impenetrable with respect to the procedural equivalent. When the function we're executing has full visibility of the transform pipeline the procedural style reduces the cognitive load (at least, for me) even if it is stateful in some sense. Change-Id: I444fcc6daedfc7f53932bc7acc950e4f60ab151f Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* server: Rework methods to avoid mutable default argumentsAndrew Jeffery2018-05-151-2/+7
| | | | | | | | | | | | | | | Mutable objects as default arguments in function or method declarations are only assigned once over the lifetime of the function declaration (i.e. are not assigned per function/method *invocation*). Rework such declarations to assign None (which is immutable), and test for None in the function/method body to assign a per-instance object. The side-effects of mutable default arguments are explored here: http://docs.python-guide.org/en/latest/writing/gotchas/#mutable-default-arguments Change-Id: Id963cdecba63f7072e621208e1a3173e1646ddf1 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* server: Stop making lists out of everythingAndrew Jeffery2018-05-151-59/+48
| | | | | | | | | | | | | | | | | | | | As a demonstration of the cost of this pattern: $ python -m timeit "for i in list(range(0, 1000000)): pass" 10 loops, best of 3: 31.4 msec per loop vs: $ python -m timeit "for i in range(0, 1000000): pass" 10 loops, best of 3: 23.5 msec per loop Avoiding the list represents a 33% improvement in execution speed. In a couple of cases this strategy is taken a bit further and generators are introduced to avoid explicitly creating lists. Change-Id: I28b3d90dd227f5a2661cd86c0941c54531ad5413 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* server: discovery: Apply interface filtering rulesBrad Bishop2018-04-031-1/+3
| | | | | | | | | | | We have interface rules but are not applying them on new daemon startup discovery. This results in unintended caching of blacklisted or unspecified interfaces. Resolves openbmc/openbmc#3052 Tested: Built palmetto image and booted BMC to obmc-standby target Change-Id: I57d01f925e51a10abdb55d39922c7f52d2286d91 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* README: Reword cleaning the repoGunnar Mills2018-03-301-1/+1
| | | | | | | Reworded cleaning the repo. The old wording did not make sense. Change-Id: I6aca7ad25dbb6704d27696e39891498d21ed5cd6 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
* Port to python 3CamVan Nguyen2018-03-123-20/+30
| | | | | | | | | | Port code to python 3 yet remain backward compatible to python 2. This port is in preparation for yocto 2.4 upgrade. Partially resolves openbmc/openbmc#2920 Change-Id: I0fb2642d6a8d1857ec1a4c4a5c8b962fd327641a Signed-off-by: CamVan Nguyen <ctnguyen@us.ibm.com>
* Perform one retry on any discovery failureAndrew Geissler2018-02-191-1/+10
| | | | | | | | | | | | | | | The discovery phase of mapper is very CPU intensive on the BMC. Situations have arisen, especially on BMC resets with the host up, where a timeout occurs when mapper is discovering an object on the dbus. The effects of mapper not discovering an object can have large impacts to the system. Testing: Validated in QEMU that the retry path was hit and the retry successfully discovered the object. Verified on a witherspoon that the retry path was hit and was successful. Change-Id: I9f05a635c27af744a9deb882deb748804d6ee660 Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
* server: Serve well-known bus namesBrad Bishop2018-01-311-19/+16
| | | | | | | | | | | | | | | | | | | Prior to this patch the mapper served unique connection names. Serve well-known names instead so clients can cache mapper lookup results. Tested: Manually verified mapper content and signals in the following workflows: - Service discovery - Interface added post discovery - Interface removed post discovery - Bus disconnect post discovery - Bus connect post discovery - Association added post discovery - Association removed post discovery - Association modified post discovery Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com> Change-Id: Ia697c86dc287b6e289ea6d84364b24ef9a2c18c8
* server: Add early escapes to simplify logicBrad Bishop2018-01-311-5/+5
| | | | | | | | | Add a couple early escapes to the bus_handler method. Tested: Manually verified mapper content is the same after service discovery. Change-Id: I9c0e08022176345797fd74809770ddfdfeffe904 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* server: drop bus check from get_signal_interfacesBrad Bishop2018-01-311-9/+11
| | | | | | | | | | | | | | | | No functional changes, but move bus name normalization from get_signal_interfaces to the call sites. This improves signal handler readability. Changed get_signal_interfaces to filter_signal_interfaces to more accurately describe what the method does. Fix-up call sites. Tested: Manually verified mapper content is the same after service discovery. Change-Id: I0467faa233a960245f8cc8bad14dd66b1b7fead6 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* server: refactor valid_signalBrad Bishop2018-01-311-5/+13
| | | | | | | | | | | | | | | Change the method name to bus_normalize to more accurately reflect what it does, which is normalize unique and well-known bus names to a well-known name. Provide the normalized name to callers. Fix-up call sites with the new name. Tested: Manually verified mapper content is the same for a test object after adding and removing interfaces from the test object, after new service discovery and after bus name owner loss. Change-Id: I4bc194b3d5537eadf3e6b0a874fe72caaf615372 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* server: Unmask association signalsBrad Bishop2018-01-311-0/+1
| | | | | | | | | | | | | | PropertiesChanged signals are masked by default by pyphosphor. When left masked, PropertiesChanged signals are not emitted by the mapper when it adds or removes endpoints from an association. Unmask signals when association objects are created so the signal is emitted. Tested: Manually verified PropertiesChanged signals are emitted on association endpoint updates with busctl. Change-Id: Ie222aa414554c416a0c7483ddbcdab1c81dac77e Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* utils: pycodestyle fixBrad Bishop2018-01-312-4/+8
| | | | | | | | Fix a bug flagged by pycodestyle. Change-Id: I4833b0c294df2f4b6690debdcd6fbb2e312fe70e Tested: No functional change, whitespace only. Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* Port obmc.mapper to python3.5Balaji B Rao2018-01-303-47/+44
| | | | | Change-Id: I472d92ddae72f004fb9d00103f160c9b108143fd Signed-off-by: Balaji B Rao <balajibapu@gmail.com>
* Ignore E731 in objmgrAdriana Kobylak2018-01-162-4/+5
| | | | | | | | | | | | | | | Ignore the error E731 "do not assign a lambda expression, use a def" in the mapper repository as it would require 3x the number of lines of code to create separate def functions and avoid syntax errors when running on the BMC. According to the python documentation under their Programming Recommendations, E731 is intended to aid debug, as the variable assigned to the lambda would just show as <lambda> in a traceback. Fixes openbmc/openbmc#2796 Change-Id: Id9248ec1f3d1a8c736749ba138d9c0e39d92e5ce Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
* Fix objmgr using pycodestyle (pep8) rulesAdriana Kobylak2018-01-103-7/+11
| | | | | | | | | | | | Create a setup.cfg file which is used by pycodestyle (formerly pep8) to override defaults. This file can be used by the build verification to check if a repo can have format-check run. Fix long lines, bare excepctions, and lambda error messages. Change-Id: If7f4590c098e04aad6b507c410934f433c739bc7 Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
* Revert "server: Serve well-known bus names"Andrew Geissler2018-01-021-7/+7
| | | | | | | | | This reverts commit 799e7bc959540d57dfaae67b5cd495ca4163fb0f. This commit caused a regression, see openbmc/openbmc#2751 Change-Id: Idcfa80ff6209a1fcf77f6ea29ffea6d312b16587 Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
* server: Log additional information for discoveryBrad Bishop2017-12-201-1/+9
| | | | | | | | | | | | | | discovery_error is called from both exception and normal execution contexts. In exception context print_exception prints the exception class and message. Print the exception class and message when invoked in normal context. Resolves: openbmc/openbmc#2718 Change-Id: Ia6ab9c9d663161028f47e17af2f73bfe801af399 Signed-off-by: Brad Bishop <bradleyb@@fuzziesquirrel.com>
* server: Print traceback to stderrBrad Bishop2017-12-201-1/+1
| | | | | | | | The discovery error callback erroneously prints a traceback to stdout. Change-Id: Iea936df0e811e38ae3bb5bd09c4892581be4a5f0 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* bindings.py: Use get_dbus_name to check for errorAdriana Kobylak2017-12-181-1/+1
| | | | | | | | | | | | Check the dbus name instead of message for error checking. The dbus message is the description of the error, like "Unknown interface 'foo'". The dbus name is the actual error string, like "org.freedesktop.DBus.Error.UnknownInterface", Resolves openbmc/openbmc#2463 Change-Id: I8721e7b262dbc8f4ebae9a8e30074bdf6a53b025 Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
* server: Serve well-known bus namesBrad Bishop2017-12-151-7/+7
| | | | | | | | | | | | | Prior to this patch the mapper served unique connection names. Serve well-known names instead so clients can cache mapper lookup results. Resolves openbmc/openbmc#1496 Resolves openbmc/openbmc#2670 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com> Signed-off-by: Nagaraju Goruganti <ngorugan@in.ibm.com> Change-Id: I214f8cc56b2d70a7d000faf2a44cf8444ccd2ae9
* server: Fix missing Association interfaceBrad Bishop2017-11-271-23/+4
| | | | | | | | | | | | | | | | | | | | | | | | Prior to this patch org.openbmc.Association is not included in the introspection result. This prevents clients using D-Bus language bindings that actually validate the interface prior to attempt to read a property. The custom org.freedesktop.Dbus.Properties implementation on the Association class used the wrong signature for the Get and GetAll methods, violating the D-Bus specification. Fix this by using the implementation in the pyphosphor dbus binding add-ons module. The association interface does not have any methods or signals. Without help, dbus-python won't find these interfaces when using the Introspect implementation from dbus-python. Use the new add_interfaces decorator in the pyphosphor dbus bindings to help dbus-python find it and include it in the introspection result. Change-Id: I21fcd651e762c727a8d442ab6075ac7fa7e552d2 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* server: Delegate association signal logicBrad Bishop2017-11-271-29/+16
| | | | | | | | | | | | Avoid emitting org.freedesktop.DBus.Properties.Properties changed signals on association objects prior to an org.freedesktop.DBus.ObjectManager.Interfaces removed signal. Do this by dropping the Association append, remove, and emit_signal methods and move their logic to the mapper. Change-Id: Ibff3d7e0eb47de3ea992394e2122d39407aaf64e Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* server: Remove Association.__getattr__Brad Bishop2017-11-271-12/+8
| | | | | | | | | | | | | | | Refactor the Association class in preparation for inheriting from obmc.dbuslib.DbusProperties. - Remove the __getattr__ override and its usage. It does not appear to be necessary. - Store endpoints in an interface/properties dictionary named properties in alignment with obmc.dbuslib.DbusProperties. - Refactor methods to use properties dictionary rather than the endpoints list. Change-Id: I4b8befa0d2e69a9f2266fa2818e0f81ae4cdcf56 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* server: Add docstringsBrad Bishop2017-11-271-0/+9
| | | | | | | Add docstrings for the Associations class. Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com> Change-Id: Ia8370d67c24818b229114b76f4e5c91c6254682c
* server: Performance improvementsBrad Bishop2017-11-271-8/+9
| | | | | | | | When processing associations reduce the number of object manager list searches from four to one. Change-Id: I39603ca3cf22fd3090ef90be89690cad78d9ac4b Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* server: Skip associations without an endpointBrad Bishop2017-11-271-0/+4
| | | | | | | | Improve application robustness by discarding associations property instances that leave the endpoint blank. Change-Id: I4c688add3ebf8532bf7d3784e15545c788ff26fd Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* server: Reduce PropertiesChanged wakeupsBrad Bishop2017-11-151-0/+1
| | | | | | | | | | | | | | The mapper subscribes to all PropertiesChanged signal events, and then discards them if the changed interface is not the associations interface. Add an arg0 filter on the signal subscription to drastically reduce the number of spurious wakeups. Resolves openbmc/openbmc#2573 Change-Id: I5e6659c90d292a3da06c5dda148d0caed8939ecc Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* server: Update copyright yearBrad Bishop2017-11-011-1/+1
| | | | | Change-Id: I1db71a2e0ba03b06cbb192d570e22481388036cd Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* Fix interface filter logic bug on GetSubTreePathsBrad Bishop2017-09-131-1/+1
| | | | | | | | | | | This doesn't appear to have ever worked or only in very select situations. When enumerating paths with a filter, handle path- only elements with no interface data. Resolves: openbmc/openbmc#2226 Change-Id: I50a8394c35d5f00f715b153bf6d0bb0b6f153bcf Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* bindings: Fix interface matching when searchingBrad Bishop2017-09-111-4/+3
| | | | | | | | | | | | | | | | Prior to this patch the default interface matching filter specified the org.openbmc and xyz.openbmc_project interface namespaces. This results in missing attributes in other namespaces. Change the default match algorithm to filter out org.freedesktop.DBus.ObjectManager interfaces only, so that by default the complete set of interfaces are considered. Resolves: openbmc/openbmc#2269 Change-Id: If895b7bbfa8794a36376042cbdbcf55c300abb50 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* Fix bug in mapper for associations KeyErrorGunnar Mills2017-09-072-2/+2
| | | | | | | | | | | | | In the active software image associations, the associations property is initially empty, associations are added as images become active. Remove the check for an empty associations property. This check was causing the 'associations' dict object to not be created, which was causing the KeyError. Resolves openbmc/openbmc#2263 Change-Id: Ibc11d92d7bb99d22fbb31ed7b6196165431cee55 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
* server: Ignore mapper generated signalsBrad Bishop2017-07-291-1/+3
| | | | | | | | | Correct a bug that prevented this. This was always the intent as the mapper does not rely on dbus to inform it of its own signal generating actions. Change-Id: I56af68ed65903ac105a6fb553010c389cf0ea679 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* server: Handle short lived bus name ownersBrad Bishop2017-07-291-2/+7
| | | | | | | | | A short lived process may claim a name and then exit before the mapper calls GetNameOwner on it. Add code to tolerate this. Change-Id: I2cf81713da4c83605c636d09087a18c651187aec Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* server: Improve discovery failure handlingBrad Bishop2017-07-291-1/+12
| | | | | | | | | Display the failing service and path. Display the traceback of the original error. Don't wait forever to claim a bus name after a failure. Change-Id: I2bf0f0ee29d4fe838eae215590fad7d4b2ef0c7c Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* server: Add command line optionsBrad Bishop2017-07-102-16/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | Add four non-optional command line options for the server: namespace Instruct the server what dbus path namespaces to watch. interface_namespace Instruct the server which interfaces to watch. blacklist Instruct the server to ignore specific paths. interface blacklist Instruct the server to ignore specific interfaces. Paths are checked before interfaces. If a path does not match the interface configuration does not matter. Paths are first checked against the blacklist and then allowed if the path contains the namespace or the namespace contains the path. Interfaces are slightly different; the blacklist is checked as with paths but then the interface is only allowed if it contains the namespace. Resolves: openbmc/openbmc#1767 Change-Id: Ib83d5163681fc49114e4c86be177d11b8528322f Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* Fill in phosphor-unit-failure-monitor main()Matt Spinler2017-06-264-0/+207
| | | | | | | | Obtain the command line arguments, construct the monitor class, and have it analyze the failure. Change-Id: I27015b7d485995ac7605f07622112f4b8d0aa621 Signed-off-by: Matt Spinler <spinler@us.ibm.com>
OpenPOWER on IntegriCloud