114 Commits

Author SHA1 Message Date
John L. Villalovos
6d84d9642a Fix a mis-formatted log message
There was an error in thinking that we can pass a tuple to log a
message. Corrected this error.

Change-Id: I45a2512f2dc50d6cacc646321d26c2f1c5713137
2017-10-10 15:16:40 -07:00
Jenkins
ad44a7922b Merge "Report /dev/disk/by-path on inspection" 2017-09-26 09:15:43 +00:00
Ilya Etingof
d0a53149f8 Report /dev/disk/by-path on inspection
When inspecting block devices on a node, discover and
report the /dev/disk/by-path/XXX name along with the
/dev/XXX block device name.

The second name does not change between Linux system
reboots and has greater chances to be the same across
similarly configured nodes.

Note: this patch depends on
https://review.openstack.org/#/c/500524/
library patch, but this dependency can't be expressed
with Depends-On clause. Therefore once this patch
requires a followup patch to enable one currently disabled
test in this patch.

Change-Id: I09874f19890500d352521f89573e2aaf50a29022
Closes-Bug: #1679726
2017-09-25 11:55:11 +02:00
Dmitry Tantsur
d6ff5116f4 Remove assumption that a valid IPMI channel cannot follow an invalid one
It seems to be incorrect at least for some iLO machines.
Also harden the code against invalid output from ipmitool.

Change-Id: I733785e9c7d86eadca963f0776910504bf91bcfe
Closes-Bug: #1714944
2017-09-11 18:43:24 +02:00
Mateusz Kowalski
7c28332e9a BMC can be configured using different lan channel
It may happen that BMC is configured to use non-zero channel.
In this case we should iterate across all of them as long as we
get a correct IP address (in this case different than "0.0.0.0"
which is a placeholder for not configured console).

Change-Id: I3c351af1882b24c8f56e4363249b19b5c3a4a446
Closes-Bug: #1702514
2017-08-09 15:35:57 +02:00
Vu Cong Tuan
667ad45615 Remove pbr warnerrors in favor of sphinx check
This change removes the now unused "warnerrors" setting,
which is replaced by "warning-is-error" in sphinx
releases >= 1.5 [1].

[1] http://lists.openstack.org/pipermail/openstack-dev/
2017-March/113085.html

Change-Id: I9bf18ff72f36dfd3496b9672604e8bb98999b133
2017-06-11 18:18:28 +07:00
Ramamani Yeleswarapu
a42ef91591 Log 'Executable biosdevname not found' only once
Currently, get_bios_given_nic_name logs 'biosdevname not found' for
every NIC. This patch changes it to log only once when the executable
is not found.

Removes a redundant 'return' statement.

Change-Id: Ic42ec23876b6f7b28d8f6ac1bd37bdbfa20cf421
2017-06-02 10:59:25 -07:00
Annie Lezil
fdcb0922a5 Collect NIC name given by BIOS
Adds an extra field ``biosdevname`` to network interface inventory
collected by ``default`` inspection collector (which collects the whole
inventory returned by hardware manager) of ironic-python-agent.

This feature requires biosdevname utility to collect the bios given NIC
names. The tooling module for tinyIPA is created for the same purpose.
For CoreOS IPA pxe images, biosdevname tooling module is limited,
because Docker repository is created and embedded into CoreOS pxe
images. The Docker repository uses debian to download the packages.
Debian does not have biosdevname package.

Adds an export variable TINYIPA_REQUIRE_BIOSDEVNAME. Set this
variable to ``true`` in your shell before building tinyIPA.

Closes-Bug: #1635351
Change-Id: Ia96af59e2a74868cac59e5a88cfbb3be60d85687
2017-05-18 14:44:11 -07:00
Ramamani Yeleswarapu
73f316d804 Remove switch_port_descr and switch_chassis_descr
Removes two reserved fields ``switch_port_descr`` and
``switch_chassis_descr`` that were deprecated in the Newton cycle.

