From 8adfcc65c6a0b8d8b22f408005dcff4e5d4dd526 Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Thu, 24 Sep 2020 10:08:35 +0200 Subject: [PATCH] Add an element to install python-hardware Requires returning EPEL support because of some dependencies. Co-Authored-By: Mark Goddard Co-Authored-By: Will Szumski Change-Id: I8da33dabda34e626baf6e7895fc450973d0a8fef --- dib/extra-hardware/README.rst | 21 +++++++++++++++++++ dib/extra-hardware/element-deps | 5 +++++ .../package-installs-extra-hardware | 1 + .../80-extra-hardware-install | 21 +++++++++++++++++++ dib/extra-hardware/package-installs.yaml | 10 +++++++++ dib/extra-hardware/pkg-map | 17 +++++++++++++++ .../environment.d/20-disable-epel.bash | 4 ---- .../extra-hardware-73e3c9b5a0143bfa.yaml | 5 +++++ zuul.d/ironic-python-agent-builder-jobs.yaml | 6 ++++++ zuul.d/project.yaml | 2 ++ 10 files changed, 88 insertions(+), 4 deletions(-) create mode 100644 dib/extra-hardware/README.rst create mode 100644 dib/extra-hardware/element-deps create mode 100644 dib/extra-hardware/install.d/extra-hardware-package-install/package-installs-extra-hardware create mode 100755 dib/extra-hardware/install.d/extra-hardware-source-install/80-extra-hardware-install create mode 100644 dib/extra-hardware/package-installs.yaml create mode 100644 dib/extra-hardware/pkg-map delete mode 100644 dib/ironic-python-agent-ramdisk/environment.d/20-disable-epel.bash create mode 100644 releasenotes/notes/extra-hardware-73e3c9b5a0143bfa.yaml diff --git a/dib/extra-hardware/README.rst b/dib/extra-hardware/README.rst new file mode 100644 index 0000000..00d7c85 --- /dev/null +++ b/dib/extra-hardware/README.rst @@ -0,0 +1,21 @@ +======================================== +Ironic Python Agent (IPA) Extra Hardware +======================================== + +This element adds the `hardware `_ +python package to the Ironic Python Agent (IPA) ramdisk. It also installs +several package dependencies of the ``hardware`` module. + +The ``hardware`` package provides improved hardware introspection capabilities +and supports benchmarking. This functionality may be enabled by adding the +``extra-hardware`` collector in the ``[DEFAULT] inspection_collectors`` option +or the ``ipa-inspection-collectors`` kernel command line argument. + +The following environment variables may be set to configure the element when +doing a source-based installation: + +* ``DIB_IPA_HARDWARE_PACKAGE`` the full ``hardware`` Python package descriptor + to use. If unset, ``DIB_IPA_HARDWARE_VERSION`` will be used. +* ``DIB_IPA_HARDWARE_VERSION`` the version of the ``hardware`` package to + install when ``DIB_IPA_HARDWARE_PACKAGE`` is unset. If unset, the latest + version will be installed. diff --git a/dib/extra-hardware/element-deps b/dib/extra-hardware/element-deps new file mode 100644 index 0000000..2d9e7f5 --- /dev/null +++ b/dib/extra-hardware/element-deps @@ -0,0 +1,5 @@ +epel +install-types +ironic-python-agent-ramdisk +package-installs +pkg-map diff --git a/dib/extra-hardware/install.d/extra-hardware-package-install/package-installs-extra-hardware b/dib/extra-hardware/install.d/extra-hardware-package-install/package-installs-extra-hardware new file mode 100644 index 0000000..09243b8 --- /dev/null +++ b/dib/extra-hardware/install.d/extra-hardware-package-install/package-installs-extra-hardware @@ -0,0 +1 @@ +python-hardware diff --git a/dib/extra-hardware/install.d/extra-hardware-source-install/80-extra-hardware-install b/dib/extra-hardware/install.d/extra-hardware-source-install/80-extra-hardware-install new file mode 100755 index 0000000..07e7068 --- /dev/null +++ b/dib/extra-hardware/install.d/extra-hardware-source-install/80-extra-hardware-install @@ -0,0 +1,21 @@ +#!/bin/bash + +if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then + set -x +fi +set -eu +set -o pipefail + +export LC_ALL=C.UTF-8 + +VENVDIR=/opt/ironic-python-agent +UPPER_CONSTRAINTS=/tmp/requirements/upper-constraints.txt +PACKAGE=${DIB_IPA_HARDWARE_PACKAGE:-hardware${DIB_IPA_HARDWARE_VERSION:+==}${DIB_IPA_HARDWARE_VERSION:-}} + +$VENVDIR/bin/pip install -c "$UPPER_CONSTRAINTS" "$PACKAGE" + +# Because the ironic-python-agent systemd unit does not activate the virtualenv +# before executing the ironic-python-agent script, the PATH is not updated to +# point to the bin directory in the virtual environment. We add this symlink so +# that ironic-python-agent sees the hardware-detect tool in its PATH. +ln -s $VENVDIR/bin/hardware-detect /usr/local/bin/hardware-detect diff --git a/dib/extra-hardware/package-installs.yaml b/dib/extra-hardware/package-installs.yaml new file mode 100644 index 0000000..12029e9 --- /dev/null +++ b/dib/extra-hardware/package-installs.yaml @@ -0,0 +1,10 @@ +biosdevname: +ethtool: +fio: +hdparm: +infiniband-diags: +lldpad: +pciutils: +sdparm: +smartmontools: +sysbench: diff --git a/dib/extra-hardware/pkg-map b/dib/extra-hardware/pkg-map new file mode 100644 index 0000000..f2fa654 --- /dev/null +++ b/dib/extra-hardware/pkg-map @@ -0,0 +1,17 @@ +{ + "release": { + "rhel": { + "8": { + "python-hardware": "python3-hardware-detect" + } + }, + "centos": { + "8": { + "python-hardware": "python3-hardware-detect" + } + } + }, + "default": { + "python-hardware": "python-hardware" + } +} diff --git a/dib/ironic-python-agent-ramdisk/environment.d/20-disable-epel.bash b/dib/ironic-python-agent-ramdisk/environment.d/20-disable-epel.bash deleted file mode 100644 index b9923ee..0000000 --- a/dib/ironic-python-agent-ramdisk/environment.d/20-disable-epel.bash +++ /dev/null @@ -1,4 +0,0 @@ -if [[ "$DISTRO_NAME" == "centos" ]] && [[ "$DIB_RELEASE" == 8 ]]; then - # Disable EPEL unless enabled explicitly - export DIB_EPEL_DISABLED=${DIB_EPEL_DISABLED:-1} -fi diff --git a/releasenotes/notes/extra-hardware-73e3c9b5a0143bfa.yaml b/releasenotes/notes/extra-hardware-73e3c9b5a0143bfa.yaml new file mode 100644 index 0000000..04d78f5 --- /dev/null +++ b/releasenotes/notes/extra-hardware-73e3c9b5a0143bfa.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + Adds a new element ``extra-hardware`` for configuring extra hardware + collection in the ramdisk. diff --git a/zuul.d/ironic-python-agent-builder-jobs.yaml b/zuul.d/ironic-python-agent-builder-jobs.yaml index 675e515..f6b839d 100644 --- a/zuul.d/ironic-python-agent-builder-jobs.yaml +++ b/zuul.d/ironic-python-agent-builder-jobs.yaml @@ -100,6 +100,12 @@ image_distro: 'centos-minimal' image_release: 8 +- job: + name: ironic-python-agent-check-image-dib-centos8-extra + parent: ironic-python-agent-check-image-dib-centos8 + vars: + extra_elements: ["extra-hardware"] + - job: name: ironic-python-agent-check-image-dib-fedora parent: ironic-python-agent-check-image-base diff --git a/zuul.d/project.yaml b/zuul.d/project.yaml index 7eebd52..cd50a26 100644 --- a/zuul.d/project.yaml +++ b/zuul.d/project.yaml @@ -11,6 +11,7 @@ - ipa-tempest-bios-ipmi-iscsi-tinyipa-src - ironic-python-agent-check-image-tinyipa - ironic-python-agent-check-image-dib-centos8 + - ironic-python-agent-check-image-dib-centos8-extra - ironic-python-agent-check-image-dib-centos7 # Non-voting jobs - ironic-python-agent-check-image-dib-centos7-python3: @@ -37,6 +38,7 @@ - ipa-tempest-bios-ipmi-iscsi-tinyipa-src - ironic-python-agent-check-image-tinyipa - ironic-python-agent-check-image-dib-centos8 + - ironic-python-agent-check-image-dib-centos8-extra - ironic-python-agent-check-image-dib-centos7 post: jobs: