From: Peter Amstutz Date: Wed, 31 Aug 2022 15:59:40 +0000 (-0400) Subject: Pull our fork of amazon-ebs-autoscale for nvme support, refs #19439 X-Git-Tag: 2.5.0~84 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/ecfa53f5d61a709787cae8f771bc346817466b49?ds=sidebyside Pull our fork of amazon-ebs-autoscale for nvme support, refs #19439 Arvados-DCO-1.1-Signed-off-by: Peter Amstutz --- diff --git a/tools/compute-images/scripts/base.sh b/tools/compute-images/scripts/base.sh index 816036f384..d186f4c52e 100644 --- a/tools/compute-images/scripts/base.sh +++ b/tools/compute-images/scripts/base.sh @@ -187,13 +187,9 @@ else unzip -q /tmp/awscliv2.zip -d /tmp && $SUDO /tmp/aws/install # Pinned to v2.4.5 because we apply a patch below #export EBS_AUTOSCALE_VERSION=$(curl --silent "https://api.github.com/repos/awslabs/amazon-ebs-autoscale/releases/latest" | jq -r .tag_name) - export EBS_AUTOSCALE_VERSION="v2.4.5" - cd /opt && $SUDO git clone https://github.com/awslabs/amazon-ebs-autoscale.git + export EBS_AUTOSCALE_VERSION="5ca6e24e05787b8ae1184c2a10db80053ddd3038" + cd /opt && $SUDO git clone https://github.com/arvados/amazon-ebs-autoscale.git cd /opt/amazon-ebs-autoscale && $SUDO git checkout $EBS_AUTOSCALE_VERSION - $SUDO patch -p1 < /tmp/create-ebs-volume-nvme.patch - - # This script really requires bash and the shebang line is wrong - $SUDO sed -i 's|^#!/bin/sh|#!/bin/bash|' /opt/amazon-ebs-autoscale/bin/ebs-autoscale # Set up the cloud-init script that makes use of the AWS EBS autoscaler $SUDO mv /tmp/usr-local-bin-ensure-encrypted-partitions-aws-ebs-autoscale.sh /usr/local/bin/ensure-encrypted-partitions.sh diff --git a/tools/compute-images/scripts/create-ebs-volume-nvme.patch b/tools/compute-images/scripts/create-ebs-volume-nvme.patch deleted file mode 100644 index 79ce487d54..0000000000 --- a/tools/compute-images/scripts/create-ebs-volume-nvme.patch +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright (C) The Arvados Authors. All rights reserved. -# -# SPDX-License-Identifier: BSD-3-Clause - -Make the create-ebs-volume script work with nvme devices. - -diff --git a/bin/create-ebs-volume b/bin/create-ebs-volume -index 6857564..e3122fa 100755 ---- a/bin/create-ebs-volume -+++ b/bin/create-ebs-volume -@@ -149,10 +149,11 @@ function get_next_logical_device() { - for letter in ${alphabet[@]}; do - # use /dev/xvdb* device names to avoid contention for /dev/sd* and /dev/xvda names - # only supported by HVM instances -- if [ ! -b "/dev/xvdb${letter}" ]; then -+ if [[ $created_volumes =~ .*/dev/xvdb${letter}.* ]]; then -+ continue -+ fi - echo "/dev/xvdb${letter}" - break -- fi - done - } - -@@ -323,8 +324,13 @@ function create_and_attach_volume() { - - logthis "waiting for volume $volume_id on filesystem" - while true; do -- if [ -e "$device" ]; then -- logthis "volume $volume_id on filesystem as $device" -+ # AWS returns e.g. vol-00338247831716a7b4, the kernel changes that to vol00338247831716a7b -+ valid_volume_id=`echo $volume_id |sed -e 's/[^a-zA-Z0-9]//'` -+ # example lsblk output: -+ # nvme4n1 259:7 0 150G 0 disk vol00338247831716a7b -+ if LSBLK=`lsblk -o NAME,SERIAL |grep $valid_volume_id`; then -+ nvme_device=/dev/`echo $LSBLK|cut -f1 -d' '` -+ logthis "volume $volume_id on filesystem as $nvme_device (aws device $device)" - break - fi - sleep 1 -@@ -338,7 +344,7 @@ function create_and_attach_volume() { - > /dev/null - logthis "volume $volume_id DeleteOnTermination ENABLED" - -- echo $device -+ echo "$nvme_device" - } - - create_and_attach_volume