Change-Id: Icd2251af63a69d60d1e72eddf651a168fdae94fa
2017-02-02 07:01:04 -08:00
John L. Villalovos
2334605789 Add a comment about the catch-all exception for psutil
If there is a problem with psutil failing we have a catch-all
exception. Explain reasoning for the catch-all exception.

Change-Id: Id2e22e4ff93d96c795f474e72a684dfe3db87a58
2017-01-27 13:37:34 -08:00
Jay Faulkner
b7ae4995a7 Remove support for older psutil versions
Global requirements was recently updated to force psutil=>3.0.1. This
patch removes support for older versions of psutil as well as changing
to opportunistically attempt to work if a version >5 is released but
doesn't change the interface we use.

Change-Id: I1f7fab33fd275fb8b5cd7704dc13375402756d06
Related-bug: #1659137
2017-01-26 14:28:51 -08:00
Mario Villaplana
e4919e04aa Support psutil 5.0.1
An upper-constraints update to psutil caused IPA to start using psutil
5.0.1. We had a hard-coded assumption that psutil would be major version
1 or 2. This allows us to use the updated psutil and attempts to simply
fail gracefully if an unrecognized psutil version is used.

Change-Id: Ibe072440159561b34a29b478d955876e5fb7f103
Closes-Bug: 1659137
2017-01-24 23:09:09 +00:00
Szymon Borkowski
ef47d62f43 Add a new Hardware Manager for CNA network card
This patch adds a new hardware manager, which will disable the embedded
LLDP agent on Intel CNA network cards in order to allow the gathering of
LLDP data during the inspection process.

Change-Id: I572756ac6a7bf67a7f446738ba9d145e1c1bdc48
Closes-Bug: #1623659
2016-12-12 17:17:23 +01:00
Lucas Alvares Gomes
b272426562 Add HCTL to BlockDevices
This patch is adding a "hctl" attribute to the BlockDevices. HCTL stands
for: Host, Channel, Target and Lun, which is basically the SCSI address.

The idea behind this patch is to allow root device hints to find the
disk for deployment based on the SCSI address.

Partial-Bug: #1648036
Change-Id: If8897c68609e0df0378ee919b803ca5e497def02
2016-12-07 16:51:30 +00:00
Moshe Levi
1bdcd4449f Add a new Hardware Manager for Mellanox NICs
This patch add Mellanox Manager to support Mellanox
InfiniBand NICs.

It adds client_id to the NetworkInterface for the
InfiniBand network interface.

The Mellanox Manager provides it own implementation of
get_interface_info. The mlnx get_interface_info generate
InfiniBand MAC and client-id from the InfiniBand network
interface address.

Closes-Bug: #1532534

Change-Id: I4e7f7649a1bdeaa3ee99b2748037b0f37fea486c
2016-11-22 15:46:12 +01:00
Moshe Levi
966db1c18c Dispatched out network interface info to all hardware managers
This patch dispatches out the network_interface_info
to allow vendor hardware managers to plug the spacific
implementation. It also move neworking releated methods
form hardware to netutils
Related-Bug: #1532534

Change-Id: Idcd25c4753c009b5ba70bea97ee4eb83391a77a9
2016-11-17 13:08:03 +02:00
John L. Villalovos
0b8763e332 Update to hacking 0.12.0 and use new checks
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
2016-11-08 11:31:18 -08:00
Lucas Alvares Gomes
cca1cd48ef Add support for root device hints with operators
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
2016-10-11 15:43:50 -03:00
John L. Villalovos
20d960ff98 Remove Python 2.6 format style
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
2016-10-06 09:05:26 -07:00
Moshe Levi
fe3b630360 Add vendor, product to interface information
This patch updates the interfaces JSON to include
vendor and  product
u'interfaces': [
    {
        u'mac_address': u'00:0c:29:8c:11:b1',
        u'name': u'eth0',
        u'ipv4_address': None,
        u'switch_chassis_descr': None,
        u'switch_port_descr': None,
        u'lldp': None,
        u'vendor': u'0x15b3',
        u'product': u'0x1014,
    }]

Co-Authored-By: yogananth subramanian <ysubrama@redhat.com>

Closes-Bug: #1611856

