208 Commits

Author SHA1 Message Date
Zuul
1c51e81ab7 Merge "Fix OSError catch" 2017-10-17 01:19:30 +00:00
Julia Kreger
308cddc1bb Fix OSError catch
The _execute helper was catching OSError, except it
was expecting the same attributes as ProcessExecutionError,
which is incorrect.

Added a separate catch and unit test to ensure that we
at least properly catch and convert the error instead of
raising an error about an attribute that does not exist.

Change-Id: Id47715a5657478e4d9dd10ea7f360b1ededa27de
Closes-Bug: #1715466
2017-10-12 14:32:50 +00:00
Jenkins
0fb3329a18 Merge "Remove hard-coded path to grub binaries" 2017-09-26 09:16:09 +00: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
Vasyl Saienko
db5272cfea Remove hard-coded path to grub binaries
Use PATH variable to find grub binaries.

Closes-Bug: 1717255

Change-Id: Ic6a2bafdc87e33c4e1c4534fa355f995c824b945
2017-09-25 09:30:58 +03:00
Dmitry Tantsur
f153a741e1 Clean up deprecated items in the inspection code
* Remove support for setting IPMI credentials (removed from inspector in Pike)
* Stop sending the ipmi_address field (bmc_address is used instead since Pike)

Change-Id: I1696041db62ba27e5d31e8481cb225a43d7e2a46
Closes-Bug: #1654318
2017-09-19 14:05:13 +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
Jenkins
a487120187 Merge "BMC can be configured using different lan channel" 2017-08-10 09:39:55 +00: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
Ramamani Yeleswarapu
3ab779c897 Collect processor, memory and BIOS output of dmidecode - follow-up
Fixes nits, modifies unit tests.

This is a follow-up to commit c5544fb7a0d9d2a1481b3256c3587259368b599e.

Change-Id: Ibca82cc6e32311b1ff0be7137d8392f63e12639b
Closes-Bug: #1635057
2017-07-27 07:30:54 -07:00
Jenkins
aa8f68bbca Merge "Collect processor, memory and BIOS output of dmidecode" 2017-07-24 12:29:36 +00:00
Ramamani Yeleswarapu
c5544fb7a0 Collect processor, memory and BIOS output of dmidecode
Implements an optional collector 'collect_dmidecode_info' for
collecting detailed info of processor, memory and BIOS and
adds it to the inspection data.

Collects BIOS, processor, memory info and adds under the 'dmi' key.

Change-Id: Ida9b418ca579b15de70d17886631f3b21697987e
Closes-Bug: #1635057
2017-06-28 10:23:45 -07:00
ChangBo Guo(gcb)
30e0da15ea Remove usage of parameter enforce_type
Oslo.config deprecated parameter enforce_type and change its
default value to True in Ifa552de0a994e40388cbc9f7dbaa55700ca276b0.
Remove the usage of it to avoid DeprecationWarning: "Using the
'enforce_type' argument is deprecated in version '4.0' and will be
removed in version '5.0': The argument enforce_type has changed its
default value to True and then will be removed completely."

Change-Id: I0f0fb540c43edde64e489915c5199da40a0da9c1
Related--Bug: #1517839
2017-06-14 13:47:29 +08:00
Jenkins
db76c899b5 Merge "NUMA-topology collector" 2017-05-22 13:13:18 +00:00
Jenkins
2deef86f32 Merge "Collect NIC name given by BIOS" 2017-05-22 11:35:41 +00:00
Luong Anh Tuan
efe739f039 Replace assertRaisesRegexp with assertRaisesRegex
This replaces the deprecated (in python 3.2) unittest.TestCase
method assertRaisesRegexp() with assertRaisesRegex()[1].
[1]https://review.openstack.org/#/c/466155/

Change-Id: Ife8504dbb58019a30bcc1495a78ab14c757efc98
Related-Bug: 1673768
2017-05-19 20:16:47 +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
Jaganathan Palanisamy
cc9e05da50 NUMA-topology collector
Implement the optional collector for fetching the NUMA topology
details.
Collects RAM, CPU Cores, thread siblings and NICS data for
each NUMA node and stored under "numa_topology" key.

Closes-bug: #1635253

Co-Authored-By: Jaganathan Palanisamy <jpalanis@redhat.com>

