[PR #10745] [MERGED] core: add storage validation & fix GB/MB display #8968

Closed
opened 2026-02-26 16:34:42 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/community-scripts/ProxmoxVE/pull/10745
Author: @MickLesk
Created: 1/12/2026
Status: Merged
Merged: 1/12/2026
Merged by: @michelroegl-brunner

Base: mainHead: core_hdd_fix


📝 Commits (1)

  • 06bf84c feat(storage): Add unified storage validation & fix GB/MB display

📊 Changes

1 file changed (+91 additions, -15 deletions)

View changed files

📝 misc/build.func (+91 -15)

📄 Description

✍️ Description

Fixed storage size calculation - pvesm outputs KiB but was treated as bytes.
Added validate_storage_space() function for all storage types (dir, lvm, zfs, nfs, cifs).
Validation now runs in all modes: Default, Advanced, User Defaults, and App Defaults.

Before: 16.1MB/318.3MB → After: 16.1GB/318.3GB
Returns: 0=OK, 1=Low space, 2=Unavailable"

flowchart TD
    Start([PROXMOX CONTAINER INSTALLATION<br/>install_script]) --> Menu{User selects<br/>installation mode}
    
    Menu -->|Option 1| Default[Default Install]
    Menu -->|Option 2| Advanced[Advanced Install]
    Menu -->|Option 3| UserDef[User Defaults]
    Menu -->|Option 4| AppDef[App Defaults]
    
    Default --> Ensure[ensure_storage_selection_for_vars_file<br/>Loads or selects storage]
    Advanced --> Ensure
    UserDef --> Ensure
    AppDef --> Ensure
    
    Ensure --> VarsCheck{Storages from<br/>.vars exists?}
    
    VarsCheck -->|YES| LoadVars[Load from .vars file<br/>LINE 1209<br/>validate_storage_space]
    VarsCheck -->|NO| ChooseStorage[choose_and_set_storage_for_file]
    
    ChooseStorage --> OneStorage{Only 1 storage<br/>available?}
    
    OneStorage -->|YES| AutoPick[Auto-Pick Storage<br/>LINE 516<br/>validate_storage_space<br/>⚠️ Warning]
    OneStorage -->|NO| SelectStorage[select_storage<br/>Whiptail Dialog]
    
    SelectStorage --> UserSelect[User selects storage<br/>LINE 3692<br/>validate_storage_space<br/>⚠️ Warning on low space]
    
    LoadVars --> BuildContainer
    AutoPick --> BuildContainer
    UserSelect --> BuildContainer
    
    BuildContainer[build_container] --> FinalCheck[FINAL VALIDATION<br/>LINE 2989<br/>validate_storage_space<br/>🛡️ Hard Check]
    
    FinalCheck --> SpaceCheck{Enough space?}
    
    SpaceCheck -->|NO| Error[❌ EXIT 214<br/>msg_error: Not enough space<br/>Required: XX GB<br/>Available: XX GB]
    SpaceCheck -->|YES| Create[create_lxc_container<br/>pct create ...]
    
    Create --> Success[✅ Container created<br/>GPU/USB Config<br/>Start & Install]
    
    style Start fill:#2d5a7b,stroke:#4a90c2,stroke-width:3px,color:#fff
    style BuildContainer fill:#2d5a7b,stroke:#4a90c2,stroke-width:3px,color:#fff
    style FinalCheck fill:#7b2d2d,stroke:#c24a4a,stroke-width:3px,color:#fff
    style Error fill:#7b2d2d,stroke:#c24a4a,stroke-width:2px,color:#fff
    style Success fill:#2d7b4a,stroke:#4ac268,stroke-width:2px,color:#fff
    style LoadVars fill:#5a4a2d,stroke:#c2a04a,stroke-width:2px,color:#fff
    style AutoPick fill:#5a4a2d,stroke:#c2a04a,stroke-width:2px,color:#fff
    style UserSelect fill:#5a4a2d,stroke:#c2a04a,stroke-width:2px,color:#fff

Fixes #

Prerequisites (X in brackets)

  • Self-review completed – Code follows project standards.
  • Tested thoroughly – Changes work as expected.
  • 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.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/community-scripts/ProxmoxVE/pull/10745 **Author:** [@MickLesk](https://github.com/MickLesk) **Created:** 1/12/2026 **Status:** ✅ Merged **Merged:** 1/12/2026 **Merged by:** [@michelroegl-brunner](https://github.com/michelroegl-brunner) **Base:** `main` ← **Head:** `core_hdd_fix` --- ### 📝 Commits (1) - [`06bf84c`](https://github.com/community-scripts/ProxmoxVE/commit/06bf84c475dacd60d4678b90b8feb7b57de1fe32) feat(storage): Add unified storage validation & fix GB/MB display ### 📊 Changes **1 file changed** (+91 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `misc/build.func` (+91 -15) </details> ### 📄 Description <!--🛑 New scripts must be submitted to [ProxmoxVED](https://github.com/community-scripts/ProxmoxVED) for testing. PRs without prior testing will be closed. --> ## ✍️ Description Fixed storage size calculation - pvesm outputs KiB but was treated as bytes. Added validate_storage_space() function for all storage types (dir, lvm, zfs, nfs, cifs). Validation now runs in all modes: Default, Advanced, User Defaults, and App Defaults. Before: 16.1MB/318.3MB → After: 16.1GB/318.3GB Returns: 0=OK, 1=Low space, 2=Unavailable" ```mermaid flowchart TD Start([PROXMOX CONTAINER INSTALLATION<br/>install_script]) --> Menu{User selects<br/>installation mode} Menu -->|Option 1| Default[Default Install] Menu -->|Option 2| Advanced[Advanced Install] Menu -->|Option 3| UserDef[User Defaults] Menu -->|Option 4| AppDef[App Defaults] Default --> Ensure[ensure_storage_selection_for_vars_file<br/>Loads or selects storage] Advanced --> Ensure UserDef --> Ensure AppDef --> Ensure Ensure --> VarsCheck{Storages from<br/>.vars exists?} VarsCheck -->|YES| LoadVars[Load from .vars file<br/>LINE 1209<br/>validate_storage_space] VarsCheck -->|NO| ChooseStorage[choose_and_set_storage_for_file] ChooseStorage --> OneStorage{Only 1 storage<br/>available?} OneStorage -->|YES| AutoPick[Auto-Pick Storage<br/>LINE 516<br/>validate_storage_space<br/>⚠️ Warning] OneStorage -->|NO| SelectStorage[select_storage<br/>Whiptail Dialog] SelectStorage --> UserSelect[User selects storage<br/>LINE 3692<br/>validate_storage_space<br/>⚠️ Warning on low space] LoadVars --> BuildContainer AutoPick --> BuildContainer UserSelect --> BuildContainer BuildContainer[build_container] --> FinalCheck[FINAL VALIDATION<br/>LINE 2989<br/>validate_storage_space<br/>🛡️ Hard Check] FinalCheck --> SpaceCheck{Enough space?} SpaceCheck -->|NO| Error[❌ EXIT 214<br/>msg_error: Not enough space<br/>Required: XX GB<br/>Available: XX GB] SpaceCheck -->|YES| Create[create_lxc_container<br/>pct create ...] Create --> Success[✅ Container created<br/>GPU/USB Config<br/>Start & Install] style Start fill:#2d5a7b,stroke:#4a90c2,stroke-width:3px,color:#fff style BuildContainer fill:#2d5a7b,stroke:#4a90c2,stroke-width:3px,color:#fff style FinalCheck fill:#7b2d2d,stroke:#c24a4a,stroke-width:3px,color:#fff style Error fill:#7b2d2d,stroke:#c24a4a,stroke-width:2px,color:#fff style Success fill:#2d7b4a,stroke:#4ac268,stroke-width:2px,color:#fff style LoadVars fill:#5a4a2d,stroke:#c2a04a,stroke-width:2px,color:#fff style AutoPick fill:#5a4a2d,stroke:#c2a04a,stroke-width:2px,color:#fff style UserSelect fill:#5a4a2d,stroke:#c2a04a,stroke-width:2px,color:#fff ``` ## 🔗 Related Issue Fixes # ## ✅ 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) - [ ] 🐞 **Bug fix** – Resolves an issue without breaking functionality. - [x] ✨ **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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-26 16:34:42 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ProxmoxVE#8968
No description provided.