26 Commits

Author SHA1 Message Date
Jim Rollenhagen
082cf29cec Force heartbeat immediately after async command completes
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
2014-10-13 11:09:09 -07:00
Jim Rollenhagen
4f57590b2e Use poll instead of threading.Event in heartbeat thread
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
2014-10-13 10:50:08 -07:00
Jim Rollenhagen
de2b004654 Delete unused method get_agent_mac_address()
Does what it says.

Change-Id: I01e20e3a1e7317c17da6fc04ee0b0a672cf8247b
2014-09-22 14:32:27 +00:00
Jim Rollenhagen
69884b669d Add docstrings for agent.py
Does what it says.

Partial-Bug: 1367915

Change-Id: If2617f30c75c4a844c20a60afa41330daf84053a
2014-09-11 16:50:33 -07:00
Jim Rollenhagen
a9f2179761 Fix exception that is not properly raised
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
2014-09-10 14:53:37 -07:00
Ellen Hui
b4f1a0b2d3 Tries to advertise valid default IP
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
2014-06-10 20:54:34 +00:00
Vladimir Kozhukalov
b306626e86 Flow extension uses extension manager from agent
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
2014-06-02 15:21:38 +04:00
Jenkins
d69bd2b054 Merge "Make encoding.serialize() more programmatical" 2014-05-29 21:58:50 +00:00
Russell Haering
cad3588071 Don't begin heartbeating until the API server is listening
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
2014-05-20 14:45:39 -07:00
Alexander Gordeev
ed4460990e Make encoding.serialize() more programmatical
Introduce `serializable_fields` to express which class attributes
to be serialized.

Get rid of OrderedDict. Just replacing it with regular dict.

Change-Id: I3f7639dab171d3d62e92d0d1bb6d7b071cf963ad
2014-05-06 18:02:45 +04:00
Russell Haering
5ebd2e9797 Organize agent extensions
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
2014-04-14 15:09:12 -07:00
Jim Rollenhagen
46e9776d42 Use configurable driver name in lookup URL
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
2014-04-14 11:32:16 -07:00
Jenkins
952ade37f6 Merge "Kill the build_agent function" 2014-04-14 18:12:45 +00:00
Russell Haering
8422118fa4 Kill the build_agent function
This used to actually do things, now it just wraps the constructor.
Lets kill it.

Change-Id: I320684f8f52d032a1755460eacc70f5aeee92d7a
2014-04-14 10:12:31 -07:00
Alexander Gordeev
5bc793bcb0 Resolve circular import, introduce ExecuteCommandMixin
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
2014-04-14 16:04:28 +04:00
Jim Rollenhagen
3c1d52cbb1 Use # instead of """ for copyright blocks
Reformats copyright messages to be comments rather than
docstring-style blocks.

Change-Id: I4d863f53b67bb49d03bda0952b9e6179b6d23c59
2014-04-10 07:14:06 -07:00
Jenkins
7554b78d76 Merge "Move split_command to utils" 2014-04-07 23:35:36 +00:00
Jay Faulkner
c121bef9f0 Compatibility fixes for Python 3.3
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
2014-04-07 11:39:23 -07:00
Alexander Gordeev
9171ce659d Move split_command to utils
This patch moves _split_command from IronicPythoAgent class to
utils module. Also fixes import looping.

Change-Id: Ibf2b0b3885286b9ad78db64cf9e195de4ad627ad
2014-04-07 17:58:02 +04:00
Josh Gachnang
3bc4866a21 Adding DynamicLoopingCall around lookup
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
2014-03-31 14:54:14 -07:00
Alexander Gordeev
aee1555156 Get rid of modes. Introduce pluggable extensions
Allow multiple extensions to be loaded by switching to ExtensionManager
from stevedore. Remove any reference to modes.

Change-Id: Ic160478625226b4dd17bd68b3d37f3b05823e519
2014-03-27 17:28:57 +04:00
Josh Gachnang
234d209729 Removing commented out code 2014-03-20 15:51:54 -07:00
Josh Gachnang
6dc09f3148 Getting the heartbeat from Ironic instead 2014-03-20 15:18:48 -07:00
Josh Gachnang
fc043dd1d3 Fixing import order 2014-03-19 17:06:34 -07:00
Josh Gachnang
5914e36b30 Replacing teeth/overlord with ipa/ironic 2014-03-19 16:19:52 -07:00
Josh Gachnang
b30d345c2e Renaming to IPA 2014-03-19 15:50:43 -07:00