summaryrefslogtreecommitdiff
path: root/ironic_python_agent/tests
Commit message (Collapse)AuthorAgeFilesLines
* [LLDP] Skip NICs that say they are ready but are unreadable.Sam Betts2018-05-281-0/+45
| | | | | | | | | | | | | | While listening for LLDP packets, if one of the sockets marks itself as ready to read then our code will try to read data from that socket, but if something goes wrong while reading that data then it causes IPA to raise out of the loop skipping any other of the other NICs which might have worked. This patch adds code to catch and LOG any exception that is raised while we are trying to read data from one of the sockets so that we can proceed to process all the NICs. Change-Id: I8546097f5ae23755a5fdb448902007a2d823b7bf Closes-Bug: #1665025 (cherry picked from commit b536fbba616d958e58b110c8f86ea569f8834d7c)
* Ignore IPv6 link local addressesDerek Higgins2017-11-211-0/+8
| | | | | | | | | | | | Prevent IPA from picking up the IPv6 link-local address as a callback_url in cases where it gets tried before other addressing methods havn't complete yet. In this scenario IPA sleeps for 10 seconds and then retries giving the nic a chance to configure its routable IP address. Change-Id: Ic53334c630180f0d77bb0231e548d2c44bfe55ca Closes-Bug: #1732692 (cherry picked from commit 214790d17e35edd48e1b18f3ceabba91859e3247)
* Fix waiting for target disk to appear2.2.2Lucas Alvares Gomes2017-10-175-74/+101
| | | | | | | | | | | | | | | | | | | | | | | | This patch is changing the _wait_for_disks() method behavior to wait to a specific disk if any device hints is specified. There are cases where the deployment might fail or succeed randomly depending on the order and time that the disks shows up. If no root device hints is specified, the method will just wait for any suitable disk to show up, like before. The _wait_for_disks call was made into a proper hardware manager method. It is now also called each time the cached node is updated, not only on start up. This is to ensure that we wait for the device, matching root device hints (which are part of the node). The loop was corrected to avoid redundant sleeps and warnings. Finally, this patch adds more logging around detecting the root device. Co-Authored-By: Dmitry Tantsur <dtantsur@redhat.com> Change-Id: I10ca70d6a390ed802505c0d10d440dfb52beb56c Closes-Bug: #1670916 (cherry picked from commit 3189c16a5e95ade468fa8bc37302eb9979f5a8c9)
* Remove hard-coded path to grub binariesVasyl Saienko2017-09-261-16/+16
| | | | | | | | | Use PATH variable to find grub binaries. Closes-Bug: 1717255 Change-Id: Ic6a2bafdc87e33c4e1c4534fa355f995c824b945 (cherry picked from commit db5272cfea9fa894675690d54b7d042cb3d01df3)
* Remove assumption that a valid IPMI channel cannot follow an invalid one2.2.1Dmitry Tantsur2017-09-121-0/+4
| | | | | | | | | 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 (cherry picked from commit d6ff5116f4a5586238d44a196ec89d844b151f9d)
* Merge "BMC can be configured using different lan channel"Jenkins2017-08-101-0/+34
|\
| * BMC can be configured using different lan channelMateusz Kowalski2017-08-091-0/+34
| | | | | | | | | | | | | | | | | | | | 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
* | Collect processor, memory and BIOS output of dmidecode - follow-upRamamani Yeleswarapu2017-07-271-0/+14
| | | | | | | | | | | | | | | | | | Fixes nits, modifies unit tests. This is a follow-up to commit c5544fb7a0d9d2a1481b3256c3587259368b599e. Change-Id: Ibca82cc6e32311b1ff0be7137d8392f63e12639b Closes-Bug: #1635057
* | Merge "Collect processor, memory and BIOS output of dmidecode"Jenkins2017-07-241-0/+681
|\ \ | |/ |/|
| * Collect processor, memory and BIOS output of dmidecodeRamamani Yeleswarapu2017-06-281-0/+681
| | | | | | | | | | | | | | | | | | | | | | 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
* | Remove usage of parameter enforce_typeChangBo Guo(gcb)2017-06-143-19/+12
|/ | | | | | | | | | | | 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
* Merge "NUMA-topology collector"Jenkins2017-05-221-0/+350
|\
| * NUMA-topology collectorJaganathan Palanisamy2017-05-161-0/+350
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge "Collect NIC name given by BIOS"Jenkins2017-05-222-10/+114
|\ \
| * | Collect NIC name given by BIOSAnnie Lezil2017-05-182-10/+114
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Replace assertRaisesRegexp with assertRaisesRegexLuong Anh Tuan2017-05-191-2/+2
|/ | | | | | | | | 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
* Merge "Remove unused function _configdrive_location"Jenkins2017-05-161-8/+0
|\
| * Remove unused function _configdrive_locationvmud2132017-05-111-8/+0
| | | | | | | | | | | | | | This function is never used and can be removed safely. Change-Id: Ied7b4984185ea170d33cb57010de89edeaaaeec5 Closes-Bug: #1690135
* | Merge "Prevent tests' unmocked access to utils.execute()"Jenkins2017-05-1512-47/+113
|\ \ | |/ |/|
| * Prevent tests' unmocked access to utils.execute()Julian Edwards2017-05-1512-47/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Set valid inspection_dhcp_wait_timeout value in testsJavier Pena2017-04-251-4/+9
|/ | | | | | | | | | | | | 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
* Merge "Add missing 'autospec' argument to mock.patch"Jenkins2017-03-2014-250/+286
|\
| * Add missing 'autospec' argument to mock.patchJohn L. Villalovos2017-03-1914-250/+286
| | | | | | | | | | | | | | | | | | 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
* | flake8: Specify 'ironic_python_agent' as name of appJohn L. Villalovos2017-03-162-3/+2
|/ | | | | | | | 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
* Merge "Fix logs encoding in py3"Jenkins2017-03-141-0/+2
|\
| * Fix logs encoding in py3zackchen2017-03-141-0/+2
| | | | | | | | | | | | | | | | | | 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
* | Correct failure message output when downloadingGalyna Zholtkevych2017-03-101-0/+18
|/ | | | | | | | | 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
* Use flake8-import-orderJohn L. Villalovos2017-02-163-3/+3
| | | | | | | 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
* Merge "Configure and use SSL-related requests options"Jenkins2017-02-073-0/+38
|\
| * Configure and use SSL-related requests optionsPavlo Shchelokovskyy2017-01-133-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Merge "Remove compatibility with old bash-based introspection ramdisk"Jenkins2017-01-301-79/+2
|\ \
| * | Remove compatibility with old bash-based introspection ramdiskDmitry Tantsur2017-01-091-79/+2
| | | | | | | | | | | | | | | | | | | | | Inspector is using inventory directly, so we can remove the bits sending processed network and scheduling properties. Change-Id: I6c58bc3c5ea78fd2dbda82b38515f332ce2e8d4a
* | | Remove support for older psutil versionsJay Faulkner2017-01-261-12/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Support psutil 5.0.1Mario Villaplana2017-01-241-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Merge "Mock out get_wildcard_address"Jenkins2017-01-241-5/+13
|\ \ \
| * | | Mock out get_wildcard_addressDerek Higgins2017-01-201-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | Merge "Reboot and Poweroff fails with coreos IPA image"Jenkins2017-01-201-3/+32
|\ \ \ \ | |/ / / |/| | |
| * | | Reboot and Poweroff fails with coreos IPA imageAnnie Lezil2017-01-201-3/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | Merge "Add IPv6 unit test for _get_route_source"Jenkins2017-01-191-1/+9
|\ \ \ \
| * | | | Add IPv6 unit test for _get_route_sourceDerek Higgins2017-01-191-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Follow up from previous patch Change-Id: Ic0286c4eac57f3ae06b237b700d9dbe95ea8b2c0
* | | | | Merge "iscsi: Listen for connections on both IPv4 and IPv6 ports"Jenkins2017-01-191-2/+26
|\ \ \ \ \ | |/ / / /
| * | | | iscsi: Listen for connections on both IPv4 and IPv6 portsDerek Higgins2017-01-191-2/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow connections if deploying over a IPv6 network. Change-Id: Ib5b97e960fcb30b9a37c5971e88d5251905f8113 Closes-Bug: #1650540
* | | | | Merge "Agent: Listen for connections on both IPv4 and IPv6 ports"Jenkins2017-01-191-1/+3
|\ \ \ \ \ | |/ / / /
| * | | | Agent: Listen for connections on both IPv4 and IPv6 portsDerek Higgins2017-01-191-1/+3
| | |_|/ | |/| | | | | | | | | | | | | | | | | | | | | | Allow connections if deploying over a IPv6 network. Change-Id: Ied2f6be4aa4d1a70524df1df3506e596f6926e5b Closes-Bug: #1650539
* | | | Merge "Use sh instead of bash when installing grub"Jenkins2017-01-181-8/+8
|\ \ \ \
| * | | | Use sh instead of bash when installing grubPavlo Shchelokovskyy2017-01-171-8/+8
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | Removes unnecessary utf-8 encodingCao Xuan Hoang2017-01-162-4/+0
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Advertise the correct address when using IPv6Derek Higgins2017-01-113-0/+69
| |/ |/| | | | | | | | | | | | | | | 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
* | Merge "Use oslo_serialization.base64 to follow OpenStack Python3"Jenkins2017-01-021-2/+2
|\ \
| * | Use oslo_serialization.base64 to follow OpenStack Python3Luong Anh Tuan2016-12-161-2/+2
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch replaces python standard base64 library call to oslo_serialization.base64 to follow OpenStack Python3 porting standard [1]. Use base64 encoding takes 8-bit binary byte data and encodes it. On Python3, A string is a sequence of Unicode characters thus base64 has no idea what to do with Unicode data, it's not 8-bit[2]. We use oslo_serialization.base64 for both python2 and python3. [1] https://wiki.openstack.org/wiki/Python3 [2] http://stackoverflow.com/questions/8908287/base64-encoding-in-python-3 Change-Id: I1dafe878a71f37d223eaf58ea8e2e8c6b4422a14