Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable plugins and detailed EBS volume stats for nvme-cli #269

Merged
merged 6 commits into from
Nov 25, 2024

Conversation

bcressey
Copy link
Contributor

@bcressey bcressey commented Nov 15, 2024

Issue number:
Fixes #274

Description of changes:
nvme-cli requires the json-c library for plugins. Package it, enable plugins, and apply the recent patch to the "amzn" plugin so that it can report detailed EBS volume stats.

Also fixes a bug I noticed in rdma-core, where the devel package didn't correctly depend on the base package.

Testing done:
Verified that the "amzn" plugin worked as expected.

# nvme amzn id-ctrl /dev/nvme0n1|grep ^bdev
bdev      : xvda

# nvme amzn stats /dev/nvme0n1
Total Ops:
  Read: 2899
  Write: 68
Total Bytes:
  Read: 214631424
  Write: 4775936
Total Time (us):
  Read: 14061141
  Write: 76947

EBS Volume Performance Exceeded (us):
  IOPS: 0
  Throughput: 0

EC2 Instance EBS Performance Exceeded (us):
  IOPS: 0
  Throughput: 0

Queue Length (point in time): 0

Also confirmed that the EBS volume links were created as expected:

# ls -latr /dev/disk/by-ebs-id/
lrwxrwxrwx.  1 root root  13 Nov 15 18:57 xvdb -> ../../nvme1n1
lrwxrwxrwx.  1 root root  15 Nov 15 18:57 xvdb1 -> ../../nvme1n1p1
lrwxrwxrwx.  1 root root  13 Nov 15 18:57 xvda -> ../../nvme0n1
lrwxrwxrwx.  1 root root  15 Nov 15 18:57 xvda7 -> ../../nvme0n1p7
lrwxrwxrwx.  1 root root  15 Nov 15 18:57 xvda6 -> ../../nvme0n1p6
lrwxrwxrwx.  1 root root  15 Nov 15 18:57 xvda5 -> ../../nvme0n1p5
lrwxrwxrwx.  1 root root  15 Nov 15 18:57 xvda4 -> ../../nvme0n1p4
lrwxrwxrwx.  1 root root  15 Nov 15 18:57 xvda3 -> ../../nvme0n1p3
lrwxrwxrwx.  1 root root  16 Nov 15 18:57 xvda13 -> ../../nvme0n1p13
lrwxrwxrwx.  1 root root  16 Nov 15 18:57 xvda11 -> ../../nvme0n1p11
lrwxrwxrwx.  1 root root  16 Nov 15 18:57 xvda10 -> ../../nvme0n1p10
lrwxrwxrwx.  1 root root  15 Nov 15 18:57 xvda1 -> ../../nvme0n1p1
lrwxrwxrwx.  1 root root  15 Nov 15 18:57 xvda9 -> ../../nvme0n1p9
lrwxrwxrwx.  1 root root  15 Nov 15 18:57 xvda8 -> ../../nvme0n1p8
lrwxrwxrwx.  1 root root  15 Nov 15 18:57 xvda2 -> ../../nvme0n1p2
lrwxrwxrwx.  1 root root  16 Nov 15 18:57 xvda12 -> ../../nvme0n1p12

Terms of contribution:

By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.

Signed-off-by: Ben Cressey <bcressey@amazon.com>
Signed-off-by: Ben Cressey <bcressey@amazon.com>
Signed-off-by: Ben Cressey <bcressey@amazon.com>
packages/rdma-core/rdma-core.spec Show resolved Hide resolved
packages/libjson-c/libjson-c.spec Outdated Show resolved Hide resolved
-DDISABLE_WERROR:BOOL=OFF \
-DENABLE_RDRAND:BOOL=ON \
-DENABLE_THREADING:BOOL=ON \
-DCMAKE_INSTALL_PREFIX:PATH=%{_cross_prefix} \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also not needed:

If I don't set this, then I don't get the right behavior; cmake --install sends the files to /usr/local instead:

  #14 5.950 + DESTDIR=/home/builder/rpmbuild/BUILDROOT/bottlerocket-libjson-c-0.18-20240915.1731694836.c940f6ab.br1.aarch64
  #14 5.950 + cmake --install .
  #14 5.960 -- Install configuration: "Release"
  #14 5.961 -- Installing: /home/builder/rpmbuild/BUILDROOT/bottlerocket-libjson-c-0.18-20240915.1731694836.c940f6ab.br1.aarch64/usr/local/lib/libjson-c.so.5.4.0
  #14 5.961 -- Installing: /home/builder/rpmbuild/BUILDROOT/bottlerocket-libjson-c-0.18-20240915.1731694836.c940f6ab.br1.aarch64/usr/local/lib/libjson-c.so.5
  #14 5.961 -- Installing: /home/builder/rpmbuild/BUILDROOT/bottlerocket-libjson-c-0.18-20240915.1731694836.c940f6ab.br1.aarch64/usr/local/lib/libjson-c.so
  #14 5.962 -- Installing: /home/builder/rpmbuild/BUILDROOT/bottlerocket-libjson-c-0.18-20240915.1731694836.c940f6ab.br1.aarch64/usr/local/lib/cmake/json-c/json-c-targets.cmake
  #14 5.962 -- Installing: /home/builder/rpmbuild/BUILDROOT/bottlerocket-libjson-c-0.18-20240915.1731694836.c940f6ab.br1.aarch64/usr/local/lib/cmake/json-c/json-c-targets-release.cmake
  #14 5.962 -- Installing: /home/builder/rpmbuild/BUILDROOT/bottlerocket-libjson-c-0.18-20240915.1731694836.c940f6ab.br1.aarch64/usr/local/lib/cmake/json-c/json-c-config.cmake
  #14 5.963 -- Installing: /home/builder/rpmbuild/BUILDROOT/bottlerocket-libjson-c-0.18-20240915.1731694836.c940f6ab.br1.aarch64/usr/local/lib/pkgconfig/json-c.pc
  #14 5.963 -- Installing: /home/builder/rpmbuild/BUILDROOT/bottlerocket-libjson-c-0.18-20240915.1731694836.c940f6ab.br1.aarch64/usr/local/include/json-c/json_config.h
  #14 5.963 -- Installing: /home/builder/rpmbuild/BUILDROOT/bottlerocket-libjson-c-0.18-20240915.1731694836.c940f6ab.br1.aarch64/usr/local/include/json-c/json.h
  #14 5.963 -- Installing: /home/builder/rpmbuild/BUILDROOT/bottlerocket-libjson-c-0.18-20240915.1731694836.c940f6ab.br1.aarch64/usr/local/include/json-c/arraylist.h
  #14 5.964 -- Installing: /home/builder/rpmbuild/BUILDROOT/bottlerocket-libjson-c-0.18-20240915.1731694836.c940f6ab.br1.aarch64/usr/local/include/json-c/debug.h
  #14 5.964 -- Installing: /home/builder/rpmbuild/BUILDROOT/bottlerocket-libjson-c-0.18-20240915.1731694836.c940f6ab.br1.aarch64/usr/local/include/json-c/json_c_version.h
  #14 5.964 -- Installing: /home/builder/rpmbuild/BUILDROOT/bottlerocket-libjson-c-0.18-20240915.1731694836.c940f6ab.br1.aarch64/usr/local/include/json-c/json_inttypes.h
  #14 5.964 -- Installing: /home/builder/rpmbuild/BUILDROOT/bottlerocket-libjson-c-0.18-20240915.1731694836.c940f6ab.br1.aarch64/usr/local/include/json-c/json_object.h
  #14 5.964 -- Installing: /home/builder/rpmbuild/BUILDROOT/bottlerocket-libjson-c-0.18-20240915.1731694836.c940f6ab.br1.aarch64/usr/local/include/json-c/json_object_iterator.h
  #14 5.965 -- Installing: /home/builder/rpmbuild/BUILDROOT/bottlerocket-libjson-c-0.18-20240915.1731694836.c940f6ab.br1.aarch64/usr/local/include/json-c/json_tokener.h
  #14 5.965 -- Installing: /home/builder/rpmbuild/BUILDROOT/bottlerocket-libjson-c-0.18-20240915.1731694836.c940f6ab.br1.aarch64/usr/local/include/json-c/json_types.h
  #14 5.965 -- Installing: /home/builder/rpmbuild/BUILDROOT/bottlerocket-libjson-c-0.18-20240915.1731694836.c940f6ab.br1.aarch64/usr/local/include/json-c/json_util.h
  #14 5.965 -- Installing: /home/builder/rpmbuild/BUILDROOT/bottlerocket-libjson-c-0.18-20240915.1731694836.c940f6ab.br1.aarch64/usr/local/include/json-c/json_visit.h
  #14 5.965 -- Installing: /home/builder/rpmbuild/BUILDROOT/bottlerocket-libjson-c-0.18-20240915.1731694836.c940f6ab.br1.aarch64/usr/local/include/json-c/linkhash.h
  #14 5.966 -- Installing: /home/builder/rpmbuild/BUILDROOT/bottlerocket-libjson-c-0.18-20240915.1731694836.c940f6ab.br1.aarch64/usr/local/include/json-c/printbuf.h

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🫠 , why cmake? I wonder if there is a bug in cmake and it ignores CMAKE_INSTALL_PREFIX when set through the toolchain file?

-DCMAKE_INSTALL_PREFIX:PATH=%{_cross_prefix} \
-G Ninja

cmake --build .
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these two steps (_cross_cmake and cmake build) required in separate lines? If _cross_cmake is used to generate the actual Make files, why not move that to %prep?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these two steps (_cross_cmake and cmake build) required in separate lines?

Even if they're not, I prefer them to be separate for symmetry with autotools (configure then make), meson (meson setup then meson build), etc.

If _cross_cmake is used to generate the actual Make files, why not move that to %prep?

%prep is only meant to prepare the source tree for building. It's not meant to encompass build steps, and by convention the entry point to the build is that first configure / meson setup / cmake invocation. In the configure case this often involves building and running a lot of test programs; it isn't a "pure" operation on files in the way that %prep ideally is.

With sufficient motivation you could run build logic in the %prep stage or patch sources in the %build stage (and our grub and glibc packages kind of do that, respectively). In extreme cases (like our libgcc) the entire build can happen elsewhere. But it's not the convention and it makes the spec "weird" when you do that.

Signed-off-by: Ben Cressey <bcressey@amazon.com>
Signed-off-by: Ben Cressey <bcressey@amazon.com>
Signed-off-by: Ben Cressey <bcressey@amazon.com>
@bcressey bcressey merged commit f2b8e9a into bottlerocket-os:develop Nov 25, 2024
2 checks passed
@bcressey bcressey deleted the nvme-cli-amzn branch November 25, 2024 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

support detailed volume stats via nvme CLI
3 participants