Change-Id: I8fa58dde29601abee959f74b69b692ed9eaffb94
2016-09-21 10:14:26 -04:00
Lucas Alvares Gomes
d528728090 Add erase_devices_metadata cleaning step
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
2016-07-28 11:14:11 +01:00
Jenkins
e9dd5d3db0 Merge "Follow-up text changes for 327807" 2016-07-21 17:38:47 +00:00
Jenkins
5d012b43bd Merge "Handle diskless hardware connected to remote iscsi" 2016-07-21 14:39:36 +00:00
Julia Kreger
f50a14dd1b Follow-up text changes for 327807
Address some comments on the original review, mainly changing
the release note to be more specific.

Change-Id: I0af397fab174e4a7b426fdc69e50dffce5578577
2016-07-21 09:54:51 -04:00
Jenkins
ad60806f93 Merge "Small refactor in the root device loop matching logic" 2016-07-19 10:10:28 +00:00
Jenkins
04c880f6f2 Merge "Fix doc warnings" 2016-07-18 13:58:51 +00:00
Jim Rollenhagen
2e10d7b32c Fix doc warnings
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
2016-07-14 14:37:02 -04:00
Lucas Alvares Gomes
5f09bd03e1 Small refactor in the root device loop matching logic
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
2016-07-12 10:15:48 +01:00
Yossi Ovadia
90424fad0a Handle diskless hardware connected to remote iscsi
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
2016-07-11 09:42:20 -07:00
Lucas Alvares Gomes
080e413b9c Extend root device hints to support "rotational"
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
2016-07-11 14:30:35 +01:00
John L. Villalovos
d89dfb1b26 Documentation follow-up to the LLDP patch
Documentation follow-up to the LLDP patch, commit
a7f0af722f96950e3bf67e26b922f80c1bd503ab. Provide the meaning of the
acronymns TLV and LLDP.

Change-Id: Icce3eb5519dfcfc9b6f7e23003cf056646da6c50
2016-06-24 13:00:32 -07:00
Sam Betts
a7f0af722f Support LLDP data as part of interfaces in inventory
To support multi-tenant networking in Ironic we need to be able to
discover not just the NICs a baremetal machine has but also the physical
connectivity to switches in the network.

This patch collects LLDP (Link Layer Discovery Protocol) data as part of
the list interfaces stage of the generic hardware manager. This
information can then be processed by the ironic inspector to populate
the local link information on each ironic port.

The processing done on this data in ironic python agent is limited, this
is to allow for server side processing hooks to process as much or as
little of the data as they want. This is to allow for multi-vendor
environments that might use different parts of the LLDP packet to use a
generic ramdisk and configure the processing server side using inspector
plugins.

Reserved fields switch_port_descr and switch_chassis_descr have been
deprecated for removal in Ocata in favor of passing the whole packet.

Change-Id: Idae9b1ede1797029da1bd521501b121957ca1f1a
Partial-Bug: #1526403
2016-06-22 18:26:04 +01:00
Jenkins
99a053f654 Merge "Add configuration options for DISK_WAIT" 2016-06-22 02:29:46 +00:00
Yosef Hoffman
13a8c6321e Add configuration options for DISK_WAIT
https://review.openstack.org/#/c/320295/ introduced two internal
variables: _DISK_WAIT_ATTEMPTS and _DISK_WAIT_DELAY. These values are
hardcoded. This patch adds configuration options for these so
that an operator can change them based on their own needs/fleet of
hardware.

Change-Id: I2ba97669ec710fb4a435307466cd8add9c2293ba
Closes-Bug: #1585663
2016-06-20 18:47:26 -04:00
Jenkins
031593614e Merge "Add boot information into the inventory" 2016-06-02 19:11:35 +00:00
Jenkins
928b10cbd3 Merge "Returns CPU flags in the CPU inventory" 2016-06-01 18:21:21 +00:00
Dmitry Tantsur
6670da4ed1 Returns CPU flags in the CPU inventory
These flags will be processed in a new ironic-inspector plugin
to support setting capabilities like cpu_vt (virtualization enabled).

