[PR #6730] Fix/thinpool detection as it allows to delete active thinpool with different name than "data" #6835

Open
opened 2025-11-20 08:03:52 -05:00 by saavagebueno · 0 comments
Owner

Original Pull Request: https://github.com/community-scripts/ProxmoxVE/pull/6730

State: closed
Merged: Yes


✍️ Description

Script would allow user to choose to delete an active thinpool with volumes under it:
-> Issue, system thinpool called "data" is excluded here
if [[ "$lv" == "data" || "$lv" == "root" || "$lv" == "swap" || "$lv" =~ ^osd-block- ]]; then

But if custom thinpools exist these will be offered up for deletion by the script:
Example:
image

Fix is avoiding all thinpools, now does not allow the user to delete custom thinpool.
image

I´ve tested functionality after the fix,

lvs -o lv_name,vg_name,lv_size,data_percent,metadata_percent,lv_health_status                                                                                                                                                                                                                                                                                        46m
 lvcreate -V10M -T pve/data -n test-orphan

-> still lable to delete orphan lvm afterwards, and thin-pools are excluded.

Its questionable if actually deleting a thinpool would work if it still has volumes, mine would have open mounts and cmd would fail, but eventually users could be in a state where the cmd would actually succeed and introduce dl? I dont want to test deleting a thinpool.

/dev/nvme0n1p3 (Physical Partition)
└── pve (VG)
├── data (Thin Pool LV) <<<< protected before fix
│ ├── data_tdata (Thin Pool Data LV)
│ └── data_tmeta (Thin Pool Metadata LV)
├── vm-100-disk-0 (Thin LV inside 'data')

/dev/sda (Physical Disk)
└── 4TBSSD (VG)
├── thinpool (Thin Pool LV) <<<< not protected before fix, but after.
│ ├── thinpool_tdata (Thin Pool Data LV)
│ └── thinpool_tmeta (Thin Pool Metadata LV)
├── vm-100-disk-0 (Thin LV inside 'thinpool')

fix is using this logic:

lvs --noheadings -o lv_name,vg_name,lv_size,seg_type --separator ' ' 2>/dev/null | awk '{print $1, $2, $3, $4}'
thinpool 4TBSSD 3.60t thin-pool
                                     ^^^^^                                 
data pve <1.63t thin-pool
                           ^^^^^

Link: #

Prerequisites (X in brackets)

  • [x ] Self-review completed – Code follows project standards.
  • Tested thoroughly – Changes work as expected.
  • [x ] No security risks – No hardcoded secrets, unnecessary privilege escalations, or permission issues.

🛠️ Type of Change (X in brackets)

  • 🐞 Bug fix – Resolves an issue without breaking functionality.
  • New feature – Adds new, non-breaking functionality.
  • 💥 Breaking change – Alters existing functionality in a way that may require updates.
  • 🆕 New script – A fully functional and tested script or script set.
  • 🌍 Website update – Changes to website-related JSON files or metadata.
  • 🔧 Refactoring / Code Cleanup – Improves readability or maintainability without changing functionality.
  • 📝 Documentation update – Changes to README, AppName.md, CONTRIBUTING.md, or other docs.
**Original Pull Request:** https://github.com/community-scripts/ProxmoxVE/pull/6730 **State:** closed **Merged:** Yes --- ## ✍️ Description Script would allow user to choose to delete an active thinpool with volumes under it: -> Issue, system thinpool called "data" is excluded here ` if [[ "$lv" == "data" || "$lv" == "root" || "$lv" == "swap" || "$lv" =~ ^osd-block- ]]; then` But if custom thin**pools** exist these will be offered up for deletion by the script: Example: <img width="492" height="143" alt="image" src="https://github.com/user-attachments/assets/363e9b4d-6d39-469f-8c6b-5d1227927f3a" /> Fix is avoiding all thinpools, now does not allow the user to delete custom thinpool. <img width="343" height="125" alt="image" src="https://github.com/user-attachments/assets/1994bbe7-2a3a-4c47-a987-bd7ca0fa6773" /> I´ve tested functionality after the fix, ``` lvs -o lv_name,vg_name,lv_size,data_percent,metadata_percent,lv_health_status 46m lvcreate -V10M -T pve/data -n test-orphan ``` -> still lable to delete orphan lvm afterwards, and thin-pools are excluded. Its questionable if actually deleting a thinpool would work if it still has volumes, mine would have open mounts and cmd would fail, but eventually users could be in a state where the cmd would actually succeed and introduce dl? I dont want to test deleting a thinpool. /dev/nvme0n1p3 (Physical Partition) └── pve (VG) ├── data (Thin Pool LV) <<<< protected before fix │ ├── data_tdata (Thin Pool Data LV) │ └── data_tmeta (Thin Pool Metadata LV) ├── vm-100-disk-0 (Thin LV inside 'data') /dev/sda (Physical Disk) └── 4TBSSD (VG) ├── thinpool (Thin Pool LV) <<<< not protected before fix, but after. │ ├── thinpool_tdata (Thin Pool Data LV) │ └── thinpool_tmeta (Thin Pool Metadata LV) ├── vm-100-disk-0 (Thin LV inside 'thinpool') fix is using this logic: ``` lvs --noheadings -o lv_name,vg_name,lv_size,seg_type --separator ' ' 2>/dev/null | awk '{print $1, $2, $3, $4}' thinpool 4TBSSD 3.60t thin-pool ^^^^^ data pve <1.63t thin-pool ^^^^^ ``` ## 🔗 Related PR / Issue Link: # ## ✅ Prerequisites (**X** in brackets) - [x ] **Self-review completed** – Code follows project standards. - [x] **Tested thoroughly** – Changes work as expected. - [x ] **No security risks** – No hardcoded secrets, unnecessary privilege escalations, or permission issues. --- ## 🛠️ Type of Change (**X** in brackets) - [x] 🐞 **Bug fix** – Resolves an issue without breaking functionality. - [ ] ✨ **New feature** – Adds new, non-breaking functionality. - [ ] 💥 **Breaking change** – Alters existing functionality in a way that may require updates. - [ ] 🆕 **New script** – A fully functional and tested script or script set. - [ ] 🌍 **Website update** – Changes to website-related JSON files or metadata. - [ ] 🔧 **Refactoring / Code Cleanup** – Improves readability or maintainability without changing functionality. - [ ] 📝 **Documentation update** – Changes to `README`, `AppName.md`, `CONTRIBUTING.md`, or other docs.
saavagebueno added the pull-request label 2025-11-20 08:03:52 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SVI/ProxmoxVE#6835