221 Commits

Author SHA1 Message Date
Jenkins
a417baf25c Merge "Fix get_os_install_device()" 2015-09-06 13:35:12 +00:00
Jenkins
8165e18949 Merge "Remove ordereddict as 2.6 is no longer supported" 2015-09-05 20:54:07 +00:00
Jenkins
91b96b3e87 Merge "Rename unit test file utils.py to test_utils.py" 2015-09-05 20:14:15 +00:00
John L. Villalovos
bc510fc51c Rename unit test file utils.py to test_utils.py
Convention for naming test files is test_*

Rename the utils.py to test_utils.py to match convention.

Change-Id: Idfbfa00dc47c6a60a0fb82b81b1bca0a8dfa345a
2015-09-04 10:29:50 -07:00
Jay Faulkner
ac040f5152 Add docstrings for cmd/agent and extensions/clean
Adding documentation for methods in these files that were missing
docstrings.

Change-Id: I2ad9f85605720ab2295dec3d0436ff0af07847c2
Partial-bug: 1367915
2015-09-03 16:15:54 -07:00
Jay Faulkner
d29b9af748 Remove ordereddict as 2.6 is no longer supported
ordereddict, and a related workaround method, were removed as we no
longer support python 2.6. Collections contains ordereddict on newer
python versions.

Change-Id: I48cc55a5c56fbc1f71442fc858eb4905f0213988
2015-09-03 13:15:55 -07:00
Jenkins
bc98593416 Merge "Three attempts message is incorrect" 2015-09-03 15:07:28 +00:00
Jenkins
36ce80175a Merge "Split functional and py27 tests" 2015-09-03 00:22:28 +00:00
Joshua Harlow
e9d2bfe580 Three attempts message is incorrect
The code that is covered in this exception block
does not actually retry three times, so it seems better
to have the message not reference that it does.

Change-Id: I0cc19aab65aa9ba4d73a8842390b712f7f63925c
2015-09-02 16:27:43 -07:00
Jenkins
87223a0f94 Merge "Refactor list_block_devices to its own function" 2015-09-02 22:17:44 +00:00
Pavlo Shchelokovskyy
19575d026a Fix get_os_install_device()
Instead of silently failing, raise DeviceNotFound when no root device
hints were provided and all found block devices are smaller than 4GB.

Change-Id: Idd2e2c5905adf847f00ad15a84a817c3715225dd
Closes-Bug: #1490761
2015-09-02 17:13:07 +00:00
Jenkins
b30efc1c7d Merge "Enable --debug for debug logging" 2015-09-02 07:32:47 +00:00
Jenkins
41caebed8c Merge "Dispatch the call to erase_block_device" 2015-09-01 03:10:51 +00:00
Josh Gachnang
508b7b67e2 Split functional and py27 tests
Moved tests/extensions to tests/unit/extensions, otherwise they
wouldn't have run. Renamed the files in tests/unit/extensions to be
prefixed with 'test_', to match the rest of the test files. Did a
general clean up of tox.ini so we have standard whitespace.

Change-Id: I5615bfbf2d6ff4a4bc3e66e71c2472b0d1e3a2d7
2015-08-28 14:16:34 -07:00
Jay Faulkner
09221f98cb Load Hardware Managers at runtime
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
2015-08-28 14:15:31 -07:00
Josh Gachnang
2c28cca71d Enable --debug for debug logging
oslo_log wasn't getting the correct config values passed in, so adding
'--debug' to the command line wouldn't enable debug logging.

Added docs about --debug and --standalone (the only two flags I've
seen used/supported).

Change-Id: Ie1ba64992444a65a40f2d65933942153b93e70c1
2015-08-28 12:25:06 -07:00
Josh Gachnang
cd6f15dffe Dispatch the call to erase_block_device
There is no way for two hardware managers to handle erasing two disks
in two different ways. dispatch_to_managers was designed specifically
for this case, and the default behavior will remain the same for the
GenericHardwareManager (erase_block_device will pick up each disk).

Also return the result of the dispatch calls, so they'll be logged by
Ironic and give more cleaning insight.

Change-Id: I19e9dc8539a0729fbb96cae92fe633e24608fc68
2015-08-28 18:08:56 +00:00
Josh Gachnang
c014549804 Refactor list_block_devices to its own function
This function is useful in any HardwareManager that interacts with
disks. Subclassing GenericHardwareManager is not ideal for any
hardware manager that interacts with only specific devices.

Change-Id: Ib20e68a8916590513c0a825e44407a110cfbb441
2015-08-28 10:03:40 -07:00
Dmitry Tantsur
dab1ce9831 Allow passing node UUID to lookup
After successful inspection we will know node UUID already, so no need
to do a proper lookup. In the future we might get rid of lookup completely
in this case.

Change-Id: Ic00049bf69f9ecc59ac4e389a3e6afe20ba67aba
2015-08-21 16:25:04 +02:00
Dmitry Tantsur
17c7e05235 Extend hardware manager with data needed for inspector
* Added NetworkInterface.ip4_address
* Added HardwareManager.get_bmc_address()
* Added Memory.physical_mb

  This is total memory as reported by dmidecode, and yes,
  it's different from total, as it includes kernel reserved space.