Change-Id: I5fe9310c316841eabdd2d5e2ef2ae30afa03d29a
Partial-Bug: #1571580
2016-06-01 16:12:32 +02:00
Dmitry Tantsur
53b187a4c3 Add boot information into the inventory
Adds a new BootInfo object with 2 fields:

* current_boot_mode - bios or uefi, detected from presence of /sys/firmware/efi
  as per the following answer: http://askubuntu.com/a/162896
  This field will be used for setting the boot_mode capability in ironic-inspector
* pxe_interface - PXE booting interface, if it can be detected.
  This fields is already used by ironic-inspector, added here for consistency.

Change-Id: Ib36b592ffaba3bfa055d65c9526607867d302584
Partial-Bug: #1571580
2016-05-26 17:05:11 +02:00
Lucas Alvares Gomes
33535cd572 Get root device hints from the node object
In order to support a more complex syntax for root device hints (e.g
operators: greater than, less than, in, etc...) we need to stop relying
on the kernel command line for passing the root device hints. This patch
changes this approach by getting the root device hints from a cached
node object that was set in the hardware module.

Two new functions: "cache_node" and "get_cached_node" were added to the
hardware module. The idea is to facilitate the access to a node object
representation from the hardware extension methods without changing
method signatures, which would break compatibility with out-of-tree
hardware managers.

Note that the new "get_cached_node" is just a guard function to
facilitate the tests for the code.

The function parse_root_device_hints() and its tests were removed since
it's not used/needed anymore.

Partial-Bug: #1561137
Change-Id: I830fe7da1a59b46e348213b6f451c2ee55f6008c
2016-05-26 14:52:15 +01:00
Dmitry Tantsur
c15ed6a48e Wait for at least one suitable disk to appear on start up
Some kernel modules take substantial time to initialize. For example,
with mpt2sas RAID driver inspection and deployment randomly fail
due to IPA starting before the driver finishes initialization.

This problem is probably impossible to solve in a generic case, as
modern Linux environment do not have a notion of "hardware is fully
initialized" moment. All hardware is essentially hotplug.

To solve it at least for the simplest case, this patch adds a wait loop
on start up waiting for at least one suitable disk to appear in inventory.
Note that root device hints are not considered, as the node might not
be known at that moment yet.

Change-Id: Id163ca28f7c140c302ea04947ded3f3c58b284de
Partial-Bug: #1582797
2016-05-24 10:36:45 +02:00
Jay Faulkner
5a1a1ca61c Revert "Add hardware manager interface for hardware initialization"
I would've voted -1 on the patch in question had I reviewed it, and per
standard OpenStack/Ironic procedure, I'm reverting it for re-review and
discussion.

In this case; I don't think the new method in the HWM interface is
needed, and that evaluate_hardware_support() is intended to handle the
cases handled.

This reverts commit 0962cae1da69a1a2981d5950ad741d91115dac06.

Change-Id: Ic08e44bdf116403444b257ee9f4e5b906f5eac53
2016-05-23 17:41:29 +00:00
Dmitry Tantsur
0962cae1da Add hardware manager interface for hardware initialization
Some kernel modules take substantial time to initialize. For example,
with mpt2sas RAID driver inspection and deployment randomly fail
due to IPA starting before the driver finishes initialization.

Add a new hardware manager method initialize_hardware, which gets
run on start up before other hardware manager method invocations.

The generic implementation is to call udev settle and wait for
at least one suitable disk device to appear with the hardcoded
timeout of 15 seconds. Also preload the IPMI modules instead of
calling modprobe every time the inventory is requested.

Change-Id: If7758bb6e3faac7d05451baa3a26adb8ab9953d5
Partial-Bug: #1582797
2016-05-20 15:38:53 +02:00
Mathieu Mitchell
1c9ecbd8cb Allow shred zeroize option to be configured
Introduce a new parameter in driver_internal_info called
agent_erase_devices_zeroize to control the behavior of shred. This
parameter controls the --zero argument used when invoking shred.
Configuring this to false disabled the last pass of zeroes, leaving the
device with random data.

