summaryrefslogtreecommitdiff
path: root/ironic_python_agent/agent.py
Commit message (Collapse)AuthorAgeFilesLines
...
* | Use new agent API if availableDmitry Tantsur2016-08-051-1/+3
|/ | | | | | | | | | | Falls back to vendor passthru on receiving 404. Also fixes logging around lookup: log traceback on unexpected exceptions, log successful lookup and replace % with , Change-Id: I7160c99ca63585fc333482fa578fdf5e0962b2b6 Depends-On: I9080c07b03103cd7a323e2fc01be821733b07eea Partial-Bug: #1570841
* Wait for at least one interface before node lookupvmud2132016-06-141-0/+26
| | | | | | | | | | | During node look up sometimes IPA sends hardware inventory information before the interfaces are up, resulting in empty interfaces information being sent to the conductor. This causes conductor to throw exceptions and polluting the log until the real interfaces information is populated. This change makes IPA to wait for at least one interface to be up before trying for node lookup. Change-Id: Ifdb91298eaa5c725f108fa722263ed925691ecda Closes-Bug: #1562786
* Merge "Get root device hints from the node object"Jenkins2016-05-301-0/+1
|\
| * Get root device hints from the node objectLucas Alvares Gomes2016-05-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to support a more complex syntax for root device hints (e.g operators: greater than, less than, in, etc...) we need to stop relying on the kernel command line for passing the root device hints. This patch changes this approach by getting the root device hints from a cached node object that was set in the hardware module. Two new functions: "cache_node" and "get_cached_node" were added to the hardware module. The idea is to facilitate the access to a node object representation from the hardware extension methods without changing method signatures, which would break compatibility with out-of-tree hardware managers. Note that the new "get_cached_node" is just a guard function to facilitate the tests for the code. The function parse_root_device_hints() and its tests were removed since it's not used/needed anymore. Partial-Bug: #1561137 Change-Id: I830fe7da1a59b46e348213b6f451c2ee55f6008c
* | Add a configurable sleep before IPA starts workingDmitry Tantsur2016-05-241-1/+9
|/ | | | | | | | | | | | | | | | | Some kernel modules take substantial time to initialize. For example, with mpt2sas RAID driver inspection and deployment randomly fail due to IPA starting before the driver finishes initialization. As much as I hate it, the only way to guarantee that the hardware is truely initalized is to wait for it. Apparently all hardware in Linux is treated as hotplugged, so there is no such thing as "hardware initialization is finished". Operators can add a sleep based on their knowledge of their hardware. The default behaviour remains the same. Change-Id: I0446ae81d760dacaf31eea6ad9f9eaa098cf5e93 Partial-Bug: #1582797
* Revert "Add hardware manager interface for hardware initialization"Jay Faulkner2016-05-231-2/+0
| | | | | | | | | | | | | | I would've voted -1 on the patch in question had I reviewed it, and per standard OpenStack/Ironic procedure, I'm reverting it for re-review and discussion. In this case; I don't think the new method in the HWM interface is needed, and that evaluate_hardware_support() is intended to handle the cases handled. This reverts commit 0962cae1da69a1a2981d5950ad741d91115dac06. Change-Id: Ic08e44bdf116403444b257ee9f4e5b906f5eac53
* Add hardware manager interface for hardware initializationDmitry Tantsur2016-05-201-0/+2
| | | | | | | | | | | | | | | | | Some kernel modules take substantial time to initialize. For example, with mpt2sas RAID driver inspection and deployment randomly fail due to IPA starting before the driver finishes initialization. Add a new hardware manager method initialize_hardware, which gets run on start up before other hardware manager method invocations. The generic implementation is to call udev settle and wait for at least one suitable disk device to appear with the hardcoded timeout of 15 seconds. Also preload the IPMI modules instead of calling modprobe every time the inventory is requested. Change-Id: If7758bb6e3faac7d05451baa3a26adb8ab9953d5 Partial-Bug: #1582797
* Bind to interface routable to the ironic host, not a random oneDmitry Tantsur2016-03-211-39/+44
| | | | | | | | | | | | | | Binding to the first interface that has an IP address is error-prone: there is no guarantee that ironic can reach us via this inteface. It is much safer to detect the interface facing ironic and bind to it. Unused LookupAgentInterfaceError exception is deleted. The TinyIPA build also requires iptables dependency at build time to insert the required kernel modules. Closes-Bug: #1558956 Change-Id: I9586805e6c7f52a50834bc03efeb72d1faa6cb65
* Change to use WARNING level for heartbeat conflict errorsZhenguo Niu2016-03-061-0/+4
| | | | | | | | | It's normal that ironic returns 409 Conflict from time to time, so it's a bit confusing that we report this with Exception level and traceback. Change-Id: I1627c61facc3fadd0f5d9d324150e7d2833c7fbc Closes-Bug: #1533113
* Replace all the 'self.log' calls with global LOGZhenguo Niu2016-02-241-8/+9
| | | | Change-Id: Iae917e1139c8c95a1bad5466df8a607656b9de5c
* Enforce all flake8 rules except E129John L. Villalovos2015-10-021-2/+2
| | | | | | | | | Bring ironic-python-agent in line with the other ironic projects. Stop ignoring all E12* errors except E129 Stop ignoring E711 Change-Id: Icb9bc198473d1b5e807c20869eb2af7f4d7ac360
* Add support for inspection using ironic-inspectorDmitry Tantsur2015-09-071-1/+7
| | | | | | | | | | | | | Adds a new module ironic_python_agent.inspector and new entry point for extensions, which will allow vendor-specific inspection. Inspection is run on service start up just before the lookup. Due to this early start, and due to the fact we don't even know MAC address of nodes on inspection (to say nothing about IP addresses), exception handling is a bit different from other agent features: we try hard not to error out until we send at least something to inspector. Change-Id: I00932463d41819fd0a050782e2c88eddf6fc08c6
* Load Hardware Managers at runtimeJay Faulkner2015-08-281-0/+4
| | | | | | | | | | | Hardware managers should load at runtime. This will ensure the agent is ready to respond to API calls before it begins heartbeating. Also, it means in case of a syntax or other error in a HardwareManager, the agent will crash before it heartbeats, which is better than it working until a hardware manager method is needed. Change-Id: I9403ce7bedc8d5af20b6d84371367253b26b74c2 Closes-bug: 1490008
* Use oslo_log libGhe Rivero2015-03-241-1/+1
| | | | | | | Module 'log' from oslo-incubator was removed after release of oslo_log library. Change-Id: Ia00e26071fc0cab4fd3f3334ca94860bc7b1c75c
* Allow use of multiple simultaneous HW managersJay Faulkner2015-01-081-5/+5
| | | | | | | | | | | | | Currently we pick the most specific manager and use it. Instead, call each method on each hardware manager in priority order, and consider the call successful if the method exists and doesn't throw IncompatibleHardwareMethodError. This is an API breaking change for anyone with out-of-tree HardwareManagers. Closes-bug: 1408469 Change-Id: I30c65c9259acd4f200cb554e7d688344b7486a58
* Add standalone mode for IPAJosh Gachnang2014-12-161-8/+13
| | | | | | | | This allows a developer to run IPA without an Ironic API. This can be useful for testing (especially functional testing) or testing integration of things like hardware managers. Change-Id: I2dc49fbe306430bf5b05a36fe56de5275fc128b2
* Force heartbeat immediately after async command completesJim Rollenhagen2014-10-131-0/+7
| | | | | | | | | | | This change passes the agent object into extensions, such that they may call agent methods as needed. It also causes async commands to force a heartbeat immediately after completing the command. This allows Ironic to get a heartbeat and continue work as quickly as possible, while also allowing deployers to configure Ironic (agent) to heartbeat less often. Change-Id: Ib3c3a43dfd0ed4ed51b7d52ac099f01181ca822f
* Use poll instead of threading.Event in heartbeat threadJim Rollenhagen2014-10-131-11/+29
| | | | | | | | | | | | poll() does not rely on absolute time. This fixes an issue where the system clock may be changed, and the heartbeat thread would stop heartbeating. This also gives us flexibility to force a heartbeat in a later change. Change-Id: Ifde7b53f59788addc43a5dac95c7b6519d87e834 Closes-Bug: 1355375
* Delete unused method get_agent_mac_address()Jim Rollenhagen2014-09-221-7/+0
| | | | | | Does what it says. Change-Id: I01e20e3a1e7317c17da6fc04ee0b0a672cf8247b
* Add docstrings for agent.pyJim Rollenhagen2014-09-111-3/+59
| | | | | | | | Does what it says. Partial-Bug: 1367915 Change-Id: If2617f30c75c4a844c20a60afa41330daf84053a
* Fix exception that is not properly raisedJim Rollenhagen2014-09-101-2/+2
| | | | | | | | | | | This commit fixes an exception that was not properly raised, and also makes the exception more relevant. This also fixes an outstanding bug where, if the agent was not associated with a node, get_node_uuid() would fail in an unexpected manner. Change-Id: Ifca474a73dd50b5fd2242e5b7e938a5db04f27a8
* Tries to advertise valid default IPEllen Hui2014-06-101-0/+44
| | | | | | | | | | | During the first heartbeat, the heartbeater asks the agent to check its advertised address; if the advertised IP is still the default (None), the agent tries to replace it with the IP of the first network interface it finds. If it fails to find either a network interface or an IP address, the agent raises an exception. Change-Id: I6d435d39e99ed0ff5c8b4883b6aa0b356f6cb4ae Closes-Bug: #1309110
* Flow extension uses extension manager from agentVladimir Kozhukalov2014-06-021-7/+5
| | | | | | | | | | Removed creating separate extension manager for flow extension. Instead, have made flow extension using the same extension manager instance which is initialized in agent. It fixes circular extension loading in stevedore. Closes-Bug: #1316145 Change-Id: Id339f1876168a41ca43ba7473f3ff6949a233ef3
* Merge "Make encoding.serialize() more programmatical"Jenkins2014-05-291-8/+2
|\
| * Make encoding.serialize() more programmaticalAlexander Gordeev2014-05-061-8/+2
| | | | | | | | | | | | | | | | | | Introduce `serializable_fields` to express which class attributes to be serialized. Get rid of OrderedDict. Just replacing it with regular dict. Change-Id: I3f7639dab171d3d62e92d0d1bb6d7b071cf963ad
* | Don't begin heartbeating until the API server is listeningRussell Haering2014-05-201-1/+4
|/ | | | | | | | As soon as the agent sends its first heartbeat, it may begin receiving API calls. As such, we should wait until the server is actually listening before starting the heartbeater. Change-Id: Id2984f3f0f50cdb725b10913d38b990f99c48b0a
* Organize agent extensionsRussell Haering2014-04-141-1/+1
| | | | | | | | Move extensions under an ironic_python_agent.extensions module. This change also moves the @async_command() decorator into the base extension module. Change-Id: I4021fcc33a30f3460a31bca44a4bf776cd53d488
* Use configurable driver name in lookup URLJim Rollenhagen2014-04-141-3/+6
| | | | | | | | | Allow configuration via command line arguments or kernel parameters. Default to agent_ipmitool, the reference driver. Depends on https://review.openstack.org/#/c/84795/12 Change-Id: I55c4a8713308d038002a6567471cd862bf89ec76
* Merge "Kill the build_agent function"Jenkins2014-04-141-15/+0
|\
| * Kill the build_agent functionRussell Haering2014-04-141-15/+0
| | | | | | | | | | | | | | This used to actually do things, now it just wraps the constructor. Lets kill it. Change-Id: I320684f8f52d032a1755460eacc70f5aeee92d7a
* | Resolve circular import, introduce ExecuteCommandMixinAlexander Gordeev2014-04-141-40/+8
|/ | | | | | | | | | | | Adding new methods to utils won't work as the circular import appears between errors.py and utils.py. Introduce ExecuteCommandMixin and use it for IronicPythonAgent and FlowExtension (in future patch). Also add tests for its. Change-Id: Id95b31349292a7967d2ee66ec82c1662d8e5de94
* Use # instead of """ for copyright blocksJim Rollenhagen2014-04-101-15/+13
| | | | | | | Reformats copyright messages to be comments rather than docstring-style blocks. Change-Id: I4d863f53b67bb49d03bda0952b9e6179b6d23c59
* Merge "Move split_command to utils"Jenkins2014-04-071-9/+1
|\
| * Move split_command to utilsAlexander Gordeev2014-04-071-9/+1
| | | | | | | | | | | | | | This patch moves _split_command from IronicPythoAgent class to utils module. Also fixes import looping. Change-Id: Ibf2b0b3885286b9ad78db64cf9e195de4ad627ad
* | Compatibility fixes for Python 3.3Jay Faulkner2014-04-071-3/+4
|/ | | | | | | | | | | | | 1) Added a py33 environment to tox 2) Updated tests to mock the correctly named builtins.open based on python version 3) Other minor compatibility fixes Tests for Python 3.3 will not pass due to this bug: https://github.com/eventlet/eventlet/issues/83 among possibly others in eventlet. Change-Id: Ie4b512a926fa690ee77a71a89851c871ea1f6be0
* Adding DynamicLoopingCall around lookupJosh Gachnang2014-03-311-8/+17
| | | | | | | | | Currently, if a single lookup call to the Ironic API fails, the entire agent errors out and restarts. This allows the agent to retry for a set amount of time before throwing an uncaught exception forcing a restart. Change-Id: I39752fb3f42ad3e4f15a49194f1554e1d3463cf8 Closes-Bug: 1297019
* Get rid of modes. Introduce pluggable extensionsAlexander Gordeev2014-03-271-38/+15
| | | | | | | Allow multiple extensions to be loaded by switching to ExtensionManager from stevedore. Remove any reference to modes. Change-Id: Ic160478625226b4dd17bd68b3d37f3b05823e519
* Removing commented out codeJosh Gachnang2014-03-201-1/+0
|
* Getting the heartbeat from Ironic insteadJosh Gachnang2014-03-201-9/+11
|
* Fixing import orderJosh Gachnang2014-03-191-4/+4
|
* Replacing teeth/overlord with ipa/ironicJosh Gachnang2014-03-191-23/+24
|
* Renaming to IPAJosh Gachnang2014-03-191-0/+251