* Added CPU.architecture

  As a side effect, get_cpus was switched to lscpu.
  Also fixes problem when get_cpus reported the current frequency
  instead of maximum one.

Change-Id: I4080d4d551eb0bb995a94ef9a300351910c09fb9
2015-08-21 16:25:04 +02:00
Dmitry Tantsur
0c183edd71 Use addCleanup instead of tearDown
tearDown is not guaranteed to run if setUp fails

Change-Id: I942fd630617276044edfb4b2ed526a269e80f307
2015-08-19 19:15:35 +02:00
Josh Gachnang
fb2790774d Add base for IPA functional tests
Starts up an agent in a thread and then runs functional tests against
it.

Add the first functional test of the API: a simple test of the
commands API.

Co-Authored-By: Mario Villaplana <mario.villaplana@gmail.com>
Change-Id: If4ad611929d388a2a9454224646cb296bd0ba0ce
2015-08-18 16:19:47 +00:00
Josh Gachnang
108599f3f0 Fix printing of errors in IPA
Exception messages weren't being bubbled up to the API because the
base exception class wasn't printing correctly. This adds a string
and representation function to ensure they print properly and show
up correctly when debugging interactively.

Cleaned up the `message` attr on the exception classes. It looks
like they started out all without a period, but started adding them
later. Changed classes that were setting error `details` == `message`
to use the default details provided in RESTError.

Change-Id: I1ce256585c9a574e1d1f857c7dc4c417a56b913b
2015-08-11 14:03:09 -07:00
Josh Gachnang
50875381d8 Fix logging levels
This is a fixup patch for bde6ed557034bc2eac633ff84f2e9515a5ef14d6,
and should follow the OpenStack Logging Standards.

Change-Id: Ie277c5742ab736f4c5cee1ee1badedf055323515
2015-08-04 09:29:44 -07:00
Jenkins
4961b32710 Merge "Remove openstack.common package" 2015-08-03 19:35:57 +00:00
Jenkins
bde6ed5570 Merge "Improve IPA logging and exception handling" 2015-08-03 16:31:47 +00:00
Sergey Vilgelm
d5b7eb0871 Remove openstack.common package
ironic_python_agent contains unused oslo-incubator modules,
so let's remove them.

Change-Id: I2b8f84bf8a68d155fe123487f9b5624bb94e806b
2015-08-03 18:39:13 +03:00
Josh Gachnang
9f2ea824ec Add node param to base erase_block_device
The param was added to the GenericHardwareManager but it wasn't added
to the base class.

This is a breaking API change for the hardware managers.

Change-Id: Ia73fe14308986496e3a4f8d71bc2298a9130cffa
2015-07-28 16:57:42 -07:00
Josh Gachnang
59281ecda8 Improve IPA logging and exception handling
Debugging the agent is a huge pain point. Tracebacks are rarely logged,
error messages are often only returned via the API, and lack of
info logging makes it hard to determine where some failures occur.
Some errors only return a 500 with no error message or logs.

Change-Id: I0a127de6e4abf62e20d5c5ad583ba46738604d2d
2015-07-28 09:37:43 -07:00
Lucas Alvares Gomes
06eed473fb Add Python3 support
This patch add Python 3 support for IPA. We still need to enable it on
gate to avoid code breaking the support from sneaking in.

Partial-Bug: #1474896
Depends-On: I5a774eaa8d978f4d50faca4dc1b03a87fb194ce2
Change-Id: If47c0797b63d2914b3c47aba62ec5201301b6c33
2015-07-15 17:12:08 +01:00
Josh Gachnang
d6afe62e94 Fix using non-existent mock method
Mock 1.1.0 throws an error when using assert* methods that don't
exist.

Change-Id: I3fff6df417a29882f1e8672c309edc6d4201cdc2
2015-07-10 10:03:25 -07:00
Jenkins
a0f7485460 Merge "Convert Int to String for shred execute" 2015-07-06 23:49:37 +00:00
Jacob McCann
c0769691bd Convert Int to String for shred execute
Was running into 'expected string, int found' when calling
shred with an Int for iterations.

Change-Id: Iffce247caba5b0d62ac89b6411402c8d975cfd2f
Closes-Bug: #1469838
2015-07-01 15:08:18 +00:00
Sergey Vilgelm
64fd0fe37f Switch to oslo.service
oslo.service has graduated, so ironic should consume it.

Change-Id: I4560f3050bd8ce7e0c40a5cd5fb6a5a1b410f728
Partial-Bug: #1466851
2015-06-24 11:19:07 +02:00
Jenkins
4c1d2cdb19 Merge "IPA:'shred' utility to use configured iterations" 2015-06-22 10:11:11 +00:00
Mathieu Mitchell
63851b72ee Use host_device mode for qemu-img
When writing to a host device, possibly one that does not support holes,
it is preferable to use host_device instead of the raw mode. Not doing so
means holes are simply skipped and the deployed image is invalid.

