File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed
Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change 11Name: amazon-ec2-utils
22Summary: A set of tools for running in EC2
3- Version: 2.1 .0
3+ Version: 2.2 .0
44Release: 1%{?dist }
55License: MIT
66Group: System Tools
@@ -75,6 +75,9 @@ rm -rf $RPM_BUILD_ROOT
7575/etc/udev/rules.d/60-cdrom_id.rules
7676
7777%changelog
78+ * Thu Jan 18 2024 Keith Gable <gablk@amazon.com> - 2.2.0-1
79+ - Change ec2nvme-nsid to use Bash string manipulation to improve
80+ performance and reliability
7881
7982* Thu Apr 6 2023 Noah Meyerhans <nmeyerha@amazon.com> - 2.1.0-1
8083- Add --quiet option to ec2-metadata
Original file line number Diff line number Diff line change 66# for the specific language governing permissions and limitations under
77# the License.
88
9- # Expected input if partition's kernel name like nvme0n1p2
10- if [ $# -eq 0 ] ; then
9+ # Expected input is partition's kernel name like nvme0n1p2 or nvme0n1, output would be 1
10+
11+ if [[ $# -ne 1 ]]; then
1112 exit 1
1213else
13- # extract ns id from partition's kernel name and export it
14- NSID=$( echo -n " $@ " | cut -f 3 -d ' n' | cut -f 1 -d ' p' )
14+ kernel_name=$1
15+
16+ # Remove nvme prefix (also deals with any /dev that might accidentally get passed in)
17+ prefix_removed=${kernel_name#* nvme* n}
18+
19+ # Remove partition suffix
20+ NSID=${prefix_removed% p* }
21+
1522 echo " _NS_ID=${NSID} "
1623fi
You can’t perform that action at this time.
0 commit comments