497 Commits

Author SHA1 Message Date
Russell Haering
263f97c0e0 Expose decom.erase_hardware command via API
Expose an async decom.erase_hardware command in the API. Executing
this command simply calls erase_devices on the loaded HardwareManager
implementation.

Change-Id: I238264a4d5903200ad6a30d82b61804c1e3f5916
2014-06-08 18:01:10 -07:00
Russell Haering
dff46583d3 Add a HardwareManager method to erase devices
Add erase_devices method to the HardwareManager class. By default this
method iterates block devices, and calls a new abstract
erase_block_device method for each device. This patch includes a
simple implementation of erase_block_device on the
GenericHardwareManager which attempts to issue an ATA secure erase on
supported devices.

Change-Id: I81da065395b8785f636f1b0a0d60c9f1c045441e
2014-06-06 10:27:53 -07:00
Russell Haering
8fd76c877b Add missing methods to base HardwareManager class
The HardwareManager class was missing a few abstract method
declarations which it is expected to have. Add those.

Change-Id: I1d07b7f08a4fc23929bc09f65b897fdfa0da1770
2014-06-04 10:51:03 -07:00
Jenkins
e6d9aafddb Merge "Readme should point to Openstack, not travis-ci" 2014-06-04 07:57:31 +00:00
Jenkins
c6ac66e8fd Merge "Allow configdrive partition to be precreated" 2014-06-04 06:31:05 +00:00
Jay Faulkner
a7d6865883 Allow configdrive partition to be precreated
This adds support for copying configdrives to disks that already have
partitions enabled and labeled for configdrives. This is neccessary for
supporting configdrives on partitioning schemes we don't support yet
(like GPT) or for some future agent iteration where we create partitions
separately.

Change-Id: Iee5b87d82be08febc495aaef3272ced4f2f32235
2014-06-03 16:52:33 -07:00
Jay Faulkner
aad4923ed8 Readme should point to Openstack, not travis-ci
The readme, leftover from when this was teeth-agent, was still pointing
at the travis-ci build. I removed that build status and added a link to
Openstack How to Contribute wiki page, so people visiting the mirror on
Github know not to create pull requests.

Change-Id: I8a82eb0e04cc35425f7856b16568f191c4c54770
2014-06-03 12:59:38 -07: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
Jenkins
340a888689 Merge "Switch to oslo.config for CLI parsing" 2014-05-29 21:36:54 +00:00
Russell Haering
f69dd99a79 Switch to oslo.config for CLI parsing
Use oslo.config instead of argparse for CLI parsing. As a side effect,
a bunch of logging arguments including --debug become available with
this change.

Change-Id: Ia8c4e91448f2a8cb15eb570125ac9c236e13274c
2014-05-28 23:11:47 -07: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
Jenkins
59d6523a35 Merge "Remove Heartbeat-Before check from heartbeat" 2014-05-06 16:39:39 +00: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
Jenkins
8f5da42ef2 Merge "Fix unexpected stevedore traceback in tests" 2014-05-06 13:53:53 +00:00
Jay Faulkner
5ed7137871 Uninstall more buildtime only deps and clean lists
- Apt lists were not getting cleaned out, adding almost 100M of unneeded
  stuff to the final image.
- Also removed some unneeded post-build deps

Change-Id: I716aba65ae0e9153a64a359f431d6d8a6adfb4da
2014-05-05 11:09:01 -07:00
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
Jenkins
f95c8a9e6d Merge "Make docker image smaller by using Precise" 2014-04-29 00:26:40 +00:00
Jay Faulkner
89cbcbd0e3 Make docker image smaller by using Precise
Changing to precise means we don't have both python 3 and 2 installed in
the image, only python 2. Also do some cleanup at the end of the build
since we are exporting the final filesystem, and don't care about the
size of the intermediate layers.

Change-Id: Iac61d4a882aee19214de5dd74bbbaacc8b0f3414
2014-04-28 16:19:16 -07:00
Jenkins
fd6460c9a3 Merge "Check configdrive size before writing to partition" 2014-04-28 23:09:51 +00:00
Jay Faulkner
60a1309be2 Use systemd-nspawn instead of docker for image
Using systemd-nspawn gives us more flexibility in what hardware the
agent can see. With this setup, the network is not virtualized, and the
/dev inside the container looks nearly identical to the one in the host.

Also added RestartSec=30s to the unit file because without this, systemd
will respawn the agent every 100ms if it dies (say, because DHCP hasn't
completed yet). Since it retries a max of 5 times per 60s, unless the restart value is
set higher it will be marked 'failed' forever and not retry. Adding this prevents that.

Change-Id: Ic64ab4b0824595683e5428464512594dd90eed83
2014-04-25 14:28:49 -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
Jenkins
fb2f08a42d Merge "Uniquely identify builds to prevent race" 2014-04-24 19:29:15 +00: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
Jay Faulkner
40894614ac Uniquely identify builds to prevent race
In the original implementation of this, the latest running container
containing "PICKME" was selected for the container to export. This
creates a race condition.

Instead we now identify the image by a UUID created each run, so that
they will not overlap if multiple builds happen simultaneously.

Change-Id: Iaaf5683435f424517774067a1d95732ad096c988
2014-04-17 11:15:29 -07:00
Jay Faulkner
0436f1dbfe Better documentation and defaults for coreos image
The existing coreos image required 20G+ of RAM, which isn't reasonable.
Also there was no documentation about how to get the image running, so a
sample configuration with iPXE was added. These changes are required to
help folks who want to use the agent now.

Change-Id: I845bebf17c62653521282863d596ac512dd6b82e
2014-04-17 10:06:11 -07:00
Jay Faulkner
5af1fe64fd Use docker import/export to make image smaller
Using docker export gives us only the top filesystem layer and not all
the layers used to build. Resulting image is about 20% smaller. Further
optimizations will be made in future commits via removing build time
deps and temporary files in the Dockerfile.

Change-Id: I0f7ad6d00c6f47836dcd71b05907076701bb2789
(cherry picked from commit 99dba22eaa3961234abde1294e55026fd2cc9d4d)
2014-04-17 10:05:56 -07:00
Jenkins
24c4382fed Merge "Deprecated extension name attribute" 2014-04-17 15:50:55 +00:00
Jenkins
c5153d44ce Merge "Decorated commands no longer take command_name" 2014-04-15 17:51:39 +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
Jenkins
2ceb2f5886 Merge "Added metaclass statement" 2014-04-15 16:52:49 +00: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
Vladimir Kozhukalov
beb135f102 Added metaclass statement
Added metaclass statement in base
HardwareManager class. It is necessary
in order to make it really abstract.

Change-Id: I2fa68f8cb11920d85989ba3589b4a394f17d42ae
2014-04-15 12:32:55 +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
Jay Faulkner
2960f71c64 Minor fixes to image build
- Correct directory to match the relative path correctly
- Include additional requirements.txt for coreos image injector

Change-Id: Ie68f86220f2db786e3e97e72fed288b92704d028
2014-04-14 13:33:04 -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
Jenkins
00a299cc80 Merge "Add FlowExtension" 2014-04-14 18:17:57 +00: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