Change-Id: I5a546c009d95f39b7af4d89cf785be8acb8ebc67
Signed-off-by: karthik s <ksundara@redhat.com>
2017-05-16 08:07:58 -04:00
Jenkins
15878b7b18 Merge "Remove unused function _configdrive_location" 2017-05-16 10:31:01 +00:00
Jenkins
c2687c6223 Merge "Prevent tests' unmocked access to utils.execute()" 2017-05-15 04:25:45 +00:00
Julian Edwards
f57cbccf8b Prevent tests' unmocked access to utils.execute()
This change introduces a new base test class that mocks out
utils.execute and forces an exception if it gets called.
This has rooted out many tests that were doing this as a side effect of
calling other functions, doing things like modprobe and running iscsi
on the host's actual machine.

The tests are all now appropriately patched in places where this was
happening, and the new base class permanently prevents this from
accidentally happening again.

If you really want to call utils.execute() then you need to re-mock it
in your unit test.

Change-Id: Idf87d09a9c01a6bfe2767f8becabe65c02983518
2017-05-15 10:48:43 +10:00
vmud213
85869a134b Remove unused function _configdrive_location
This function is never used and can be removed safely.

Change-Id: Ied7b4984185ea170d33cb57010de89edeaaaeec5
Closes-Bug: #1690135
2017-05-11 12:23:38 +00:00
Javier Pena
32ed01448b Set valid inspection_dhcp_wait_timeout value in tests
inspection_dhcp_wait_timeout is defined as IntOpt, but its value was
set in tests to 0.01. This was ok until oslo.config started enforcing
types in [1], after that unit tests fail for test_timeout.

Fixing by setting the value to 1, and mocking time-related functions
to avoid a longer wait.

[1] https://review.openstack.org/328692

Change-Id: I732c4aa3d1760c3159d9672e3fae81f8bd72497c
2017-04-25 12:12:49 +02:00
Jenkins
4be702242e Merge "Add missing 'autospec' argument to mock.patch" 2017-03-20 13:59:18 +00:00
John L. Villalovos
1695cb18c2 Add missing 'autospec' argument to mock.patch
Add missing 'autospec' keyword argument to mock.patch and
mock.patch.object calls. Use 'autospec=True' except for a few cases
where it fails because the mocked function is a @classmethod and it
doesn't work. In that case explicity set it to 'autospec=False'

Change-Id: I620dce91abaa4440e1803aeefb3e93c0b65d1419
2017-03-19 10:04:19 -07:00
John L. Villalovos
e9344077fc flake8: Specify 'ironic_python_agent' as name of app
Specify 'ironic_python_agent' as the name of the application for the
flake8-import-order plugin. That way it knows that imports of
ironic_python_agent should come after external libraries.

Change-Id: Id39d558a51aeb97d96633afea28676634547d0d7
2017-03-16 07:09:07 -07:00
Jenkins
0ed8d7cd27 Merge "Fix logs encoding in py3" 2017-03-14 11:25:49 +00:00
zackchen
000eaa3554 Fix logs encoding in py3
Make sure that logs are encoded as text (not byte strings) in
python3 to allow theirs serialization in JSON.

Closes-Bug: #1668533

Change-Id: I3d0d87ca766146457d905f89c26331a415bd54f8
2017-03-14 10:25:09 +08:00
Galyna Zholtkevych
9c2d0cdd85 Correct failure message output when downloading
This fixes unreadable output on download image failure.
Adding new instance variable to exception `ImageDownloadError` class
to avoid redundant logs.

Change-Id: I51782abd572588adfc62745eeab9c559eb8346dd
Closes-Bug: #1657691
2017-03-10 19:16:07 +00:00
John L. Villalovos
949f4f509e Use flake8-import-order
Use the flake8 plugin flake8-import-order to check import ordering. It
can do it automatically and don't need reviewers to check it.

Change-Id: I946457e9079ce0b54c7fe0ad554d024a1c61dce0
2017-02-16 09:46:21 -08:00
Jenkins
fd7f10b993 Merge "Configure and use SSL-related requests options" 2017-02-07 09:57:49 +00:00
Jenkins
b787b01f6c Merge "Remove compatibility with old bash-based introspection ramdisk" 2017-01-30 21:58:28 +00: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
Jenkins
2d21082cd5 Merge "Mock out get_wildcard_address" 2017-01-24 12:21:46 +00:00
Jenkins
465687940b Merge "Reboot and Poweroff fails with coreos IPA image" 2017-01-20 22:53:36 +00:00
Annie Lezil
20dc04e5e2 Reboot and Poweroff fails with coreos IPA image
The CoreOS IPA images do not support poweroff/reboot due to running in a
chroot. For this case, we fall back to forcing poweroff or reboot via
sysrq commands

