Remove the deprecated ironic-agent element

Despite having several issues (like missing firmware), it is still
used by people. It seems that the only way to stop that is to remove it.

Change-Id: I4baed8e8ab663c624dcc8d06ff0293d57b082abb
This commit is contained in:
Dmitry Tantsur 2021-01-21 14:06:08 +01:00
parent 2737d909bf
commit fd1848282f
28 changed files with 22 additions and 439 deletions

View File

@ -1,48 +0,0 @@
============
ironic-agent
============
warning::
This element is deprecated and copied to
ironic-python-agent-builder and can be found at:
https://opendev.org/openstack/ironic-python-agent-builder/src/branch/master/dib/ironic-python-agent-ramdisk
The ramdisk can be build from the ironic-python-agent-builder and
the "ironic-element" in diskimage-builder is deprecated.
Builds a ramdisk with ironic-python-agent. More information can be found at:
https://opendev.org/openstack/ironic-python-agent/
Beyond installing the ironic-python-agent, this element does the following:
* Installs the ``dhcp-all-interfaces`` so the node, upon booting, attempts to
obtain an IP address on all available network interfaces.
* Disables the ``iptables`` service on SysV and systemd based systems.
* Disables the ``ufw`` service on Upstart based systems.
* Installs packages required for the operation of the ironic-python-agent::
``qemu-utils`` ``parted`` ``hdparm`` ``util-linux`` ``genisoimage``
* When installing from source, ``python-dev`` and ``gcc`` are also installed
in order to support source based installation of ironic-python-agent and its
dependencies.
* Install the certificate if any, which is set to the environment variable
``DIB_IPA_CERT`` for validating the authenticity by ironic-python-agent. The
certificate can be self-signed certificate or CA certificate.
* Compresses initramfs with command specified in environment variable
``DIB_IPA_COMPRESS_CMD``, which is 'gzip' by default. This command should listen
for raw data from stdin and write compressed data to stdout. Command can be
with arguments.
This element outputs three files:
- ``$IMAGE-NAME.initramfs``: The deploy ramdisk file containing the
ironic-python-agent (IPA) service.
- ``$IMAGE-NAME.kernel``: The kernel binary file.
- ``$IMAGE-NAME.vmlinuz``: A hard link pointing to the ``$IMAGE-NAME.kernel``
file; this is just a backward compatibility layer, please do not rely
on this file.
.. note::
The package based install currently only enables the service when using the
systemd init system. This can easily be changed if there is an agent
package which includes upstart or sysv packaging.
.. note::
Using the ramdisk will require at least 1.5GB of ram

View File

@ -1,58 +0,0 @@
#!/bin/bash
# dib-lint: disable=safe_sudo
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
[ -n "$TARGET_ROOT" ]
USER=${USER:-$(whoami)}
source $_LIB/img-functions
IMAGE_PATH=$(readlink -f $IMAGE_NAME)
cd $TARGET_ROOT
DIB_IPA_COMPRESS_CMD="${DIB_IPA_COMPRESS_CMD:-gzip}"
echo "#disabled" > ./tmp/fstab.new
sudo mv ./tmp/fstab.new ./etc/fstab
sudo ln -s ./sbin/init ./
# Note: The pci.ids, which is used by lshw, locate on Ubuntu
# in /usr/share/misc. Therefore we are removing only the
# ./usr/share/misc/m* (will remove the magic and magic.mgc files).
# on RHEL pci.ids is locate on /usr/share/hwdata/pci.ids.
sudo find . -xdev \
-path './sys/*' -prune -o \
-path './tmp/*' -prune -o \
-path './boot/*' -prune -o \
-path './root/.cache' -prune -o \
-path './usr/include/*' -prune -o \
-path './usr/lib/locale/*' -prune -o \
-path './usr/share/doc/*' -prune -o \
-path './usr/share/man/*' -prune -o \
-path './usr/share/info/*' -prune -o \
-path './usr/share/licenses/*' -prune -o \
-path './usr/share/misc/m*' -prune -o \
-path './usr/src/kernels/*' -prune -o \
-path './var/cache/*' -prune -o \
-name '*.pyc' -prune -o \
-name '*.pyo' -prune -o \
-print | sudo cpio -o -H newc | ${DIB_IPA_COMPRESS_CMD} > ${IMAGE_PATH}.initramfs
select_boot_kernel_initrd $TARGET_ROOT
sudo cp $BOOTDIR/$KERNEL ${IMAGE_PATH}.kernel
sudo chown $USER: ${IMAGE_PATH}.kernel
# TODO(lucasagomes): Create a hard link for the .vmlinuz file to keep
# it backward compatible. Remove it after it has been consistent and
# documented in both places for at least one full OpenStack release cycle
echo "WARNING: The kernel extension .vmlinuz has been deprecated. Please rely on the file with the extension .kernel instead."
sudo rm -f ${IMAGE_PATH}.vmlinuz
ln ${IMAGE_PATH}.kernel ${IMAGE_PATH}.vmlinuz

