summaryrefslogtreecommitdiff
path: root/ironic_python_agent/tests
Commit message (Collapse)AuthorAgeFilesLines
* Force immediate NTP time sync with chronyd at IPA startup7.0.2Arne Wiebalck2021-08-102-31/+8
| | | | | | | | | | | | | | | In order to make sure we have the correct time early, e.g. by the time we create a TLS certificate, this patch proposes to force an immediate NTP update when using chronyd. While the previous approach uses the passed NTP server as well, the update may happen only after chronyd has performed measurements (which may be too late). Story: #2009058 Task: #42843 Change-Id: I6edafe8edeb8549f324959e7a1ec175c3049a515 (cherry picked from commit 5531d5cee744f90ff24231a9ef467282b254adc2)
* Merge "Only mount the ESP if not yet mounted" into stable/wallabyZuul2021-06-281-6/+10
|\
| * Only mount the ESP if not yet mountedArne Wiebalck2021-06-251-6/+10
| | | | | | | | | | | | | | | | Check if the ESP is already mounted before attempting to mount it for the bootloader installation. Change-Id: Ifd738b2c5663f1a211d7e13b5ba386be631d8db1 (cherry picked from commit 27568204aeb7f063bf236ad7f2f8043db627baa9)
* | Coalesce heartbeatsDmitry Tantsur2021-06-251-6/+38
|/ | | | | | | | | | | | | | | | | | | The IPA sends heartbeats to the conductor periodically and when requested, e.g. at the end of asynchronous commands. In order to avoid to send such notifications in too quick succession, e.g. when two asynchronous commands finish at the same time or when the periodic heartbeat was just sent right before a command ended, this patch proposes to coalesce heartbeats which are close together timewise and send only one for all of them in a time interval of 5 seconds. Co-Authored-By: Arne Wiebalck <arne.wiebalck@cern.ch> Story: #2008983 Task: 42633 Change-Id: Idfbce44065e1e5a8b730b94741b2604c51f0ab14 (cherry picked from commit b605943796c24a174f0709b84170e0c6de7f4238)
* Utilize CSV file for EFI loader selectionJulia Kreger2021-06-111-4/+72
| | | | | | | | | | | | | | | | | | | | | | | Adds support to identify and utilize a CSV file to signal which bootloader to utilize, and set it when the OS is running as opposed to when EFI is running. This works around EFI loader potentially crashing some vendors hardware types when entry stored in the image does not match the EFI loader record which was utilzied to boot. Grub2+shim specifically specifically needs the CSV file name and entry label to match what the system was booted with in order to prevent the machine from potentially crashing. See https://storyboard.openstack.org/#!/story/2008962 and https://bugzilla.redhat.com/show_bug.cgi?id=1966129#c37 for more information. Change-Id: Ibf1ef4fe0764c0a6f1a39cb7eebc23ecc0ee177d Story: 2008962 Task: 42598 Co-Authored-By: Bob Fournier <bfournie@redhat.com> (cherry picked from commit 2fab70c36ba40a345a9dd01aeb5019681e567aa5)
* Make _get_efi_bootloaders return relative pathsSteve Baker2021-06-111-11/+11
| | | | | | | | | | | | | | | | To make this function useful for purposes other than efibootmgr entries, this change moves the path manipulation to _run_efibootmgr. This change also adds boot*.efi entries to BOOTLOADERS_EFI so that it includes every entry in the UEFI Spec 2.9[1] Table 3-2 UEFI Image Types. [1] https://uefi.org/sites/default/files/resources/UEFI_Spec_2_9_2021_03_18.pdf Story: 2008923 Task: 42521 Change-Id: Ibe02786609aa0de65115897d8f4a9b4f36c8aed2 (cherry picked from commit 10d18c41136cc645ee99d41acfb6031b9158e1fb)
* Merge "Software RAID: RAID the ESPs" into stable/wallabyZuul2021-06-011-36/+30
|\
| * Software RAID: RAID the ESPsArne Wiebalck2021-05-111-36/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For software RAID in UEFI mode, we create ESPs on all holder disks and copy the bootloader there. Since there is no mechanism to keep the ESPs in sync, e.g. on kernel upgrades or when kernel parameters are updated, the ESPs will get out of sync eventually. This may lead to a situation where a node boots with outdated parameters or does not have any of the installed kernels in the boot menu anymore. This change proposes to RAID the ESPs. While the UEFI firmware will find an ESP partition (one leg of the mirror), the node will see an md device and all subsequent updates will go to all member disks. Also, remove the source ESP after copying in order to avoid mount confusion (same UUID!). Story: #2008745 Task: #42103 Change-Id: I9078ef37f1e94382c645ae98ce724ac9ed87c287 (cherry picked from commit c2d04dc1566bb947d0e6afd040b82be55c925b11)
* | Fix NVMe Partition image on UEFIJulia Kreger2021-05-261-0/+39
|/ | | | | | | | | | | | | | | | | | | | | | | | The _manage_uefi code has a check where it attempts to just identify the precise partition number of the device, in order for configuration to be parsed and passed. However, the same code did not handle the existence of a `p1` partition instead of just a partition #1. This is because the device naming format is different with NVMe and Software RAID. Likely, this wasn't an issue with software raid due to how complex the code interaction is, but the docs also indicate to use only whole disk images in that case. This patch was pulled down my one RH's professional services folks who has confirmed it does indeed fix the issue at hand. This is noted as a public comment on the Red Hat bugzilla. https://bugzilla.redhat.com/show_bug.cgi?id=1954096 Story: 2008881 Task: 42426 Related: rhbz#1954096 Change-Id: Ie3bd49add9a57fabbcdcbae4b73309066b620d02 (cherry picked from commit fe825fa97ed1f3c9fa8b1461b63ab133fec20b72)
* Fix getting memory size in some lshw outputZane Bitter2021-04-302-0/+194
| | | | | | | | | | | | | | | | | | Due to a regression in lshw introduced by https://github.com/lyonel/lshw/pull/60, there are some versions in the wild that do not return sizes for memory banks <32GiB. In those cases, work around the problem by looking at the top-level size (if available) to find the total size. Previously we assumed that we only needed the top-level size when there was no list of memory banks. The issue is fixed upstream by https://github.com/lyonel/lshw/pull/65, but the erroneous patch is still present in the lshw-B.02.19.2-5.el8 package in CentOS 8.4 and 8.5. Change-Id: I6eb5981d28b9ae368239af0c1d0ec32ff79d95b3 Story: #2008865 Task: 42395 (cherry picked from commit ed791d97786f4ed37bf7b9f18eac8e2af46c3766)
* Always fall back to sysrq when power off failsDmitry Tantsur2021-04-291-3/+4
| | | | | | | | The line we're looking for is not there when IPA is in a container, at least for CentOS based containers. Just fall back to sysrq on errors. Change-Id: Ie4ee605ad9c6cda58808512a563247175859c71e (cherry picked from commit b395181b1b1381ff0802744807a981df8453bc40)
* Do not fail network interface collection on unsupported interface7.0.1Dmitry Tantsur2021-04-221-4/+7
| | | | | | | | Currently if one interface cannot be handled (e.g. it has empty MAC), the whole collection fails. Ignore unsupported interfaces instead. Change-Id: Ibdaad62b39c239d4f3fb3111c2fae9e31e877b28 (cherry picked from commit 1ab405b5095975c3cf1334477fd40f738f7105b8)
* Capture the early loggingJulia Kreger2021-04-081-0/+23
| | | | | | | | | | | | _early_log prints to stdout, which is fine in some cases, however in other cases it gets lost in the shuffle of process launch by things like systemd. Lets try to save everything, and re-log it so it is easy to debug early issues. Change-Id: I334a9073d17cccec4c669fae82edc3e388debc5c (cherry picked from commit df418984f037856813b6bc5e495ef602a6737ee3)
* Fix incorrect lsblk tag and add a virtual media jobDmitry Tantsur2021-03-301-14/+16
| | | | | | | | | | | Follow-up to 8dd6589e66d03e45e1d510601da9531a30842cff: PATH is not a valid lsblk tag, we need to use KNAME with -p flag. Also add a vmedia job to avoid breakages in the future. It's added non-voting because we have a deadlock with this change: https://review.opendev.org/c/openstack/ironic/+/783722 Change-Id: Ifffeac9c1c4d394526d655eaa14c9fe7bd3a1e5e
* Validate vmedia for vmedia usageJulia Kreger2021-03-291-45/+184
| | | | | | | | | | | | | | | | Virtual media devices based logic needs to be guarded from being used or considered based upon if the machine actually booted from virtual media, or not. At the same time, actual devices need to be checked in order to make sure they align with what we expect in order to prevent consideration of content which should not be leveraged. Change-Id: If2d5c6f4815c9e42798a2d96d59015e1b1dbd457 Story: 2008749 Task: 42108
* Refactor: use mounted from ironic-libDmitry Tantsur2021-03-231-158/+51
| | | | Change-Id: I0b597ddbc71c133abe6c0acfd8f49e3af4e896bb
* Fix root UUID for streamed partition imagesSteve Baker2021-03-191-1/+11
| | | | | | | | | | | | | | The root UUID changes after a streamed partition image is written to the block device, causing later deployment failure when assuming the old UUID. This change updates the root UUID after streaming the partition image is complete. This issue may have been missed in local testing because deploying the same image repeatedly will result in stable root UUID across runs. Change-Id: Ice4630c16fc216980488d1427f3b02e1b8a417fa
* Check the base device if the read-only file cannot be readBob Fournier2021-03-091-0/+20
| | | | | | | | | | | For some drives, the partition e.g. `/dev/sda1` will not have the 'ro' file which can result in a metadata erasure failure but the base device (`/dev/sda`) will have this file. Add an additional check for the base device. Change-Id: Ia01bdbf82cee6ce15fabdc42f9c23036df55b4c5 Story: 2008696 Task: 42004
* Remove default parameter from executeRiccardo Pittau2021-03-022-26/+14
| | | | | | | | | The param check_exit_code from the processutils extension execute has default already at [0] See: https://opendev.org/openstack/oslo.concurrency/src/branch/master/oslo_concurrency/processutils.py#L214 Change-Id: Iedff5325e0737556d5eb3da601c984ddfc633873
* Remove nvme-cli warning and delay on nvme-formatJacob Anders2021-03-021-2/+2
| | | | | | | | | | This change adds '-f' flag to nvme-cli calls during NVMe Secure Erase. This removes nvme-cli output warning that the device is about to be irreversibly deleted as well as the related 10 second delay which is pointlessly increasing NVMe cleaning time. Story: 2008290 Change-Id: I7b7b8b7d4f643b07d5c9dcf7ec35cf7ebedf44d1
* Merge "Use try_execute from ironic-lib"Zuul2021-03-011-35/+40
|\
| * Use try_execute from ironic-libRiccardo Pittau2021-02-251-35/+40
| | | | | | | | | | | | Also adapt unit tests Change-Id: I37d050877daabc9dc0a5821cf20a689652b26f34
* | Allow clean_configuration to run against full-device arraysMohammed Naser2021-02-272-0/+42
|/ | | | | | | | | | | | At the moment, it is not possible for Ironic to clean up a RAID array that is built from an entire device. This patch allows it to do so by overriding the behaviour of attempting to find the device name if the device names does not end with a number and is a real block device. Story: #2008663 Task: #41948 Change-Id: I66b0990acaec45b1635795563987b99f9fa04ac7
* Merge "New deploy step for injecting arbitrary files"Zuul2021-02-222-0/+452
|\
| * New deploy step for injecting arbitrary filesDmitry Tantsur2021-02-162-0/+452
| | | | | | | | | | | | | | | | | | This change adds a deploy step inject_files that adds a flexible way to inject files into the instance. Change-Id: I0e70a2cbc13744195c9493a48662e465ec010dbe Story: #2008611 Task: #41794
* | Merge "Add support for using NVMe specific cleaning"Zuul2021-02-192-0/+527
|\ \
| * | Add support for using NVMe specific cleaningJacob Anders2021-02-182-0/+527
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change adds support for utilising NVMe specific cleaning tools on supported devices. This will remove the neccessity of using shred to securely delete the contents of a NVMe drive and enable using nvme-cli tools instead, improving cleaning performance and reducing wear on the device. Story: 2008290 Task: 41168 Change-Id: I2f63db9b739e53699bd5f164b79640927bf757d7
* | | Move some raid specific functions to raid_utilsRiccardo Pittau2021-02-172-24/+124
|/ / | | | | | | | | | | | | To reduce size of the hardware module and separate the raid specific code in raid_utils, we move some functions and adapt the tests. Change-Id: I73f6cf118575b627e66727d88d5567377c1999a0
* | Remove samples from the hardware test moduleRiccardo Pittau2021-02-122-887/+905
|/ | | | | | | They take a lot of space and tehy're mainly static data. Move them to a separate module that can also be shared with other tests. Change-Id: I9c76c014430d524da7fa331c922976d283b870c3
* Fix error message with UEFI-incompatible imagesDmitry Tantsur2021-02-101-0/+10
| | | | | | | | It's somewhat confusing at the moment, since we're trying to find a UEFI partition by UUID "None". Don't search for partition if we don't know its UUID, and provide a better error message. Change-Id: Ief874084132797a445ddae8009264712a05facfd
* Merge "Use variable for lsblk columns device info"Zuul2021-02-081-31/+40
|\
| * Use variable for lsblk columns device infoRiccardo Pittau2021-02-031-31/+40
| | | | | | | | | | | | | | | | Adjusted unit tests accordingly. Also removed redundant parenthesis. Change-Id: I8e2cac5172f009d5204f83bd83e1f27cfd721f09
* | Mock tests to return bios boot modeIury Gregory Melo Ferreira2021-02-031-0/+3
|/ | | | | | | | When running IPA unit tests on machines configured with UEFI and GPT partition table, some tests will fail. Change-Id: I155a47242b526b8f243a5e94bc14da8431f1ab91
* Merge "Handle situation when a configdrive is already mounted"6.5.0Zuul2020-12-211-1/+53
|\
| * Handle situation when a configdrive is already mountedDmitry Tantsur2020-12-161-1/+53
| | | | | | | | | | | | | | Glean mounts the configdrive and does not unmount it afterwards. If a mount point already exists, just use it. Change-Id: Ia62279afbb9fd9770864942dc40629b69ae8f4ae
* | Fix boot mode detection for partition imagesJulia Kreger2020-12-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Previously, partition images were hard coded to be bios based as opposed to consulting all of the values AND the node itself before making the most appropriate determination. Now the agent utilises the internal helper to properly determine the boot mode when calling ironic-lib. Story: 2008070 Task: 41265 Change-Id: Id5eeda69d5b9de2b393af414472d57b0d4380c43
* | Merge "Add fstab pointer to EFI partition"Zuul2020-12-171-7/+238
|\ \
| * | Add fstab pointer to EFI partitionJulia Kreger2020-12-171-7/+238
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds support for the EFI partition to be appended to fstab so the filesystem can be automounted and EFI loader updated should the deployed operating system need to do so. This should enable bootloaders to be upgraded by linux based operating systems after the instance has been deployed when a partition image was utilized for the initial deployment. Change-Id: Iec28a8841cc01ec8b01a3f5cca070c934c7a2531 Story: 2008070 Task: 40754
* | | Merge "Prevent broken partition image UEFI deploys"Zuul2020-12-171-5/+474
|\ \ \ | |/ /
| * | Prevent broken partition image UEFI deploysJulia Kreger2020-12-141-5/+474
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Partition images can sometimes contain a /boot folder structure event he assets for EFI booting on that filesystem. Which is a good thing. The conundrum is that Ironic does not handle this properly and potentially replaces the bootloader in this sequence such that grub2-install is used instead of signed bootloader assets. As such, we should be preserving the assets and using them from a partition image much like we do when we have a wholedisk image and can identify the assets. Now we will preserve the EFI boot assets, copy them to the new EFI boot partition, and call the EFI setup methods to manage the EFI nvram. Note, this change also splits the logic path out that performs the end call of the EFI boot manager into a reusable method but does not retool all of the testing as it is intertwined in the install_grub2 testing. Also adds some additional debug logging, as much of the bootloader installation code has multiple fallback/cleanup points which makes it difficult to debug from logs. Story: 2008070 Task: 40753 Change-Id: If17d4b4c06df5504987e61a1fde6662e9acd6989
* | | Merge "Fix default disk label with partition images"Zuul2020-12-171-0/+58
|\ \ \ | |/ / | | / | |/ |/|
| * Fix default disk label with partition imagesJulia Kreger2020-12-141-0/+58
| | | | | | | | | | | | | | | | | | | | | | | | Partition images through the agent have the unfortunate side effect of being executed without full node context by default. Luckilly we've had a similar problem and cache the node. This patch changes the lookup from a default of msdos partitions to use the cached node object. Change-Id: I002816c9372fdf1cc32f3c67f420073551479fd9
* | Merge "Correctly decode error messages from ironic API"Zuul2020-12-161-5/+57
|\ \
| * | Correctly decode error messages from ironic APIDmitry Tantsur2020-12-071-5/+57
| | | | | | | | | | | | | | | | | | Knowing a status code is simply not enough for debugging. Change-Id: If1d3f182ab028948ff05aea7e8024d4e7bc3d53c
* | | Merge "Generate TLS certificates with validity time in the past"Zuul2020-12-151-0/+7
|\ \ \
| * | | Generate TLS certificates with validity time in the pastDmitry Tantsur2020-12-101-0/+7
| |/ / | | | | | | | | | | | | | | | | | | Otherwise a slight clock skew may prevent them from working, see e.g. https://bugzilla.redhat.com/show_bug.cgi?id=1906448. Change-Id: Icea103af06edef16c0dc4578877dc04cd6ec3b0c
* | | Merge "Copy any configuration from the virtual media"Zuul2020-12-141-74/+129
|\ \ \ | |_|/ |/| |
| * | Copy any configuration from the virtual mediaDmitry Tantsur2020-11-231-74/+129
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For ramdisk TLS (and other potential future enhancements) we need to be able to inject configuration and certificates into the ramdisk. Since we cannot pass files through kernel parameters, we need to put them on the generated ISO or (in the future) config drive. This change detects IPA configuration and copies it into the ramdisk early enough for any configuration files to get picked. Changed /dev/disk/by-label to blkid since the former may not exist on all ramdisks (e.g. tinyIPA). Change-Id: Ic64d7842a59795bbf02f194221dedc07c6b56e8c
* | | Option to enable bootloader config failure bypassJulia Kreger2020-12-101-0/+121
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some hardware is very well intentioned. However this intention can result in the UEFI NVRAM table being full which prevents us from adding new records to the table. We can't be sure what to delete, so in this case some operators just need the ability to tell ironic "it is okay if this fails, it will still work." The added ``ignore_bootloader_failure`` option adds this capability which can be set per-node either in the agent configuation via the ramdisk image, or in the pxe_append_params configuration parameter for the node itself with a ``ipa-ignore-bootloader-failure`` option in order to prevent the failure from being raised. Change-Id: If3c83fb2ea2025fce092d495a64f32077c70d2d6 Story: 2008386 Task: 41309
* | Merge "Bring up VLAN interfaces and include in introspection report"Zuul2020-12-021-0/+180
|\ \ | |/ |/|