summaryrefslogtreecommitdiff
path: root/ironic_python_agent/tests/unit
Commit message (Collapse)AuthorAgeFilesLines
* Merge "fall back to PARTUUID if UUID not found."3.3.0Zuul2018-08-031-3/+22
|\
| * fall back to PARTUUID if UUID not found.Matthew Thode2018-07-311-3/+22
| | | | | | | | | | | | Change-Id: Icbf1fd8179658bd8bcd15f99aaaee796288dbf6f Story: 2002052 Task: 19714
* | Merge "Collect IPv6 address during introspection"Zuul2018-08-021-6/+18
|\ \
| * | Collect IPv6 address during introspectionzhengyong2018-07-241-6/+18
| |/ | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support to retrieve IPv6 address. A new field ``ipv6_address`` is added to NetworkInterface and store the assigned IPv6 address (if any). Co-Authored-By: Kaifeng Wang <kaifeng.w@gmail.com> Change-Id: Ia527a5aa48e3daf66d2be190e43935b38b3bd6f9 Closes-Bug: #1744064 Story: #1744064 Task: #11604
* | Install grub to PReP partition when prep_boot_part_uuid is providedMichael Turek2018-07-202-9/+95
|/ | | | | | | | | | | | | | | Installs the grub bootloader to the PreP Boot partition when the prep_boot_partition_uuid is provided. This is required when booting a partition image locally on ppc64* systems. This change also passes the cpu_arch along to work_on_disk so that the PReP partition is created when partitioning disks for local boot on ppc64* systems, Change-Id: I70667d43af962b357e6eeccba258f4fa5a91a09e Depends-On: I2bc9f13ec605de7b7b96d96a1a4edebee0af76dc Story: #1749057 Task: #22999
* Merge "Provide knob to disable ata secure erase"Zuul2018-06-291-0/+16
|\
| * Provide knob to disable ata secure eraseJulia Kreger2018-06-281-0/+16
| | | | | | | | | | | | | | | | | | | | | | We need to allow the operator to able to explicitly disable secure erase, in case it is problematic in their environment or hardware. Change-Id: I4c68efa65cdd7f88f54f8dd9a8bcbeee9e8124a8 Story: #2002546 Task: #22108
* | Refuse secure erase if ATA command does not workJulia Kreger2018-06-281-1/+114
|/ | | | | | | | | | | | | | | | Adds dependency upon smartmontools's binary smartctl to query the block devices via ATA mode which fails on pass-thru buses such as ATA over SCSI and ATA over USB, in an effort to prevent the initiation of ATA secure erase with one of these interfaces in place which may render the disk unreachable after security options are enabled for ATA Secure Erase or upon the Secure Erase command being sent to the Hard Disk. Change-Id: I7635a197eb000650e919fac386b38ac15ef17041 Story: #2002546 Task: #22109 Depends-On: Ibbfd168844524d91927bdd6e67d973e0bd519bf2
* Try to unlock failed device before proceedingJulia Kreger2018-06-181-2/+6
| | | | | | | | | | | | When a hard error has occured with secure erase, we should attempt an unlock of the device becuase the current mode can prevent disk IO. This may upset some things like raid controllers even if they are in a pass-through mode. Change-Id: I32e1d962fbbb4a305d5dbebea92ac48ebd9b67ca Story: #2002546 Task: #22107
* Merge "rework ATA secure erase"Zuul2018-05-171-21/+59
|\
| * rework ATA secure eraseWill Szumski2018-05-161-21/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | hdparm versions prior to 9.51 interpret the value, NULL, as a password with string value: "NULL". Example output of hdparm with NULL password: [root@localhost ~]# hdparm --user-master u --security-unlock NULL /dev/sda security_password="NULL" /dev/sda: Issuing SECURITY_UNLOCK command, password="NULL", user=user SECURITY_UNLOCK: Input/output error Example output of hdparm with "" as password: [root@localhost ~]# hdparm --user-master u --security-unlock "" /dev/sda security_password="" /dev/sda: Issuing SECURITY_UNLOCK command, password="", user=user Note the values of security_password in the output above. The output was observed on a CentOS 7 system, which ships hdparm 9.43 in the offical repositories. This change attempts to unlock the drive with the empty string if an unlock with NULL was unsucessful. Issuing a security-unlock will cause a state transition from SEC4 (security enabled, locked, not frozen) to SEC5 (security enabled, unlocked, not frozen). In order to check that a password unlock attempt was successful it makes sense to check that the drive is in the unlocked state (a necessary condition for SEC5). Only after all unlock attempts fail, do we consider the drive out of our control. The conditions to check the drive is in the right state have been adjusted to ensure that the drive is in the SEC5 state prior to issuing a secure erase. Previously, on the "recovery from previous fail" path, the security state was asserted to be "not enabled" after an unlock - this could never have been the case. A good overview of the ATA security states can be found here: http://www.admin-magazine.com/Archive/2014/19/Using-the-ATA-security-features-of-modern-hard-disks-and-SSDs Change-Id: Ic24b706a04ff6c08d750b9e3d79eb79eab2952ad Story: 2001762 Task: 12161 Story: 2001763 Task: 12162
* | Fix gate and bump CoreOS version to latest stable.Julia Kreger2018-05-101-2/+2
|/ | | | | | | | | | | | | | | | | | | | | | Increases the amount of ram for CoreOS IPA to 2GB as the base CoreOS image is now 310MB. Bumped CPU count for CoreOS runs to 2 CPUs as the concurrency helps boot times for the CoreOS ramdisk. Adds netbase, udev, and open-iscsi to debian jessie container as they are no longer present in the default container. Explicitly set path variable for execution in the debian container as udevadm is in /sbin, and we may not have /sbin on the path that is passed through to the chroot. Also fixed new pep8 test failures. Story: #1600228 Task: #16287 Change-Id: I488445dfd261b7bca322a0be7b4d8ca6105750a3
* GenericHardwareManager: get mac address using netifacesHamdy Khader2018-03-131-8/+43
| | | | Change-Id: Ie052c596b536325cbd3d26fe27e476a4b0b1981d
* mlnx hardware_manager: get mac address using netifacesMoshe Levi2018-03-111-48/+47
| | | | Change-Id: I62e4ca6afb0f8a256ddf9bbc48225fbb96f9e817
* Merge "Use lshw in place of dmidecode for the default hardware manager"Zuul2018-02-011-41/+132
|\
| * Use lshw in place of dmidecode for the default hardware managerMike Turek2018-01-301-41/+132
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently the generic hardware manager uses dmidecode to get the total physical memory and system details. This patch switches the generic hardware manager to use lshw, as it is capable of reading more than DMI [0]. This enables systems that do not support DMI to use the generic hardware manager, such as IBM Power systems. [0] https://github.com/lyonel/lshw/blob/master/README.md Closes-Bug: #1715790 Change-Id: Ie370331df6bb5ef131c5cb60f458877e2a7ad71a Depends-On: Idaf05b8efce28cd0cbf339cf693db4f55a693d9b
* | Follow-up patch for rescue extension for CoreOSShivanand Tendulker2018-01-301-1/+1
| | | | | | | | | | | | | | | | This patch addresses few minor comments in commit a659306272542dd38420cb118cc7b04b1e8cf377 Change-Id: Id5b48e3cc96c8807c471c947da3e233cebdf687e Related-Bug: #1526449
* | Execute error in _detect_cna_cardyuan liang2018-01-261-8/+9
|/ | | | | | A list type parameter pass to utils.execute will raise OSError. Change-Id: Ic5dd30f7e819e433d05bf9cc888902abe7a82def
* Merge "Do not try unmounting the EFI partition if it was not mounted"Zuul2017-12-151-0/+30
|\
| * Do not try unmounting the EFI partition if it was not mountedDmitry Tantsur2017-12-141-0/+30
| | | | | | | | | | | | | | | | | | If mounting the root partition fails for some reason, we try to unmount the EFI partition, which is not mounted at this point. This results in a new exception hiding the real failure. This change fixes it. Change-Id: I0ec636a361eda71b4149e4a7ba1538a9bbf6ec34 Closes-Bug: #1732932
* | Merge "Report /dev/disk/by-path on inspection followup"Zuul2017-12-141-15/+12
|\ \
| * | Report /dev/disk/by-path on inspection followupIlya Etingof2017-12-141-15/+12
| | | | | | | | | | | | | | | | | | | | | | | | This is the followup patch for commit d0a53149f82a3587515a4371f0f4cad8570dc715) fixing issues with the unit tests not addressed initially. Change-Id: I7889bf908bcb64b79bf303c6ae356fd3f4e94a83
* | | Merge "Include IPA Version during heartbeat"Zuul2017-12-131-3/+81
|\ \ \
| * | | Include IPA Version during heartbeatSam Betts2017-12-071-3/+81
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | In order for Ironic to know what parameters can be sent to IPA commands, Ironic needs to know which version of IPA it is talking to. This patch adds a new node heartbeat parameter agent_version which will carry the IPA version information to Ironic. Change-Id: I27e3311accf3a113a48a73df372ed46ff50c7e22 Partial-Bug: #1602265 Depends-On: I400adba5d908b657751a83971811e8586f46c673
* | | Merge "Catch OSError thrown when hexdump is missing"Zuul2017-12-121-0/+15
|\ \ \
| * | | Catch OSError thrown when hexdump is missingJulia Kreger2017-12-111-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change c5bf7b088f1ec776b788a81f2775e1b2577720e8 introduced a new requirement via a pre-existing ironic-lib method being called that utilizes hexdump. Hexdump is not always present and since we did not explicitly call it out as a new requirement, we should at least somewhat gracefully handle the exception. Change-Id: Id0223ef1417f6e419770ceb56b2a3b80c6118a85 Closes-Bug: #1732470
* | | | Merge "Rescue extension for CoreOS with DHCP tenant networks"Zuul2017-12-112-63/+204
|\ \ \ \
| * | | | Rescue extension for CoreOS with DHCP tenant networksMario Villaplana2017-11-062-63/+204
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for rescue mode with DHCP tenant networks in CoreOS. Applying network config from a configdrive is not yet supported but will be in a future patch. Co-Authored-By: Jay Faulkner <jay@jvf.cc> Co-Authored-By: Taku Izumi <izumi.taku@jp.fujitsu.com> Co-Authored-By: Annie Lezil <annie.lezil@gmail.com> Co-Authored-By: Aparna <aparnavtce@gmail.com> Co-Authored-By: Shivanand Tendulker <stendulker@gmail.com> Change-Id: I7898ff22800dedba73d7fbfb3801378867abe183 Partial-Bug: 1526449
* | | | | Merge "Update version of flake8-import-order package"Zuul2017-12-111-2/+1
|\ \ \ \ \
| * | | | | Update version of flake8-import-order packageJohn L. Villalovos2017-12-081-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use latest version of flake8-import-order package, like we do in openstack/ironic Fix two issues detected by new version. Change-Id: Idb8f0fd79c3d6b34611288f77948d042cd837806
* | | | | | Merge "Fix issue with double mocking of utils.execute functions"Zuul2017-12-082-21/+110
|\ \ \ \ \ \ | |/ / / / / |/| | | | |
| * | | | | Fix issue with double mocking of utils.execute functionsJohn L. Villalovos2017-12-012-21/+110
| | |_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | An issue was discovered if we mock an already mock-ed function. This was happening in our execute() detection code. Change it to not use a mock and instead a function. Add unit tests to show it works as intended. Change-Id: Ia116b355e7adb3cbfb8ae34f4d59bf527f2889bb
* | | | | [LLDP] Skip NICs that say they are ready but are unreadable.Sam Betts2017-11-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
* | | | 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
* | | Merge "Fix off-by-one error in warning"Zuul2017-11-131-9/+17
|\ \ \
| * | | Fix off-by-one error in warningRuby Loo2017-11-091-9/+17
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | This fixes an off-by-one error in a warning message. This is a follow-up to 3189c16a5e95ade468fa8bc37302eb9979f5a8c9. Change-Id: I89b56974c1b919f4c03498873d3ce9860d5644c5 Related-Bug: #1670916
* | | Use oslo_config.fixture in unit testsVasyl Saienko2017-11-091-0/+18
|/ / | | | | | | | | | | | | | | | | | | It provides cleaner per-tests config objects, with more options to configure the fixture. Also, allow overriding config fixture in particular test cases if needed. Change-Id: I2e9945b6168d97d7ee861924ac2f4ca5cd03dde2
* | Merge "Fix to return 'root_uuid' as part of command status"Zuul2017-10-251-13/+29
|\ \
| * | Fix to return 'root_uuid' as part of command statusShivanand Tendulker2017-10-241-13/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | IPA does not return 'root_uuid' as part of command status when provisioning of whole disk image is done using 'agent' deploy interface from ironic. This commit fixes the issue. Also updated Dockerfile to include package 'bsdmainutils' related to 'hexdump' binary. Change-Id: I89597fe4a704686fe31c064c3443fd8404a300e5 Partial-Bug: #1713916
* | | Merge "Improve the catching of calls to 'execute' related functions"Zuul2017-10-242-13/+30
|\ \ \
| * | | Improve the catching of calls to 'execute' related functionsJohn L. Villalovos2017-10-232-13/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Improve the catching of calls to 'execute' related functions in unit tests. Before we only caught calls to utils.execute(). Now we catch calls to: ironic_lib.utils.execute() processutils.execute() subprocess.call() subprocess.check_call() subprocess.check_output() utils.execute() Change-Id: If4720ebed00f15c2a19cb8badbe4dc3c808eeece
* | | | Merge "Have unit tests all derive from our base unit test class"3.0.0Zuul2017-10-2310-26/+26
|\ \ \ \ | |/ / /
| * | | Have unit tests all derive from our base unit test classJohn L. Villalovos2017-10-1810-26/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Have our unit tests derive from the base unit test class in ironic_python_agent/tests/unit/base: IronicAgentTest This is so if we add additional global common features to our base test class, all of our tests will get those common features. Change-Id: I5188112f06dcfda4f5b0fd41fa9b9dd270cde8d7
* | | | Unit test has incorrect mock orderRuby Loo2017-10-181-1/+1
|/ / / | | | | | | | | | | | | | | | | | | | | | Minor change to a unit test; the names of the mock arguments to the unit test method are not consistent with the actual ordering of the mock decorators. This fixes it. Change-Id: Id9e0dd1614703760b2fe143b2029f9bf6067420a
* | | Merge "Fix waiting for target disk to appear"Zuul2017-10-174-73/+98
|\ \ \
| * | | Fix waiting for target disk to appearLucas Alvares Gomes2017-10-164-73/+98
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Merge "Fix OSError catch"Zuul2017-10-171-0/+9
|\ \ \ | |/ / |/| |
| * | Fix OSError catchJulia Kreger2017-10-121-0/+9
| |/ | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Merge "Remove hard-coded path to grub binaries"Jenkins2017-09-261-16/+16
|\ \
| * | Remove hard-coded path to grub binariesVasyl Saienko2017-09-251-16/+16
| | | | | | | | | | | | | | | | | | | | | | | | Use PATH variable to find grub binaries. Closes-Bug: 1717255 Change-Id: Ic6a2bafdc87e33c4e1c4534fa355f995c824b945