Change-Id: I75d68b6308beba299d043e43a5fa1671b6ef3ada
Closes-Bug: #1628367
2017-01-20 12:55:12 -08:00
Derek Higgins
95956588c7 Mock out get_wildcard_address
In cases where unit tests are running in a env where IPv6 isn't enabled
it was returning the IPv4 wildcard address.

Change-Id: I0ebadafca70d9cddf761f2ef54726e0123af10f5
2017-01-20 12:17:01 +00:00
Jenkins
d691a726b3 Merge "Add IPv6 unit test for _get_route_source" 2017-01-19 22:34:21 +00:00
Jenkins
bbbea4601a Merge "iscsi: Listen for connections on both IPv4 and IPv6 ports" 2017-01-19 22:34:11 +00:00
Derek Higgins
256b233b4b Add IPv6 unit test for _get_route_source
Follow up from previous patch

Change-Id: Ic0286c4eac57f3ae06b237b700d9dbe95ea8b2c0
2017-01-19 15:24:17 +00:00
Derek Higgins
1c493c470a iscsi: Listen for connections on both IPv4 and IPv6 ports
Allow connections if deploying over a IPv6 network.

Change-Id: Ib5b97e960fcb30b9a37c5971e88d5251905f8113
Closes-Bug: #1650540
2017-01-19 15:24:17 +00:00
Jenkins
7680625994 Merge "Use sh instead of bash when installing grub" 2017-01-18 10:27:56 +00:00
Pavlo Shchelokovskyy
a5370d52cd Use sh instead of bash when installing grub
there is no guarantee that 'bash' is present in a user's image,
while 'sh' as system shell must be there.
As we do not use any bash-specific syntax (just starting commands in a
subshell) when installing the bootloader from chroot-ed user image,
let's be more supportive and use 'sh' instead of 'bash' for that.

Change-Id: I1fb82068b9c55da35166d8d2ecf9f0ba41356adb
Closes-Bug: #1657096
2017-01-17 13:57:49 +02:00
Cao Xuan Hoang
6997907b07 Removes unnecessary utf-8 encoding
The following files added utf-8 encoding but never used. So we can
removes them at all.

ironic_python_agent/extensions/image.py
ironic_python_agent/extensions/iscsi.py
ironic_python_agent/tests/unit/extensions/test_image.py
ironic_python_agent/tests/unit/extensions/test_iscsi.py

Change-Id: Ifc98faf025ee81f885ea58d9203037c6357ea7f2
2017-01-16 08:25:10 +07:00
Pavlo Shchelokovskyy
fdd11b54a5 Configure and use SSL-related requests options
This patch adds standard SSL options to IPA config and makes use of them
when making HTTP requests.

For now, a single set of certificates is used when needed.
In the future configuration can be expanded to allow per-service
certificates.

Besides, the 'insecure' option (defaults to False) can be overridden
through kernel command line parameter 'ipa-insecure'.
This will allow running IPA in CI-like environments with self-signed SSL
certificates.

Change-Id: I259d9b3caa9ba1dc3d7382f375b8e086a5348d80
Closes-Bug: #1642515
2017-01-13 11:33:44 +02:00
Derek Higgins
9f5f664080 Advertise the correct address when using IPv6
Parse the output of "ip route get $IP" taking
IPv6 into consideration. Also wrap the IP address
in square brackets if it is IPv6.

Change-Id: Ifc44e5aa3c5b814b6ceba04461bb68fe1d75c22b
Closes-Bug: #1650533
2017-01-11 11:00:56 +00:00
Dmitry Tantsur
10bff0a518 Remove compatibility with old bash-based introspection ramdisk
Inspector is using inventory directly, so we can remove the bits sending
processed network and scheduling properties.

Change-Id: I6c58bc3c5ea78fd2dbda82b38515f332ce2e8d4a
2017-01-09 14:10:47 +01:00
Jenkins
a6b09f2fa8 Merge "Use oslo_serialization.base64 to follow OpenStack Python3" 2017-01-02 16:57:44 +00:00