Change-Id: I24f8b4daf099af8bb03c3a4f6417b6c87bd49021
Closes-Bug: #1466632
2015-06-18 16:00:25 -04:00
Anusha Ramineni
02f78453b2 IPA:'shred' utility to use configured iterations
Today, there is no option to configure number of iterations to be
done for shred block device erasing and defaults it to 1. This patch
adds a configuration option to change the number of passes to be done
to erase a block device.

Change-Id: I1921d33a6b364c4682b6c9baaf61ac092cfa11d7
Partial-Bug:#1465130
2015-06-18 09:26:36 +00:00
Ramakrishnan G
be36ed6903 Add power_off command in standby extension
This commit adds a new command power_off to
standby extension which runs shutdown -h now
on the system. This commit also adds mappings
for /proc and /sys in cloud-config.yml for the
agent service spawned.

Partial-Bug: #1451310
Change-Id: I2a5f984af26bbbe03002bb8c367c8c6af8d91434
2015-06-09 23:44:08 +00:00
Jenkins
0a416af0c8 Merge "Make sure sysrq functions are enabled in reboot.sh" 2015-06-08 15:38:07 +00:00
Jim Rollenhagen
601201d120 Update hacking and fix hacking violations
This does a few things:

* Update hacking to the version in global-requirements. Old hacking was
  installing a version of pbr that was breaking other packages.

* Fix all the hacking/pep8 rules that updating hacking raised.

* Do some general docstring cleanup, while already in there cleaning up
  a bunch of docstrings due to H405 violations.

Change-Id: I1fc1e59d4c3d7b14631f8b576e3f3854bc452188
Closes-Bug: #1461717
2015-06-03 16:58:57 -07:00
Ramakrishnan G
8faa3ae9d5 Make sure sysrq functions are enabled in reboot.sh
This commit echoes '1' to >/proc/sys/kernel/sysrq to
make sure that sysrq functions are enabled before
invoking them.

Change-Id: I88697efbc1bd0dec5ed4cbcd8d89b0b5d0734bdd
2015-06-02 12:41:06 +00:00
Jenkins
8a94a8979c Merge "Use mkdtemp for mounting virtual media device" 2015-05-14 17:56:49 +00:00
Anusha Ramineni
8cef029d0d Fix error in in-band disk erase using shred
in-band disk erase using shred fails with error "'module' object has no
attribute 'ProcessExecutionError'". This commit is to fix the issue.

Change-Id: Ia0c426074b2f0e9d534ed96a3e213933160edc61
Closes-Bug:#144799
2015-05-08 15:02:36 +05:30
Anusha Ramineni
efba46a8a2 Fix inband disk erase using agent_ilo driver
In-band disk erase using shred fails for agent_ilo driver as it tries to
erase the virtual floppy device attached.This fix is to skip the virtual
media devices and continue with other disks.

Change-Id: I26745985382d440f7d4b3fbfffb14545067fcca6
Closes-Bug:#1450298
2015-05-07 09:51:11 +05:30
Ramakrishnan G
b735b3c9d1 Use mkdtemp for mounting virtual media device
When using virtual media, restarting ironic-python-agent
leads to errors like 'File exists'.  This is because
we use static directory (/vmedia_mnt) as mount path
and we don't remove it. It's better to use mkdtemp to create
a temporary directory for mounting virtual media
device.

Change-Id: Ibb4c3d3a2024cf51ef198bd396fb9e86ad72a320
2015-05-06 02:47:48 -07:00
Jenkins
a1c87672ea Merge "Fix Sphinx Autodoc WARNING/ERROR in docs build" 2015-04-01 00:39:21 +00:00
Jenkins
499a212f92 Merge "Add sphinx build + basic documentation" 2015-04-01 00:32:18 +00:00
Jay Faulkner
8bad5bbac3 Fix Sphinx Autodoc WARNING/ERROR in docs build
The docstrings here were all giving WARNINGs or ERRORs during the docs
build, and were generally making unappealing looking developer
documentation. I corrected the syntax and did what was neccessary to
make the build come out clean.

Change-Id: I74b00a7f125770b0468cff3bdf26d0d52cd054d7
(cherry picked from commit c0921cdff372ce1fd6df1c4ab4eb5463e2cba0e4)
2015-03-31 16:22:57 -07:00
Jay Faulkner
be97525975 Add sphinx build + basic documentation
This adds and configures a sphinx doc builder. This is based on the code
in Ironic to build documentation.

The goal is for this to contain development documentation relevant to
hacking on the agent, including how to make custom HardwareManagers.

Change-Id: Ib6cecb9959f4ad5c71440fb37827b996582a9545
2015-03-31 16:22:12 -07:00
Ghe Rivero
10a3a800e7 Use oslo_log lib
Module 'log' from oslo-incubator was removed after release of oslo_log
library.

Change-Id: Ia00e26071fc0cab4fd3f3334ca94860bc7b1c75c
2015-03-24 08:43:35 +01:00