844 Commits

Author SHA1 Message Date
Alexander Gordeev
f090a3163b Fix unexpected stevedore traceback in tests
Fix tests/agent.py: make use of test stevedore manager to avoid loading of real extensions

Change-Id: I258e988e505d933b8359b62c0b65ebdb76dca8e5
2014-04-30 14:46:52 +00:00
Jim Rollenhagen
ea652bced0 Fix broken path to shell scripts
This was broken when extensions/ subdirectory was created.
Also add test to ensure this doesn't break again.

Change-Id: I12524a927397c3d2a90d00198873e2e1b4786171
2014-04-29 14:56:39 -07:00
Jim Rollenhagen
2e691d7971 Check configdrive size before writing to partition
Avoids writing a configdrive out to disk that is larger than
the intended partition.

Change-Id: I4e067ccb23ba528d96e4faad39219f67b4178e82
2014-04-25 13:42:47 -07:00
Jim Rollenhagen
c5e8670b23 Remove Heartbeat-Before check from heartbeat
Ironic does not send this header - agent should not look for it.

Change-Id: I7b8857fa5f744bc03ee0907424a95b9305811c51
2014-04-25 13:31:47 -07:00
Jenkins
07f1462bc2 Merge "Fix expected status code in Ironic heartbeat" 2014-04-24 22:41:52 +00:00
Jenkins
e64f110400 Merge "Revert "Fix expected status code in Ironic lookup"" 2014-04-24 22:40:42 +00:00
Jenkins
a480d6ece1 Merge "Accept new parameters for prepare_image" 2014-04-24 20:24:56 +00:00
Jim Rollenhagen
620f05eb33 Accept new parameters for prepare_image
The parameters sent to `prepare_image` changed in
https://review.openstack.org/#/c/86490/

This patch brings `prepare_image` up to date with that change.
It also changes the way configdrive is written to disk, to match
that Ironic is now allowing Nova to build an ISO partition and
send the raw image to the agent.

This patch also swaps out subprocess.call for processutils.execute
in the standby module, since the commands were being changed anyway.

Lastly, this patch changes the expected `hashes` dict to be a
string parameter called `checksum`, to match what glance returns.

Change-Id: Id8af9be920ba51e7e1ce60f4ffd1477e413582c9
2014-04-24 13:00:24 -07:00
Jim Rollenhagen
81c1ea4744 Fix expected status code in Ironic heartbeat
The agent previously checked for a 204, Ironic actually returns
a 202 for heartbeats.

Change-Id: I7ef45dd13dee3c40802aee3424afa3f67bf4a237
2014-04-24 11:05:18 -07:00
Jim Rollenhagen
98791c4547 Revert "Fix expected status code in Ironic lookup"
This reverts commit 7b8b06c71401b5ce13fc73ed13b0e49e648cba8b.

The wrong function was fixed - it was the heartbeat, not the lookup,
that was checking for the wrong status code.

Change-Id: I35f49ca4fa1295d266f68b72b6ecdd5184181bd5
2014-04-24 11:04:53 -07:00
Jim Rollenhagen
7b8b06c714 Fix expected status code in Ironic lookup
Ironic returns a 202 on successful lookup, the agent previously
expected a 200.

Change-Id: I180f411024a4bd82eff581037352c65d14b2d3a4
2014-04-24 08:26:23 -07:00
Chris Behrens
ab46681e33 Fix wait argument on POST
Its type was not declared. Adds tests for this.

Change-Id: Iba05ce38f7548cc8400ac78493ef16b5e69905bb
2014-04-21 00:05:54 -07:00
Jenkins
24c4382fed Merge "Deprecated extension name attribute" 2014-04-17 15:50:55 +00:00
Russell Haering
bf74673226 Decorated commands no longer take command_name
Prior to the (sync|async)_command decorators, extension methods had to
construct command results themselves, which required that they have
the name of the command being executed.

When the async_command decorator was introduced, we wanted to maintain
the current command interface, so that a command could be made
asynchronous simply by adding the decorator.

The introduction of the sync_command decorator allows us to satisfy
this objective, without requiring decorated methods to accept a
command_name. This patch modifies both decorators to no longer pass
the command_name argument, and modifies existing command methods not
to expect one.

Closes-Bug: #1308021
Change-Id: I1b33bb7519588cdcb79c6f4d2b10c1e5e8c0cca3
2014-04-15 10:25:12 -07:00
Vladimir Kozhukalov
9e153253e5 Deprecated extension name attribute
It seems not to be used, so it is not needed.

Change-Id: Ie46470d888ff11edaf16b94e5b2e716d13cf764f
Closes-Bug: #1308017
2014-04-15 15:56:09 +04:00
Russell Haering
dcd6e3e0dc Add a @sync_command() decorator
Instead of special-casing syncronous commands, add a decorator similar
to @async_command(), which can be used to decorate extension methods
for execution as a synchronous command.