View File

@ -1,10 +0,0 @@
dhcp-all-interfaces
ibft-interfaces
install-static
no-final-image
package-installs
pip-and-virtualenv
pkg-map
runtime-ssh-host-keys
source-repositories
svc-map

View File

@ -1 +0,0 @@
ironic-python-agent

View File

@ -1,6 +0,0 @@
# backwards compatibility with the previous environment
# variable for the ironic-agent source repository
if [ -n "${DIB_REPOREF_agent:-}" ]; then
echo "WARNING: DIB_REPOREF_agent is deprecated. Please update to use DIB_REPOREF_ironic_agent instead."
export DIB_REPOREF_ironic_agent=${DIB_REPOREF_agent}
fi

View File

@ -1,12 +0,0 @@
#!/bin/bash
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
if [ -n "${DIB_IPA_CERT:=}" ]; then
cp $DIB_IPA_CERT $TMP_HOOKS_PATH/ipa-trusted-cert.pem
fi

View File

@ -1,31 +0,0 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
# TODO(lucasagomes): optimize the ramdisk for other OSs
if [ $DISTRO_NAME = 'fedora' ] ; then
_remove_yum=''
if [ $DIB_RELEASE -ge 22 ]; then
# if we are on F22, we can remove yum if there, because it has
# been superseeded by dnf
_remove_yum='yum'
fi
install-packages -e kernel-debug-devel gcc fedora-logos \
rsync pykickstart \
genisoimage tcpdump \
man-db kbd-misc \
plymouth cronie ${_remove_yum}
${YUM:-yum} clean all
# Rebuilding the rpm database after removing packages will reduce
# its size
rpm --rebuilddb
fi

View File

@ -1,49 +0,0 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
SCRIPTDIR=$(dirname $0)
IPADIR=/usr/share/ironic-python-agent
# Generate upper-constraints
$IPADIR/imagebuild/common/generate_upper_constraints.sh $IPADIR/upper-constraints.txt
# create the virtual environment
virtualenv $IPADIR/venv
# pip might be an older version which does not support the -c option, therefore upgrade first
$IPADIR/venv/bin/pip install pip --upgrade
# install IPA inside the virtual environment
$IPADIR/venv/bin/pip install -c $IPADIR/upper-constraints.txt $IPADIR
# FIXME(lucasagomes): Figure out how we can use the "--install-option"
# parameter for pip install so we don't have to manually create a symlink
# create the launcher link so services can use it
ln -s $IPADIR/venv/bin/ironic-python-agent /usr/local/bin/ironic-python-agent
case "$DIB_INIT_SYSTEM" in
upstart)
install -D -g root -o root -m 0755 ${SCRIPTDIR}/ironic-python-agent.conf /etc/init/ironic-python-agent.conf
;;
systemd)
install -D -g root -o root -m 0755 ${SCRIPTDIR}/ironic-python-agent.service /usr/lib/systemd/system/ironic-python-agent.service
;;
sysv)
install -D -g root -o root -m 0755 ${SCRIPTDIR}/ironic-python-agent.init /etc/init.d/ironic-python-agent.init
update-rc.d ironic-python-agent.init defaults
;;
*)
echo "Unsupported init system"
exit 1
;;
esac
# Copying the self signed certificate for request library
if [ -f /tmp/in_target.d/ipa-trusted-cert.pem ]; then
cat /tmp/in_target.d/ipa-trusted-cert.pem >> $($IPADIR/venv/bin/python -c "import requests; print(requests.certs.where())")
fi

View File

@ -1,22 +0,0 @@
# ironic-python-agent - OpenStack Ironic Python Agent
#
# The ironic-python-agent helps ironic in deploying instances.
description "Ironic Python Agnet"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
respawn limit 10 5
umask 022
expect stop
console output
pre-start script
echo Starting Ironic Python Agent
end script
exec /usr/local/bin/ironic-python-agent

View File

@ -1,31 +0,0 @@
#!/bin/sh -e
### BEGIN INIT INFO
# Provides: ironic-python-agent
# Required-Start: $local_fs networking
# Required-Stop: $local_fs
# Default-Start: S
# Default-Stop: 0 6
# X-Start-Before:
# Short-Description: Ironic Python Agent
# Description: Starts Ironic Python Agent for instance deployment
### END INIT INFO
NAME=ironic-python-agent
INIT_NAME=/etc/init.d/${NAME}
SCRIPT_NAME=/usr/local/bin/${NAME}
[ -x $SCRIPT_NAME ] || exit 0
case "$1" in
start)
$SCRIPT_NAME
;;
stop)
;;
*)
echo "Usage: $INIT_NAME {start|stop}"
exit 1
;;
esac
exit 0

