243 Commits

Author SHA1 Message Date
Jenkins
aa908205c6 Merge "Refactor list_all_block_devices & add block_type param" 2015-10-07 02:42:07 +00:00
Dan Prince
5bbb9ded08 Fix log formatting error in iscsi.py
This fixes a ValueError exception that would occur if
log debug was enabled in IPA.

Change-Id: Id95f291dd77d69e7d4dd4f945c6c151db7a0646b
Closes-bug: #1503354
2015-10-06 22:47:54 +00:00
John L. Villalovos
dcbba2b121 Enforce all flake8 rules except E129
Bring ironic-python-agent in line with the other ironic projects.

Stop ignoring all E12* errors except E129
Stop ignoring E711

Change-Id: Icb9bc198473d1b5e807c20869eb2af7f4d7ac360
2015-10-02 10:01:00 -07:00
Dmitry Tantsur
9d6b0864e3 Add "logs" and "extra-hardware" inspection collectors
This is a port of downstream inspector ramdisk plugins we found helpful.
* logs - sends journald logs with inspection data.
* extra-hardware - uses hardware-detect utility to collect bigger
  hardware inventory and to run benchmarks.

Change-Id: If05402606c45185d618279eef46e68c51209f82b
2015-10-01 18:25:30 +02:00
Jenkins
378197caee Merge "Make the erase_devices clean step abortable" 2015-09-26 22:25:17 +00:00
Lucas Alvares Gomes
cd70f514d6 Make the erase_devices clean step abortable
This patches updates the get_clean_steps() method to make the
erase_devices step abortable. Erasing devices is something that can be
cancelled without damaging the machine.

When a clean step is aborted the provision state of the Ironic node
will go to CLEANFAIL state. The operator can then do what is needed to
fix the problem (i.e network booting issues) and restart the cleaning
later on.

Partial-Bug: #1455825
Change-Id: Ic181ac3712810c6f6925e8b627ee79e77ecf4d83
2015-09-26 19:01:26 +00:00
John L. Villalovos
3af9ab36bf Refactor list_all_block_devices & add block_type param
Put the columns to retrieve from lsblk into a list so that future
modifications to columns will require fewer code changes.

Also add a 'block_type' parameter which defaults to 'disk'. To make the
function more flexible if callers wanted a different block type.

Update and add unit tests

Change-Id: If06460e13a5b56dc8d6efca9ff5b58ac6ba1f357
2015-09-24 15:31:13 -07:00
Jenkins
7dba81f200 Merge "Fixes config drive creation failure in UEFI boot mode" 2015-09-24 04:42:48 +00:00
Shivanand Tendulker
2d341c7f0d Fixes config drive creation failure in UEFI boot mode
This fix enables creation of config drive for UEFI only whole disk
images.
It will not work with the hybrid images that support booting in BIOS
and UEFI boot mode.

Change-Id: Ib4dd8c082a50e1dbaf0df91477b062716cb780ff
Closes-Bug: #1486887
Depends-On: I81400305f166d62aa4612aab54602abb8178b64c
2015-09-23 23:14:46 +00:00
Naohiro Tamura
cae39ae14d Fix default ironic api port number
This patch corrects the default ironic api port number to 6385 from
6835. The default value of 'ipa-api-url' is not used in production
environment since conductor and bare metal node have its own IP
address, but could be used in development environment.
Therefor this patch fixes this trivial error.

- default=APARAMS.get('ipa-api-url', 'http://127.0.0.1:6835'),
+ default=APARAMS.get('ipa-api-url', 'http://127.0.0.1:6385'),

Change-Id: Idb85e95b354a68111f94e8cddd5c1b6227e676ef
2015-09-23 14:11:29 +09:00
Jenkins
19d21eb999 Merge "Add more info to checksum exception" 2015-09-22 13:46:48 +00:00
Josh Gachnang
e17129dbad Add more info to checksum exception
If an image cannot be downloaded for some reason, it is helpful for
operators to have the image path, checksum, and calculated checksums
available easily from the API.

Change-Id: I6a2fb46726245cebd730b5c51d4f25f8465f1658
2015-09-21 15:54:02 -07:00
Dmitry Tantsur
b569e37d06 Expose serial, wwn and vendor on the BlockDevice object
Currently we only use these disk properties for root device hints.
However, they'll be really useful for inspector, especially for also
implementing root device hints.

Change-Id: I48aa6b6d2d198d16f2f8e387970f7230066cf8a2
2015-09-21 13:17:20 +02:00
Jenkins
d34f5d857a Merge "Create a SerializableComparable class" 2015-09-18 23:47:11 +00:00
Dmitry Tantsur
3b70647358 inspection: prepare for future deprecations
1. cleanly separate deprecated and non-deprecated properties
2. add root disk to inspection data, so that we can have a proper
   fallback when root device hints are not given.

Change-Id: Ie19b82ff2a914873ff4b2395b02643e086b934b1
2015-09-16 14:26:57 +02:00
Jenkins
3cd59fac63 Merge "Follow-up to inspection patch 096830414b" 2015-09-16 12:17:57 +00:00
Dmitry Tantsur
e3e6000524 Follow-up to inspection patch 096830414b
Change-Id: I7ec05e501ec40802efa14cabe14752972919c7a9
2015-09-16 10:36:33 +00:00
Mario Villaplana
3d097f5fdc Fixes incorrect description URL
A GET to /v1 in the API returns a link to a URL for a repository that is no
longer maintained. This commit changes the link to point to the correct
documentation.

Change-Id: I8779cd1840627ff8759527b7514306293682aaae
2015-09-15 21:05:19 +00:00
John L. Villalovos
1285baee1c Create a SerializableComparable class
Create a SerializableComparable class derived from the Serializable
class.

Added the following functions to the SerializableComparable class:
  '__eq__'
  '__ne__'

Disable the '__hash__' function in the SerializableComparable class as
some derived classes are mutable.

Use the SerializableComparable class in hardware.py and
extensions/base.py

This should make unit testing users of the class easier when doing a
self.assertEqual() or self.assertNotEqual()

Added some initial unit testing for encoding.py

Change-Id: If0f14b3bfe7f1391f65dd730a16a534afed0da82
2015-09-11 13:44:09 -07:00
Jenkins
88e22ad852 Merge "Add support for inspection using ironic-inspector" 2015-09-10 14:47:54 +00:00
Josh Gachnang
46eb0dfa35 Tuples returned by clean steps cause API error
If a clean step returns a tuple (like the output of
processutils.execute), WSME raises an error about the type. Casting
the result as a list seems to make it work. This is almost certainly
a bug in WSME, but after digging a bit I couldn't find one.

Change-Id: I91cb7a989ab56c0942469e03937945d4a590ad95
Partial-bug: #1493554
2015-09-08 13:44:23 -07:00
Dmitry Tantsur
096830414b Add support for inspection using ironic-inspector
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
2015-09-07 18:22:54 +02:00
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