Change-Id: I1b27f179f667cb065bcffd71ae0f303b05d33b82
2014-04-14 15:22:07 -07: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
Jenkins
304be37239 Merge "Use configurable driver name in lookup URL" 2014-04-14 18:48:49 +00: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
Alexander Gordeev
18aa51f1f1 Add FlowExtension
It makes possible of running data-driven flow which's the list of
the other existent extensions to be called.

Change-Id: Ib73ea4da92f291c872b7ae51e46ecc7fdd45ee16
2014-04-14 20:01:08 +04:00
Alexander Gordeev
bd19a03f92 Add self to validator method
This patchset allows access to extension class instance for more
advanced command validation.

Change-Id: I9d6df1ab44ab06ef2e663ad777ad3560d9ab7565
2014-04-14 19:25:19 +04: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
Jenkins
88f06e2831 Merge "Use # instead of """ for copyright blocks" 2014-04-11 23:47:09 +00:00
Jay Faulkner
1384d79d2c Implement version 2 payload with more hw info
Bumping the payload version to two, and adding CPU, Memory, and Block
Device information to the inventory.

Added dependency on psutil for available memory and cpu_count.
Requirements line copied from global requirements

Change-Id: Ia39c85c91b1d60468667787a7978020084dc6c2a
2014-04-10 17:37:54 -07:00
Jenkins
bbe50749fc Merge "Add BackOffLoopingCall with jitter" 2014-04-11 00:07:58 +00:00
Jay Faulkner
6e619f0261 Deprecate hardware._cmd in favor of utils.execute
This removes the custom function that was in place before our move to
Openstack in favor of the utils method integrated with oslo.

Change-Id: If668e53ccc97743b00c4beae39d153ee63ed015a
2014-04-10 14:26:57 -07:00
Jenkins
dd79f5acb5 Merge "Properly mock _cmd so blockdev does not run" 2014-04-10 19:47:47 +00:00
Jay Faulkner
1653c558ef Close file handle after use
The file handle for addr_info was left open, meaning we were leaking
file handles when sending system information. This ensures the handle is
closed.

Change-Id: I4b117d4f9ec32ad3f16f43632ffe9dc96da5ab7f
2014-04-10 11:06:58 -07:00
Jay Faulkner
b43261c815 Properly mock _cmd so blockdev does not run
blockdev --report was being run with the previous way this test was
mocked. This fix causes it to not be run.

Change-Id: I7ab5dcca0a3a89ef4c62a2f40981958de73cd6f1
2014-04-10 10:02:40 -07: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
Jim Rollenhagen
b826a72a7b Version node lookup payload
This payload may change over time and should be versioned.
Corresponds to https://review.openstack.org/#/c/85228/

Change-Id: I58b1d69a2c41ff105038178632e289cb4b12c971
2014-04-08 13:16:46 -07: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
Josh Gachnang
bd25174338 Add BackOffLoopingCall with jitter
Using DynamicLoopingCall involved a few hacks to make it work properly. This
new BackOffLoopingCall will start an exponential backoff (with a configurable
jitter) when there is a failure. The backoff will continue until the given
function returns True or timeout is about to be exceeded. The function will
run indefinitely until either an exception is raised or timeout is reached.
I plan to merge this into oslo loopingcall and switch the heartbeat to this.

Change-Id: I1482348e98c6b68c34b3003645029e08135b1341
2014-04-07 10:59:47 -07:00
Vladimir Kozhukalov
7736de66ca Added execute util
It is needed to run OS commands. It uses
oslo processutils. It is just a copy of the
same method in openstack/ironic except
using rootwrap was removed.

Change-Id: I2efede22b1fa25febe91879c0fefcdfc7f3d1dd5
2014-04-04 20:31:04 +04:00
Josh Gachnang
1a87ebfcce Adding oslotest to improve debugging
oslotest includes things like showing log messages/stdout on test errors,
which makes debugging much easier. Also moved mock to second group in imports,
as it's a 3rd party library.

Change-Id: I016ae0a376d42dec28085687ea7194df4cd44eda
2014-04-03 14:02:53 -07:00
Jim Rollenhagen
9cfa63d2d0 Add kernel parameter support
Allow the agent to read arguments from the kernel command line.
Priority is: agent command line, kernel command line, defaults.

Change-Id: Idfd43a8b7fdf6c368cf55d45b32cb7bcfbb56212
2014-04-01 06:23:24 -07: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
Jim Rollenhagen
6329ae46db Fix URL for node lookup
Change-Id: I5b128a74bf0442f61d722978308c03c6ec45f8d8
2014-03-27 12:35:16 -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
d8c0f1b794 Actual exception message, stylistic changes 2014-03-20 15:57:20 -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