View File

@ -1,13 +0,0 @@
[Unit]
Description=Ironic Python Agent
After=network-online.target
[Service]
ExecStartPre=/sbin/modprobe vfat
ExecStart=/usr/local/bin/ironic-python-agent
Restart=always
RestartSec=30s
[Install]
WantedBy=multi-user.target

View File

@ -1,25 +0,0 @@
tgt:
curl:
# dmidecode does not exist for ppc* arches so we use lshw
dmidecode:
not-arch: ppc64,ppc64el,ppc64le
iptables:
lshw:
ipmitool:
qemu-utils:
gcc:
python-dev:
parted:
hdparm:
util-linux:
genisoimage:
gdisk:
kmod:
psmisc:
dosfstools:
mdadm:
# efibootmgr and efivar do not exist for ppc*
efibootmgr:
not-arch: ppc64,ppc64el,ppc64le
efivar:
not-arch: ppc64,ppc64el,ppc64le

View File

@ -1,42 +0,0 @@
{
"release": {
"rhel": {
"8": {
"tgt": "target-restore",
"curl": "curl",
"ironic-python-agent": "openstack-ironic-python-agent",
"qemu-utils": "qemu-img",
"python-dev": "python3-devel"
}
},
"centos": {
"8": {
"tgt": "target-restore",
"curl": "curl",
"ironic-python-agent": "openstack-ironic-python-agent",
"qemu-utils": "qemu-img",
"python-dev": "python3-devel"
}
}
},
"family": {
"redhat": {
"tgt": "scsi-target-utils",
"curl": "curl",
"ironic-python-agent": "openstack-ironic-python-agent",
"qemu-utils": "qemu-img",
"python-dev": "python2-devel"
},
"debian": {
"tgt": "tgt",
"curl": "curl"
}
},
"default": {
"tgt": "tgt",
"curl": "curl",
"ironic-python-agent": "openstack-ironic-python-agent",
"qemu-utils": "qemu-utils",
"python-dev": "python-dev"
}
}

View File

@ -1,36 +0,0 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
install-packages -e cloud-init
rm -rf /tmp/ironic-python-agent
case "$DIB_INIT_SYSTEM" in
upstart)
if [ -f /etc/init/ufw.conf ]; then
mv /etc/init/ufw.conf /etc/init/ufw.conf.disabled
fi
if [ -f /etc/init/tgt.conf ]; then
mv /etc/init/tgt.conf /etc/init/tgt.conf.disabled
fi
;;
systemd)
if [[ $(systemctl --no-pager list-unit-files iptables) =~ 'enabled' ]]; then
systemctl disable iptables.service
fi
systemctl enable $(svc-map ironic-python-agent).service
systemctl enable ironic-agent-create-rescue-user.path
;;
sysv)
update-rc.d iptables disable
;;
*)
echo "Unsupported init system"
exit 1
;;
esac

View File

@ -1 +0,0 @@
ironic-agent git /usr/share/ironic-python-agent https://opendev.org/openstack/ironic-python-agent

View File

@ -1,8 +0,0 @@
[Unit]
Description=Ironic user rescue - notify path existence
[Path]
PathExists=/etc/ipa-rescue-config/ipa-rescue-password
[Install]
WantedBy=multi-user.target

View File

@ -1,10 +0,0 @@
[Unit]
Description=Ironic agent rescue user creation
[Service]
ExecStart=/bin/bash /usr/local/bin/ironic-python-agent-create-rescue-user.sh
Type=oneshot
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target

View File

@ -1,12 +0,0 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
echo "Adding rescue user with root privileges..."
crypted_pass=$(</etc/ipa-rescue-config/ipa-rescue-password)
useradd -m rescue -G wheel -p $crypted_pass
echo "rescue ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/rescue

View File

@ -1,4 +0,0 @@
ironic-python-agent:
default: openstack-ironic-python-agent
redhat: openstack-ironic-python-agent
debian: ironic-python-agent

View File

@ -1,2 +0,0 @@
fedora-minimal
openstack-ci-mirrors

View File

