summaryrefslogtreecommitdiff
path: root/ironic_python_agent
Commit message (Collapse)AuthorAgeFilesLines
* Skip read-only devices with metadata erase3.6.3Julia Kreger2020-02-052-0/+65
| | | | | | | | | | | | | | | | | | | | | | | | | HPE "Virtual Install Devices" appear as read-only block devices, and may... or may not be visible depending on the bios configuration state. These devices can no longer be disabled from the bios settings so the simplest course of action seems to be that we should handle the existence of a read-only device. In the event of secure erase, this is treated as a hard failure case and a driver_internal_info flag has been added to enable a future bypass method for knowledgable operators. Backport note: the unit tests have been modified to account for Python 2 Conflicts: ironic_python_agent/hardware.py ironic_python_agent/tests/unit/test_hardware.py Change-Id: Ief8b360d11e654d8fae3a04a2a9f8d474a06e167 Story: 2007229 Task: 38502 (cherry picked from commit cd7b2693f873bde72706f8b6ab8c1f21e68f0fd1)
* Avoid grub2-install when on UEFI boot modeIury Gregory Melo Ferreira2020-01-224-13/+562
| | | | | | | | | | | | | | | | | | This patch changes the workflow for whole disk images when using uefi. If we can identify the bootloader and it's valid we can update using efibootmgr since grub2-install have problems specially on secure boot mode. We also updated the regex to search for the uefi partition on the disk, since in some cases the parted command output can be without the FS for the partition with esp Flag. Adds the efibootmgr and efivar to tinyipa (since ipa-builder is not used in stable/train) Change-Id: I7167e71e5d2352a045565289b200e5530d0ba11d Story: #2006847 Task: #37435 (cherry picked from commit b6210be196fea271b2c49f89d3e1638517c1198c)
* Search for efi partitionIury Gregory Melo Ferreira2020-01-222-0/+70
| | | | | | | | | | | | | | This patch adds a function that will be responsible to identify the efi partition on a give device, this is necessary on the Software Raid scenario and when installing bootloader. Conflicts: ironic_python_agent/tests/unit/test_utils.py ironic_python_agent/utils.py Change-Id: I5f326db2d37b2a15090ec84e477e63f7d92e7447 Co-Authored-By: Raphael Glon <raphael.glon@corp.ovh.com> (cherry picked from commit 966356e58c786fab1b176767615c481d449076a2)
* Fix compatibility with Pint 0.5Dmitry Tantsur2019-09-251-1/+1
| | | | | | | Conversion from Quantity to int/long was added only in 0.5.2. Change-Id: I23f93d29a0624b77f4624c6af530971eb6a4c01b (cherry picked from commit 386654f602c86495515811dd741652a3b0292fd3)
* Merge "Stop logging lshw output, collect it with other logs instead" into ↵3.6.2Zuul2019-07-033-5/+8
|\ | | | | | | stable/stein
| * Stop logging lshw output, collect it with other logs insteadDmitry Tantsur2019-06-183-5/+8
| | | | | | | | | | | | | | | | | | | | The lshw output is huge even on virtual machines, and it pollutes the debug logging. This change silences it. Instead, the lshw output is collected as part of the ramdisk logs. Depends-On: https://review.opendev.org/#/c/665635/ Change-Id: I6a3015b2d8d09f6f48b5cbd39dc84bd75b72f909 (cherry picked from commit 94048fe97e93af3ad6902c3c1aa4ec5d92b41747)
* | Correct formatting of a warning when lshw cannot be runDmitry Tantsur2019-06-271-1/+1
|/ | | | | Change-Id: I7c55aee4b3b52cb414a595cf548e1f22e954f619 (cherry picked from commit 69064a8610134f7e6777083375487f15f7dbbc7b)
* Merge "Add more channel number for detecting BMC IP address" into stable/stein3.6.1Zuul2019-05-211-3/+4
|\
| * Add more channel number for detecting BMC IP addressDongcan Ye2019-05-081-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | IPMI SPEC[1] assignment channel number 1-11 for vendors implementation(We an search "Channel Numbers" in section 6.3). We met an baremetal product, like H3C, use number 8 as LAN channel. Current code limit channel number to 1~7, I think this can increase to 1~11. [1] https://www.intel.com/content/dam/www/public/us/en/documents/product-briefs/ipmi-second-gen-interface-spec-v2-rev1-1.pdf Change-Id: I63a6ff91d702b990ef09da13e6e2e269e7274cce Task: 30654 Story: 2005528 (cherry picked from commit 66d3c8e453a58c01740581079045e9b4368c4bde)
* | Merge "Ironic python agent does not extract correct available memory" into ↵Zuul2019-05-172-12/+225
|\ \ | | | | | | | | | stable/stein
| * | Ironic python agent does not extract correct available memoryUros Orozel2019-04-162-12/+225
| |/ | | | | | | | | | | | | | | | | This patch fixes parsing of memory class output of lshw output. Task: 30201 Story: 2005308 Change-Id: I0e7ff9f86a266d2f798457136fed0100c78569e2 (cherry picked from commit d8018b9f35172b22475984a921fadd439c5239cc)
* | Bind mount /run into chroot when installing grubDerek Higgins2019-05-022-1/+17
|/ | | | | | | | | | | | | | | grub-mkconfig runs a lvs command that attempts to access /run/lvm once for each block device, currently it times out after 10 seconds for each device and moves on. Multiple 10 second delays become a problem (causing IPA API timeouts) when multiple block devices are present. Bind mounting in /run avoids the delay and the timeouts. Task: 30616 Story: 2005507 Change-Id: Iae8b7808a35bff121f64971aadd4bd36b5f5bb71 (cherry picked from commit 9c35f0279209ce233a7562f2d9310ded1e0edba5)
* Allow image checksum to be a URLDmitry Tantsur2019-02-253-34/+181
| | | | | | | | | We allow image_source to be a URL, let us also support URLs for checksums. This change copies handling of multi-file checksum files from metalsmith. Change-Id: Ie4d7e5c79b76bdd72d50eeb384cf10519278a80c Story: #2005061 Task: #29605
* Merge "Add secondary sorting by name when guessing root disk"Zuul2019-02-133-6/+71
|\
| * Add secondary sorting by name when guessing root diskArne Wiebalck2019-02-113-6/+71
| | | | | | | | | | | | | | | | | | | | | | As some BIOSes try to boot only from the "first" disk, Ironic should order potential disks not only by size, but also by name. This patch proposes to add secondary sorting by device name when identifying the root disk. Change-Id: I4017c839eeb9d00d2b4ad5b90e4e9b65b74296c7 Story: #2004976 Task: #29434
* | Making ironic-python-agent able to stop with python 3.xRiccardo Pittau2019-02-042-2/+2
|/ | | | | | | | | | | | | | | The agent stop function will write a byte string 'a' to the pipe as a signal for the run function to end process. The run function is expecting a literal string. In python 2.x the byte string will automatically be converted to literal, while python 3.x won't do the conversion, causing the process to never stop. This patch will fix that behavior, allowing the IPA to correctly stop using python 3.x. Story: 2004928 Task: 29308 Change-Id: Iad16e8bed2436d961dea8ddaec1c2724225b4097
* Merge "Replacing the HTTP protocal with HTTPS"Zuul2019-01-111-1/+1
|\
| * Replacing the HTTP protocal with HTTPSzhangshj2018-12-251-1/+1
| | | | | | | | Change-Id: I9791b6781158c0ddebda636daeea39665b483dd6
* | Merge "Attempt to read the partition table after writing an image"Zuul2019-01-042-3/+116
|\ \ | |/ |/|
| * Attempt to read the partition table after writing an imageSam Betts2018-11-192-3/+116
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds code that tries to read the partition table after we've successfully written an image to make sure the image that we wrote has a valid partition table so we can more easily guarantee that what we've written is bootable and not just junk. Without a valid partition table writing a config drive will fail for whole disk images. Co-Authored-By: Dmitry Tantsur <dtantsur@redhat.com> Change-Id: I5cfd8c433a4db3e0d2d5086250e629d16234b7a4 Story: 2001760 Task: 12159
* | Allow erasing metadata from disk partitionsCorey Wright2018-11-132-25/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | Modify the metadata erasing call chain to retrieve a list of devices that includes partitions in addition to disks so it can erase metadata from all of them, otherwise incidentally recreating disk partitions causes the Linux kernel to discover and automatically recreate some types of storage entities (eg LVM PVs, VGs, & LVs, RAID members & devices). Change-Id: If8f47a083966051856439e3291a6872929b93e3b Story: #2003673 Task: #26192
* | Merge "Fix multi-device behavior"Zuul2018-11-122-13/+109
|\ \ | |/ |/|
| * Fix multi-device behaviorJulia Kreger2018-09-242-13/+109
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ATARAID is functionally a version of software RAID where the setup is managed by the controller and the Operating System takes over managing the RAID after boot. Most commonly this is found for mirrored boot devices. Prior to this patch, we were looking for non-dependent items (i.e. base block devices), with a type of disk. Now we will permit the "disk" to be added to the list if lsblk indicates that it is a type containing "raid". The lsblk results should not change as we explicitly look for disk objects. Change-Id: Ia4a03b33cc06ce42e1bc33026683c28b31901cb7 Story: #2003445 Task: #24647
* | Merge "Allow streaming raw partition images"3.4.0Zuul2018-10-262-13/+49
|\ \
| * | Allow streaming raw partition imagesDmitry Tantsur2018-10-172-13/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | Currently we support streaming raw whole disk images, but not partition ones. This change enables it. Change-Id: Ie95102aa3f2054a6b429f3d3e0926e90923c5faf Story: #2003809 Task: #26558
* | | Follow up to parallel disk erasureKaifeng Wang2018-10-241-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | Improve test to verify apply_async is called twice as expected. Story: 1546949 Task: 11548 Change-Id: I41736dfb2932dd0036bbc4cbc51929bf61a16569
* | | Merge "Parallel erase disk devices"Zuul2018-10-222-5/+84
|\ \ \
| * | | Parallel erase disk devicesZhenguo Niu2018-10-222-5/+84
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently we erase the disks one by one, which takes a long time to finish, this patch adds support to the IPA so that it can erase disks in parallel if told so. Story: 1546949 Task: 11548 Co-Authored-By: yuan liang <leetpy2@gmail.com> Co-Authored-By: Kaifeng Wang <kaifeng.w@gmail.com> Change-Id: If5cfb6ec000a654d07103c4b378d4c135249e238
* | | Merge "Enhanced checksum support"Zuul2018-10-202-41/+146
|\ \ \
| * | | Enhanced checksum supportKaifeng Wang2018-10-152-41/+146
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds enhanced checksum support to IPA, when os_hash_algo and os_hash_value are passed in via image_info, it will be used to calculate image checksum and verification. In other cases, the old md5 checksum is used. Change-Id: I1d2f33e7059910326b4ac3f7786543b333a93a5a Story: 2003938 Task: 26846
* | | Fix BMC IP address detection on CoreOS imagesPierre Riteau2018-10-191-1/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On CoreOS images, IPA runs in a Debian Jessie chroot which uses mawk as its default awk implementation. However, mawk doesn't support POSIX character classes such as [:space:], which means get_bmc_address() fails to parse the BMC IP address from the output of ipmitool. This patch replaces the use of [[:space:]] by [ \t] which is equivalent for the purpose of parsing the output of ipmitool. Note that matching on tab characters is not strictly required as the packaged version of ipmitool only uses space characters, but is left in case tabs are used in other versions. Change-Id: I0e3306a4d4584ca28e03608e9f7270b770960a39 Story: #2004121 Task: #27571
* | Replace assertEqual(True/False, expr) with assertTrue/assertFalse in testsTao Li2018-09-182-6/+6
| | | | | | | | | | | | | | | | | | In some cases, If the result of expr is a boolen value, we shoud use assertTrue/assertFalse to instead. Beacause it is clear and simple. Change-Id: Ie61369f6335a90b09bb24192282d33da5272c13f Story: #2003785 Task: #26490
* | Clear GPT and MBR headers with dd to avoid sgdisk CRC errorsGiulio Fidente2018-08-081-1/+7
|/ | | | | | | | | | This change adds a dd before the existing sgdisk -Z command to workaround CRC verification errors. Change-Id: Ia1ac4e1c0faf14ad4bb11c2a1c796c93ca8cb5e3 Closes-Bug: #1737556 Story: 1737556 Task: 11496
* Merge "fall back to PARTUUID if UUID not found."3.3.0Zuul2018-08-032-4/+28
|\
| * fall back to PARTUUID if UUID not found.Matthew Thode2018-07-312-4/+28
| | | | | | | | | | | | Change-Id: Icbf1fd8179658bd8bcd15f99aaaee796288dbf6f Story: 2002052 Task: 19714
* | Merge "Collect IPv6 address during introspection"Zuul2018-08-023-14/+46
|\ \
| * | Collect IPv6 address during introspectionzhengyong2018-07-243-14/+46
| |/ | | | | | | | | | | | | | | | | | | | | | | | | 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-204-13/+113
|/ | | | | | | | | | | | | | | 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-292-3/+20
|\
| * Provide knob to disable ata secure eraseJulia Kreger2018-06-282-3/+20
| | | | | | | | | | | | | | | | | | | | | | 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-282-2/+152
|/ | | | | | | | | | | | | | | | 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-182-22/+37
| | | | | | | | | | | | 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
* Add min/max values to integer config optionsBill Dodd2018-05-231-12/+20
| | | | | | | | | | | | | | None of the existing ironic-python-agent integer config options included min or max values. Added appropriate min/max values for the integer config options. Two of the integer options are for ports (listen_port and advertise_port). These were changed to use the more appropriate oslo_config cfg.PortOpt instead of cfg.IntOpt. PortOpt has the proper min and max values built in. Change-Id: I98709a45d099aea62c9973beb6817591cb445a9c Story: 1731950
* Merge "write byte objects when using os.write"Zuul2018-05-181-2/+2
|\
| * write byte objects when using os.writeMatthew Thode2018-05-171-2/+2
| | | | | | | | | | | | Change-Id: I184a9d0bf4a0ba0776d519b3a3b9ccd39151b4ae Story: 2002052 Task: 19713
* | Merge "Fix for fatal error when GPT was used and only MBR was cleaned"Zuul2018-05-181-1/+1
|\ \
| * | Fix for fatal error when GPT was used and only MBR was cleanedOlivier Bourdon2018-05-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | You can generate this error if after having provisioned a node using GPT partitioning, you clean its MBR using say dd if=/dev/zero bs=1024 count=1 of=/dev/sda and then cleanup all Ironic/Bifrost informations to get it reprovisioned. In this case sgdisk -Z returns an error and last_error field in Ironic contains: Error writing image to device: Writing image to device /dev/sda failed with exit code 2 Caution: invalid main GPT header, but valid backup; regenerating main header\nfrom backup!\n \nInvalid partition data!\ Change-Id: Ib617737fff5e40cb376edda0232e0726d9c71231
* | | Merge "rework ATA secure erase"Zuul2018-05-172-47/+105
|\ \ \ | |/ / |/| |
| * | rework ATA secure eraseWill Szumski2018-05-162-47/+105
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-107-14/+16
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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