cli: Remove images of a deleted pool without their data #189

Open
koolkhel wants to merge 3 commits from koolkhel/vitastor:rm-image-deleted-pool into master
Contributor

Description

rm-pool --force leaves the pool's images in /config/inode, and rm could never remove them: it marked the image deleted and then failed with "Pool does not exist", or hung while the monitor was still removing the pool's PGs, because the pool stays in pool_config with exists=false until then.

Remove a layer without its data when its pool is missing from /config/pools. The pool IDs present there are tracked in etcd_state_client_t::pools_in_config, because exists is also false for a pool that is listed but fails validation (for example, a configuration written by a newer version): such a pool keeps its images, and rm refuses as before. Removing layers with children in a deleted pool is refused with a clear error, since merging needs their data (the CLI crashed on the missing pool there). rm-data treats a pool with exists=false as missing, so it does not wait for PGs of a deleted pool.

Found: seen on a test cluster: after rm-pool --force on a pool with an image, rm of the image failed with "Pool does not exist" every time and the image stayed in ls with the deleted flag. Reproduced on master by the new test, where rm hangs while the PGs of the deleted pool are still in /pg/config.

Tested: tests/test_rm_deleted_pool.sh (fails on master, passes with the fix; its invalid-configuration step also fails without the second commit)

Contributor Name

Yury Luneff (MIND Software LLC, https://mindsw.io)

CLA

### Description rm-pool --force leaves the pool's images in /config/inode, and rm could never remove them: it marked the image deleted and then failed with "Pool does not exist", or hung while the monitor was still removing the pool's PGs, because the pool stays in pool_config with exists=false until then. Remove a layer without its data when its pool is missing from /config/pools. The pool IDs present there are tracked in `etcd_state_client_t::pools_in_config`, because `exists` is also false for a pool that is listed but fails validation (for example, a configuration written by a newer version): such a pool keeps its images, and rm refuses as before. Removing layers with children in a deleted pool is refused with a clear error, since merging needs their data (the CLI crashed on the missing pool there). rm-data treats a pool with exists=false as missing, so it does not wait for PGs of a deleted pool. Found: seen on a test cluster: after `rm-pool --force` on a pool with an image, `rm` of the image failed with "Pool does not exist" every time and the image stayed in `ls` with the deleted flag. Reproduced on master by the new test, where `rm` hangs while the PGs of the deleted pool are still in /pg/config. Tested: tests/test_rm_deleted_pool.sh (fails on master, passes with the fix; its invalid-configuration step also fails without the second commit) ### Contributor Name Yury Luneff (MIND Software LLC, https://mindsw.io) ### CLA - [x] I accept Vitastor CLA agreement: https://git.yourcmc.ru/vitalif/vitastor/src/branch/master/CLA-en.md
koolkhel added 1 commit 2026-11-25 20:14:51 +03:00
rm-pool --force leaves the pool's images in /config/inode, and rm could
never remove them: it marked the image deleted and then failed with
"Pool does not exist", or hung while the monitor was still removing the
pool's PGs, because the pool stays in pool_config with exists=false
until then.

Skip the data of a layer whose pool is gone and remove only its
metadata. Treat a pool with exists=false as missing in rm-data and in
rm's statistics read too, so neither waits for PGs of a deleted pool.
koolkhel added 1 commit 2026-11-26 02:18:56 +03:00
pool_config's exists flag is also false for a pool whose configuration
fails validation, for example one written by a newer version, and rm
then removed such a pool's images without their data. Track the pool
IDs present in /config/pools and remove a layer without its data only
when its pool is not there.

Refuse to remove layers with children when a pool of the merge is
deleted: merging needs the data, and the CLI crashed on the missing
pool. Print the warning about the skipped data with --json too.
koolkhel added 1 commit 2026-11-26 08:34:29 +03:00
The test accepted any non-zero exit code there, so a hang killed by
timeout (124) passed it as well.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u rm-image-deleted-pool:koolkhel-rm-image-deleted-pool
git checkout koolkhel-rm-image-deleted-pool
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: vitalif/vitastor#189
No description provided.