@ -2,7 +2,8 @@
iso iso
=== ===
Generates a bootable ISO image from the kernel/ramdisk generated by the Generates a bootable ISO image from the kernel/ramdisk generated by the
elements ``baremetal``, ``ironic-agent`` or ``ramdisk``. It uses isolinux to boot on BIOS elements ``baremetal``, ``ironic-python-agent-ramdisk`` (from
ironic-python-agent-builder) or ``ramdisk``. It uses isolinux to boot on BIOS
machines and grub to boot on EFI machines. machines and grub to boot on EFI machines.
This element has been tested on the following distro(s): This element has been tested on the following distro(s):
@ -37,9 +38,11 @@ named ``<image-name>.iso`` booting the generated kernel and ramdisk. It also
automatically appends kernel command-line argument 'boot\_method=vmedia' automatically appends kernel command-line argument 'boot\_method=vmedia'
which is required for Ironic drivers ``iscsi_ilo``. which is required for Ironic drivers ``iscsi_ilo``.
ironic-agent element ironic-python-agent-ramdisk element
-------------------- -----------------------------------
When used with ``ironic-agent`` element, this generates a bootable ISO image named ``<image-name>.iso`` which boots the agent kernel and agent ramdisk. When used with ``ironic-python-agent-ramdisk`` element, this generates a
bootable ISO image named ``<image-name>.iso`` which boots the agent kernel and
agent ramdisk.
**REFERENCES** **REFERENCES**

View File

@ -152,7 +152,7 @@ if echo $IMAGE_ELEMENT | grep -q '\bramdisk\b'; then
DIB_DEPLOY_ISO_KERNEL_CMDLINE_ARGS=${DIB_DEPLOY_ISO_KERNEL_CMDLINE_ARGS:-} DIB_DEPLOY_ISO_KERNEL_CMDLINE_ARGS=${DIB_DEPLOY_ISO_KERNEL_CMDLINE_ARGS:-}
EMITTED_KERNEL_CMDLINE_ARGS="boot_method=vmedia $DIB_DEPLOY_ISO_KERNEL_CMDLINE_ARGS" EMITTED_KERNEL_CMDLINE_ARGS="boot_method=vmedia $DIB_DEPLOY_ISO_KERNEL_CMDLINE_ARGS"
EMITTED_ISO_FILENAME=$IMAGE_NAME.iso EMITTED_ISO_FILENAME=$IMAGE_NAME.iso
elif echo $IMAGE_ELEMENT | grep -q '\bironic-agent\b'; then elif echo $IMAGE_ELEMENT | grep -q '\bironic-python-agent\b'; then
EMITTED_KERNEL=$IMAGE_NAME.vmlinuz EMITTED_KERNEL=$IMAGE_NAME.vmlinuz
EMITTED_RAMDISK=$IMAGE_NAME.initramfs EMITTED_RAMDISK=$IMAGE_NAME.initramfs
DIB_DEPLOY_ISO_KERNEL_CMDLINE_ARGS=${DIB_DEPLOY_ISO_KERNEL_CMDLINE_ARGS:-} DIB_DEPLOY_ISO_KERNEL_CMDLINE_ARGS=${DIB_DEPLOY_ISO_KERNEL_CMDLINE_ARGS:-}

View File

@ -5,9 +5,9 @@ no-final-image
This is a noop element which can be used to indicate to diskimage-builder that This is a noop element which can be used to indicate to diskimage-builder that
it should not bother creating a final image out of the generated filesystem. it should not bother creating a final image out of the generated filesystem.
It is useful in cases where an element handles all of the image building It is useful in cases where an element handles all of the image building
itself, such as ironic-agent or Docker images. In those cases the final image itself, such as ironic-python-agent-ramdisk or Docker images. In those cases
normally generated by diskimage-builder is not the desired output, so there's the final image normally generated by diskimage-builder is not the desired
no reason to spend time creating it. output, so there's no reason to spend time creating it.
Elements that wish to behave this way should include this element in their Elements that wish to behave this way should include this element in their
element-deps file. element-deps file.

View File

@ -1,12 +1,12 @@
proliant-tools proliant-tools
============== ==============
* This element can be used when building ironic-agent ramdisk. It * This element can be used when building ironic-python-agent ramdisk. It
enables ironic-agent ramdisk to do in-band cleaning operations specific enables ironic-python-agent ramdisk to do in-band cleaning operations
to HPE ProLiant hardware. specific to HPE ProLiant hardware.
* Works with ubuntu and fedora distributions (on which ironic-agent * Works with ubuntu and fedora distributions (on which the
element is supported). ironic-python-agent-ramdisk element is supported).
* Currently the following utilities are installed: * Currently the following utilities are installed:

View File

@ -22,9 +22,7 @@ Components
ramdisk-image-create -o deploy.ramdisk deploy-baremetal ramdisk-image-create -o deploy.ramdisk deploy-baremetal
To generate kernel+ramdisk pair for use with ironic, use:: Ironic no longer supports images created like this.
ramdisk-image-create -o deploy.ramdisk ironic-agent
`element-info` `element-info`

View File

@ -0,0 +1,5 @@
---
upgrade:
- |
Removes the long deprecated ironic-agent element. Use
ironic-python-agent-ramdisk from the ironic-python-agent-builder project.