Change-Id: I7053034f5b5bc6737b535ee601e6fb71284d4a83
Partial-bug: #1568811
Depends-On: Ia7ea8d909df9ae86a6dbd68ba94746b171535eb8
2016-04-18 16:59:32 -04:00
Jenkins
a630a921d3 Merge "Provide fallback from ATA erase to shredding" 2016-04-08 22:21:40 +00:00
Julia Kreger
ed74a062c1 Provide fallback from ATA erase to shredding
Presently should the ATA erasure operation fails, IPA halts the
cleaning process and the node goes to CLEANFAIL state as a result.

This failure could be the result of a previous cleaning failure
that left drive security enabled, for which code has been added
in an attempt to address this case by attempting to unlock the
the drive.

In the event that an operator wishes to automatically fallback to
disk scrubbing operations, the capability has been added through
a driver_internal_info field "agent_continue_if_ata_erase_failed"
that can be set to True, however defaults to False keeping the
same behavior that IPA presently exhibits in the event of ATA
erase operations failing.

Partial-Bug: #1536695
Change-Id: I88edd9477f4f05aa55b2fe8efa4bbff1c5573bb1
2016-04-08 15:55:06 -04:00
Dmitry Tantsur
3deb25a3ce Wait for the interfaces to get IP addresses before inspection
In the DIB build the DHCP code (provided by the dhcp-all-interfaces element)
races with the service starting IPA. It does not matter for deployment itself,
as we're waiting for the route to the Ironic API to appear. However, for
inspection it may result in reporting back all NIC's without IP addresses.
Inspection fails in this case.

This change makes inspection wait for *all* NIC's to get their IP addresses up
to a small timeout. The timeout is 60 seconds by default and can be changed
via the new ipa-inspection-dhcp-wait-timeout kernel option (0 to not wait).

After the wait inspection proceedes in any case, so the worst downside
is making inspection 60 seconds longer.

To avoid waiting for NIC's that are not even connected, this change extends the
NetworkInterface class with 'has_carrier' field.

Closes-Bug: #1564954
Change-Id: I5bf14de4c1c622f4bf6e3eadbe20c44759da5d66
2016-04-05 20:03:33 +02:00
Jenkins
dcd1c8f19b Merge "Document hardware inventory sent to lookup and inspection" 2016-03-15 17:04:25 +00:00
Lucas Alvares Gomes
055998c812 Wait for udev to settle before listing the block devices
This patch is making the list_all_block_devices() method to wait for
udev to settle it's event queue prior to listing the devices.

Sometimes the ironic-python-agent service may start before all devices
were detected and end up erroring out because it couldn't find a
suitable disk for deployment.

Closes-Bug: #1551300
Change-Id: I1ae2062a711115a1ea14b79ae9ace7ddd2fff9d5
2016-03-02 10:54:51 +00:00
twm2016
d66fa523bf Reduced restriction of parsing for dmidecode output
Changed implementation to strip tokens up until the first 'Size: '
string. This will allow for less parsing errors in the first
six lines of the following output:
"dmidecode --type 17 | grep Size" returns:
        Maximum Memory Module Size: 4096 MB
        Maximum Total Memory Size: 8192 MB
        Size: 2048 MB
        Size: 2048 MB

Added a condition in the exception handling to address the
issue of the bug on other outputs like:
        Installed Size: Not Installed
        Enabled Size: Not Installed
        Size: No Module Installed
        Size: 1024 MB

Common strings like "No Module Installed" and "Not Installed" are
normal. These two strings are hard coded in the before mentioned
comparison and when found are logged as warnings instead of errors.

Change-Id: If3475afcebfc7af7e9256b99924919557c4d909c
Closes-Bug: #1521202
2016-02-22 22:46:28 +00:00
Dmitry Tantsur
c9674da220 Document hardware inventory sent to lookup and inspection
Also add a missing docstring to HardwareManager.list_hardware_info.

Change-Id: Iee3584320f0591398e7761513ff588efeb62886d
2016-02-18 13:32:43 +01:00