Skip to content

Commit

Permalink
Ubuntu cinc: Include 'perf' in the image.
Browse files Browse the repository at this point in the history
Ubuntu image was missing 'perf'. This change installs required
package in the image and includes required workadound to make it
work if the image is built on a machine with different kernel than
kernel of the machine that runs the container.
(more details in in-code comment)

Signed-off-by: Martin Kalcok <martin.kalcok@canonical.com>
  • Loading branch information
mkalcok committed Dec 15, 2023
1 parent 9739613 commit 2b70fd4
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions image/cinc/install_ubuntu_pkg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ apt install -yq --no-install-recommends \
libxslt1.1 \
lksctp-tools \
libsctp-dev \
linux-tools-generic \
make \
meson \
net-tools \
Expand Down Expand Up @@ -64,3 +65,24 @@ systemctl mask \
mkdir -pv /bin
/tmp/generate_dhclient_script_for_fullstack.sh / || \
echo "Failed to generate dhclient script for fullstack!"

# Patch perf script.
# On Ubuntu, '/usr/bin/perf' is a shell script that tries to find perf binary
# that exactly matches current running kernel. This will break if
# ovn-fake-multinode container runs on a host with different kernel than the
# host that built the image.
# It's no ideal, but since the perf should be backwards compatible, we can
# circumvent this by linking '/usr/bin/perf' directly to an available
# binary in '/usr/lib/linux-tools-<version>/perf'
PERF_PATH=""

for PERF_BIN in $(ls /usr/lib/linux-tools-*/perf); do
PERF_PATH=$PERF_BIN
done

if [ -z "$PERF_PATH" ]; then
echo "Failed to find perf binary"
exit 1
fi

ln -s -f "$PERF_PATH" /usr/bin/perf

0 comments on commit 2b70fd4

Please sign in to comment.