From 2c7f7a55e64ad2d893183e43ee2fda370d42428d Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Thu, 26 Nov 2020 14:37:08 +0100 Subject: [PATCH] Remove netronome and amdgpu firmware by default Allow customizing which firmware to remove this way. Change-Id: I714c0771c565814714881b979daaa4c83a15db1d --- .../environment.d/10-defaults.bash | 1 + .../post-install.d/99-remove-extra-packages | 4 ++++ doc/source/admin/dib.rst | 9 +++++++++ releasenotes/notes/no-firmware-e2cb953037a3be8f.yaml | 5 +++++ 4 files changed, 19 insertions(+) create mode 100644 dib/ironic-python-agent-ramdisk/environment.d/10-defaults.bash create mode 100644 releasenotes/notes/no-firmware-e2cb953037a3be8f.yaml diff --git a/dib/ironic-python-agent-ramdisk/environment.d/10-defaults.bash b/dib/ironic-python-agent-ramdisk/environment.d/10-defaults.bash new file mode 100644 index 0000000..7c5f5ce --- /dev/null +++ b/dib/ironic-python-agent-ramdisk/environment.d/10-defaults.bash @@ -0,0 +1 @@ +export IPA_REMOVE_FIRMWARE=${IPA_REMOVE_FIRMWARE:-amdgpu,netronome} diff --git a/dib/ironic-python-agent-ramdisk/post-install.d/99-remove-extra-packages b/dib/ironic-python-agent-ramdisk/post-install.d/99-remove-extra-packages index bc5f597..cacad75 100755 --- a/dib/ironic-python-agent-ramdisk/post-install.d/99-remove-extra-packages +++ b/dib/ironic-python-agent-ramdisk/post-install.d/99-remove-extra-packages @@ -8,6 +8,10 @@ set -o pipefail rm -rf /tmp/ironic-python-agent +for item in ${IPA_REMOVE_FIRMWARE//,/ }; do + rm -rf /usr/lib/firmware/$item +done + # TODO(dtantsur): implement the same for debian-based systems case "$DISTRO_NAME" in fedora|centos|centos7|rhel|rhel7) diff --git a/doc/source/admin/dib.rst b/doc/source/admin/dib.rst index abfab8d..2a378c6 100644 --- a/doc/source/admin/dib.rst +++ b/doc/source/admin/dib.rst @@ -158,6 +158,15 @@ required for instance image or deploy image. .. _dynamic-login: https://docs.openstack.org/diskimage-builder/latest/elements/dynamic-login/README.html .. _devuser: https://docs.openstack.org/diskimage-builder/latest/elements/devuser/README.html +Firmware Removal +~~~~~~~~~~~~~~~~ + +By default the element removes some firmware blobs to reduce the image size. +Specifically, firmware from ``netronome`` and ``amdgpu`` is removed. If you +want to override this, change the ``IPA_REMOVE_FIRMWARE`` environment variable +to a comma-separated list of directories or files under ``/usr/lib/firmware``. +Set it to an empty string to disable firmware removal. + Available Elements ------------------ diff --git a/releasenotes/notes/no-firmware-e2cb953037a3be8f.yaml b/releasenotes/notes/no-firmware-e2cb953037a3be8f.yaml new file mode 100644 index 0000000..96685ba --- /dev/null +++ b/releasenotes/notes/no-firmware-e2cb953037a3be8f.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + Firmware for netronome and amdgpu is now removed by default. Set + ``IPA_REMOVE_FIRMWARE`` to override.