Skip to content

Fix crash on systems with broken stratis pools#1464

Merged
vojtechtrefny merged 1 commit intostoraged-project:mainfrom
vojtechtrefny:main_stratis-stopped-pool-fix
Apr 20, 2026
Merged

Fix crash on systems with broken stratis pools#1464
vojtechtrefny merged 1 commit intostoraged-project:mainfrom
vojtechtrefny:main_stratis-stopped-pool-fix

Conversation

@vojtechtrefny
Copy link
Copy Markdown
Member

@vojtechtrefny vojtechtrefny commented Apr 8, 2026

A broken or partially created stratis pool can be reported as stopped without a name. In this case we fail to gather the info about it and crash. We can't work with devices without a name so we need to completely ignore these pools.

Related: stratis-storage/project#861

Summary by CodeRabbit

  • Bug Fixes
    • Improved validation and robustness when processing stopped storage pools: the system now detects missing pool names, logs warnings, and skips creating or registering pool devices when required metadata is absent, preventing invalid configurations and related errors.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 8, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: bbead04b-7ac9-4b41-8619-6daecc0012b0

📥 Commits

Reviewing files that changed from the base of the PR and between d2126a8 and ae92b5a.

📒 Files selected for processing (2)
  • blivet/populator/helpers/stratis.py
  • blivet/static_data/stratis_info.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • blivet/populator/helpers/stratis.py

📝 Walkthrough

Walkthrough

Added defensive checks for missing or empty Stratis pool names: stopped-pool name extraction now handles absent "name" fields, and creation of StratisPoolDevice returns early with a warning if the pool name is missing.

Changes

Cohort / File(s) Summary
Stratis stopped-pool handling
blivet/static_data/stratis_info.py, blivet/populator/helpers/stratis.py
Guarded extraction of stopped Stratis pool name (checks for key presence and logs if absent). In device creation, validate pool_info.name and log/return when missing to avoid creating unnamed StratisPoolDevice.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fix crash on systems with broken stratis pools' directly and accurately summarizes the main change: addressing a crash that occurs with broken/unnamed Stratis pools.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@blivet/static_data/stratis_info.py`:
- Around line 214-224: The code currently logs unnamed stopped pools but still
appends a StratisStoppedPoolInfo with name=None to stopped_pools; change this so
when pools_info[pool_uuid] lacks "name" you log the warning and skip
creating/appending the StratisStoppedPoolInfo (i.e., do not construct
StratisStoppedPoolInfo or append to stopped_pools for that pool_uuid), leaving
only pools with a valid name in stopped_pools.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1f403a0f-610a-4b93-8cc9-0dba45bc3c50

📥 Commits

Reviewing files that changed from the base of the PR and between 27ca797 and d2126a8.

📒 Files selected for processing (2)
  • blivet/populator/helpers/stratis.py
  • blivet/static_data/stratis_info.py

Comment thread blivet/static_data/stratis_info.py
@vojtechtrefny vojtechtrefny requested a review from tasleson April 9, 2026 10:04
Copy link
Copy Markdown
Member

@tasleson tasleson left a comment

Choose a reason for hiding this comment

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

My initial reaction was LGTM, but after a more detailed review, I think there is some ideas that should be considered before committing which I've noted in the review.

Also, what is the state of the devices key? Does it have valid entries or empties when this occurs? Do we need code guards for this or is it just the name that is absent? Do we want to be able to handle total garbage in the future if stratis breaks in different ways?

I also think it would be helpful to reference the stratis bug issue in the commit message. So that someone visiting this commit in the future can see what happened with stratis. I'm assuming that there is a plan for fixing it.

pool_name = pools_info[pool_uuid]["name"].get_string()
else:
log.warning("Stopped Stratis pool %s does not have name", pool_uuid)
pool_name = None
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Previously, the namedtuple StratisStoppedPoolInfo.pool_name had a type of string. With this change it can now be None. This could possibly cause a user of blivet to run into an error if they assume it will always be a valid string. Thus, it's kind of a subtle public API change. One could argue that changing this to an empty string would be more appropriate as it preserves the data type. However, the counter argument could be made that None forces caller to specifically address when their code blows up instead of silently displaying an empty string.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fortunately the static_data module is not part of the public API.

Comment thread blivet/populator/helpers/stratis.py Outdated
if not pool_info.name:
# no name -> probably broken or partially constructed pool
# we cannot add a device without name
log.warning("Ignoring stopped stratis pool without name")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please add the pool uuid to the warning, so that someone debugging can know which pool this is, for correlation.

log.warning("Ignoring stopped stratis pool %s without name", pool_info.uuid))

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good point, fixed.

A broken or partially created stratis pool can be reported as
stopped without a name. In this case we fail to gather the info
about it and crash. We can't work with devices without a name so
we need to completely ignore these pools.
@vojtechtrefny vojtechtrefny force-pushed the main_stratis-stopped-pool-fix branch from d2126a8 to ae92b5a Compare April 14, 2026 08:23
@vojtechtrefny vojtechtrefny merged commit d3dc423 into storaged-project:main Apr 20, 2026
14 of 16 checks passed
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.

2 participants