Updated file tox.ini allows to check code style in all ".sh" files
included in Ironic Python Agent. Checking can be invoked by calling either
"tox" or "tox -e pep8".
Change-Id: Ie76605737c7db10a064f2aebfda388372a4c0591
Closes-Bug: #1625215
Lookup/Heartbeat via vendor passthru was deprecated in Newton.
This patch removes the corresponding functionality from IPA,
and also removes handling of 'ipa-driver-name' kernel parameter,
as it was only used in code related to old passthru.
Change-Id: I2c7989063ab3e4c0bae33f05d6d2ed857a2d9944
Closes-Bug: #1640533
* Stop silencing exceptions in raw socket context manager
* Correctly handle receiving packages with odd size and too small ones
* Fix a unit test that was testing nothing due to bad mocking
Change-Id: Ic8626d10618f52d50667d2698f34a92f5dcac33e
Closes-Bug: #1640238
Use hacking 0.12.0
Use the new checks that are available:
[H106] Don’t put vim configuration in source files.
[H203] Use assertIs(Not)None to check for None.
[H904] Delay string interpolations at logging calls.
Fix code so tests pass.
Change-Id: If22ad272c332f30624ce10861408d377908b152b
Depends-On: I2aa44b62f900d4dfd67701b01eadd0523fbfaf07
Openstack common has a wrapper for generating uuids.We should
use that function when generating uuids for consistency.
Change-Id: Ifb7b15fc8634338fc535de8043053e41aa93968a
Closes-Bug: #1082248
Ironic-lib logs a message when configdrive is created
successfully. Remove duplicate message from IPA.
Change-Id: I2af81cdfda4cfc004288f44d14a5c127639cc1f1
Shell script to create config drive being replaced with python
code in ironic-lib.
Closes-Bug: #1493328
Change-Id: I31108f1173db3fb585386b2949ec880a95305fb6
In systems where the nvram may have been reset, add
\EFI\BOOT\BOOTx64.EFI to the EFI system partition so that
the image continues to boot. This will be particularly useful
if the NVRAM wasn't written correctly or if the baremetal
server is be simulated on virt and the NVRAM was been reset
on start (as is the case in libvirt).
Change-Id: I5005ae02c283cdc01540ea46c341a7b0bf9d4c42
Closes-Bug: #1632637
When the deployment happens on a GPT disk with config drive, writing
it to disk fails. Three reasons for that:
* parted should be used instead of partprobe to determine the type of
the disk;
* gdisk -l sorts the partitions by their number, sort them by start
sector instead;
* after sgdisk completion, the configdrive device is not immediately
visible in the /dev folder, udevadm settle needed here too.
Closes-Bug: #1633063
Change-Id: Ifed89e343f9db4cf303baf7f8823342f6041f202
This patch is updating IPA to use the match_root_device_hints() method
provided by ironic-lib version 2.2.0.
Partial-Bug: #1561137
Depends-On: I1d9dc7a57ea391a3419710c289242b39a4201463
Change-Id: Id93dd0360137df600f5a656348279e56c6b84bf9
In Python 2.6 it was required to use {0}, {1}...{n} when using the
string format function. In Python 2.7 and Python 3 it it not required.
Change {N} to {} in code.
This brings the code in style alignment with other projects like
ironic and ironic-lib.
Change-Id: I81c4bb67b0974f73905f14b589b3dd0a7131650d
Depends-On: I8f0e5405f3e2d6e35418c73f610ac6b779dd75e5
Collecting warning logs in the case of download failure
and write them to error logs in the end. This will help
a user to diagnose a problem when warning log was not
enabled.
Change-Id: I4198d7be08fc11b616b3f95c595ff53794436e24
Partial-Bug: 1512186
Use the namedtuple class to improve code readability by creating a Host
class with namedtuple to store the 'hostname' and 'port'
Replace foo[0] with foo.hostname, and foo[1] with foo.port to make code
more readable.
Change-Id: Ie2b5f9cf89e7ccbbcf0a2573dab6f6c5d14c018b
Following OpenStack Style Guidelines [1], I changed:
assertFalse(sth in sth) to assertNotIn(sth, sth).
After this change, a more specific message is shown on error.
[1]: http://docs.openstack.org/developer/hacking/#unit-tests-and-assertraises
Change-Id: I5d47d775dcff194693d97db6b797b7b027cbab56
Following OpenStack Style Guidelines[1]:
http://docs.openstack.org/developer/hacking/#unit-tests-and-assertraises
[H203] Unit test assertions tend to give better messages for more specific assertions.
As a result, assertIsNone(...) is preferred over assertEqual(None, ...)
Change-Id: I53c6d6d3e53d9fac38c50faf065c131d3aa55224
In noauth mode when running stable/mitaka, Ironic responds to the
initial lookup request with code 406, NOT_ACCEPTABLE, due to the client
supplied microversion of 1.22 by IPA.
As such, we should fallback upon receiving the 406 error code.
Related-Bug: #1616461
Change-Id: Ief9c151cf27a3c38c33a837bb7d6581868a3dc22
Re-initialization of the API client causes the identification
of an older ironic API to be forgotten.
As such, we need to re-use the API client from the initial lookup
for the heartbeat.
Tested with current master branch and stable/mitaka ipa
in noauth mode, and was able to deploy without any issues.
Closes-Bug: #1616461
Change-Id: I3ae1e2ce83f614b5b936a3cbb1b9587c6c55a89a
This will make sure the socket list and the interface list are
always in sync, and the select call is on the right list of
sockets.
Co-Authored-By: Dmitry Tantsur <dtantsur@redhat.com>
Closes-Bug: #1533892
Change-Id: Id6710f4648203b7d476a2a16ea647224baca1bb9
Prior to this patch the ironic-python-agent service would only fallback
to use the old endpoints for /lookup and /heartbeat on a 404 error but,
since Ironic will check auth (if enabled) before it routes the requests
a 401 (Unauthorized) was returned.
Closes-Bug: #1612696
Change-Id: Idba5fed587e77aaa683d2c2b2126a520214712ce
Falls back to vendor passthru on receiving 404.
Also fixes logging around lookup: log traceback on unexpected
exceptions, log successful lookup and replace % with ,
Change-Id: I7160c99ca63585fc333482fa578fdf5e0962b2b6
Depends-On: I9080c07b03103cd7a323e2fc01be821733b07eea
Partial-Bug: #1570841
This utilizes the new metrics support in ironic-lib to allow the agent to
report timing metrics for agent API methods as configured in ironic-lib.
Additionally, this adds developer docs on how to use metrics in IPA,
including some caveats specific to ironic-lib.metrics use in IPA.
Co-Authored-By: Jay Faulkner <jay@jvf.cc>
Co-Authored-By: Alex Weeks <alex.weeks@gmail.com>
Change-Id: Ic08d4ff78b6fb614b474b956a32eac352a14262a
Partial-bug: #1526219
This patch is adding a new cleaning step called "erase_devices_metadata"
to the GenericHardwareManager. This step is responsible for erasing the
metadata of the disks present in the node (partition tables, signatures,
filesystem identifiers etc...).
It's important to note that the "erase_devices" cleaning step will also
remove all these metadatas (because it will zero/shred the whole disk)
but, it takes a lot of time to run and for some usages of Ironic only
cleaning the device metadata and leaving the data from previous tenants
on the disk after the machine is recycled is fine. That's the use case
for systems using Ironic just to install the same base image onto many
nodes which will run another cloud on top afterwards (TripleO).
The new cleaning step has a default priority of 99, so it should run
before the "erase_devices" cleaning step so that we can guarantee that
the metadata was removed even in case of a failure when cleaning the
disks.
The version of the GenericHardwareManager was bumped to "1.1" with the
addition of this new clean step.
This patch make use of the "destroy_disk_metadata" method from ironic-lib
to get rid of the metadata.
Closes-Bug: #1603411
Change-Id: I3d7b39d5ee3e03ce63185e4168b1ac954a896c93
This was testing that _check_for_iscsi was called, which is part of
evaluate_hardware_support for the in-tree hardware manager.
evaluate_hardware_support is called at hardware manager instantiation,
which can happen when dispatch_to_managers is called. The hardware
manager instances are cached, so calling dispatch_to_managers won't
always invoke _check_for_iscsi. As such, these tests were intermittently
failing.
Mock _check_for_iscsi at the class level for these tests (since it's
unrelated), and don't check that it was called.
Change-Id: Iefca50c4c231c5eafd199bf8da6649bc3008a8fa
Address some comments on the original review, mainly changing
the release note to be more specific.
Change-Id: I0af397fab174e4a7b426fdc69e50dffce5578577
stevedore no longer raises a KeyError when there's an entrypoint
missing. Instead we must supply a callback that handles that error.
Update inspection code to work with this.
Also bumps stevedore minimum to 1.16 ahead of the global-requirements
bot.
Closes-Bug: #1603542
Change-Id: I12af23f2525ac90e577bdd10bbfbbd9788e9551c
Depends-On: I8aa1ee52ff7de50488acb86e8920da89ddb05771
Per Doug's email[0], 'warnerrors' in setup.cfg hasn't actually been
working for some time now, and we've piled up a few warnings. Fix these
before a pbr release to unbreak it gets pushed out and breaks our doc
builds.
[0] http://lists.openstack.org/pipermail/openstack-dev/2016-June/097849.html
Change-Id: I6576a56234918febb21e7e4860544eb952123c09
When matching the root device hints passed to Ironic and the devices
present in the disk, the logic to the "size" attribute was different was
outside the main loop. This patch refactors that uses the same loop for
matching the size attribute, improving a little the readability.
This patch also makes sure that we convert the value of "size" to
integer before attempting to match it.
Change-Id: I619153232b9b58696369185ad5be90ccfd38a4ed
It is required to issue iscsistart -b on those hardware in order for
/dev/sda /dev/sdb etc to be exposed to the OS.
On this type of hw, without the fix
introspection fails with - missing: ['local_gb']' err.
Change-Id: If6667b123e9b890d97c03612596fb78ee2b0ae85
Closes-Bug: 1590606
This patch is extending the root device hints to also consider if a disk
is a rotational device or not. This hint makes it easier to separate
SSDs and HDDs when selecting the device to deploy the image onto.
Partial-Bug: #1599517
Change-Id: I270fe57df825929bdef7911b3a6757cf7163a5f1
This patch is replacing the "-ax" options of the ps command when
collecting the logs to "au". The "-x" option is not supported by the
BusyBox in the TinyIPA ramdisk.
Closes-Bug: #1599839
Change-Id: Id0c86db6aa16c63550890e1cd488994025f5dd68
The log extension is responsible for retrieving logs from the system,
if journalctl is present the logs will come from it, otherwise we
fallback to getting the logs from the /var/log directory + dmesg logs.
In the coreos ramdisk, we need to bind mount /run/log in the container
so the IPA service can have access to the journal.
For the tinyIPA ramdisk, the logs from IPA are now being redirected to
/var/logs/ironic-python-agent.log instead of only going to the default
stdout.
Inspector now shares the same method of collecting logs, extending its
capabilities for non-systemd systems.
Partial-Bug: #1587143
Change-Id: Ie507e2e5c58cffa255bbfb2fa5ffb95cb98ed8c4