Skip to content

Conversation

@ixhamza
Copy link
Member

@ixhamza ixhamza commented Nov 5, 2025

Motivation and Context

Currently, zpool status lacks an option to exclude specific pools from output. Useful for hiding test/backup/boot pools when monitoring systems with many pools.

Description

Adds -E flag to exclude specified pools from output. Takes comma-separated pool names and filters them out.
Example: zpool status -E tank,backup excludes tank and backup, showing all other pools.

How Has This Been Tested?

Manually tested exclusion from all pools and specific pools, edge cases (trailing commas, duplicate flags, invalid arguments), and combination with other flags.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Quality assurance (non-breaking change which makes the code more robust against bugs)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

Adds -E flag to exclude comma-separated pools from zpool status output.
Usage: 'zpool status -E tank,backup' shows all pools except tank and
backup.

Signed-off-by: Ameer Hamza <ahamza@ixsystems.com>
@ixhamza ixhamza force-pushed the zpool-status-exclude branch from 0d49d3b to 88f5dea Compare November 5, 2025 15:34
Copy link
Contributor

@behlendorf behlendorf left a comment

Choose a reason for hiding this comment

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

Actually there is an existing undocumented interface to exclude pools. The __ZFS_POOL_EXCLUDE environment variable can be set with a list of pools to exclude and it's applied to all of the subcommands. This is used by the test suite today to protect existing pools on a test system. I think adding a proper command line option for this is useful, but we should 1) add it to all the subcommands where it makes sense, and 2) use the same code internally to implement both the -E flag and __ZFS_POOL_EXCLUDE environment variable.

@behlendorf behlendorf added the Status: Code Review Needed Ready for review and testing label Nov 5, 2025
@ixhamza
Copy link
Member Author

ixhamza commented Nov 5, 2025

Thanks @behlendorf for the feedback, totally agreed. I'll extend it to all applicable subcommands and integrate with __ZFS_POOL_EXCLUDE using a shared implementation. Will update the patch.

@ixhamza ixhamza added the Status: Work in Progress Not yet ready for general review label Nov 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: Code Review Needed Ready for review and testing Status: Work in Progress Not yet ready for general review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants