[PR #177] [MERGED] feat: implement disk resize in LXC settings #257

Closed
opened 2026-02-26 12:40:46 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/community-scripts/ProxmoxVE-Local/pull/177
Author: @michelroegl-brunner
Created: 10/17/2025
Status: Merged
Merged: 10/17/2025
Merged by: @michelroegl-brunner

Base: mainHead: feat/storage_resize


📝 Commits (1)

  • 0292034 feat: implement disk resize with improved modal flow and error handling

📊 Changes

2 files changed (+490 additions, -34 deletions)

View changed files

📝 src/app/_components/LXCSettingsModal.tsx (+133 -33)
📝 src/server/api/routers/installedScripts.ts (+357 -1)

📄 Description

Summary

This PR implements automatic disk resizing when changing LXC disk size in the settings modal, along with a complete modal flow redesign and robust error handling.

Features Added

🔧 Disk Resize Functionality

  • Automatic disk resizing: When changing disk size in LXC settings, the actual disk is now resized automatically
  • Size validation: Only allows increasing disk size for safety
  • Multiple resize methods: Primary pct resize command with LVM fallback (lvresize, resize2fs/xfs_growfs)
  • Configuration rollback: If resize fails, the configuration file is automatically rolled back

🎨 Improved Modal Flow

  • Confirmation Modal: User confirms disk resize operation
  • Loading Modal: Shows spinner during processing with descriptive text
  • Result Modal: Separate success/error modal that doesn't close automatically
  • Settings Modal: Reopens with updated values after result modal closes
  • Clean UI: Removed success/error banners from settings modal

🐛 Enhanced Error Handling

  • Better error detection: Now checks both exit code AND error output from commands
  • Detailed error messages: Captures and displays specific error details (e.g., "Insufficient free space")
  • Error propagation: Proper error flow from SSH commands through to UI
  • Debug logging: Added comprehensive logging for troubleshooting

🎨 UI/UX Improvements

  • Semantic colors: Updated modal styling to use CSS custom properties for proper dark mode support
  • Consistent styling: Result modals now match the application's design system
  • Responsive design: Proper mobile and tablet support
  • Data refresh: Settings modal shows updated values after successful operations

Technical Details

Backend Changes (installedScripts.ts)

  • Added parseRootfsStorage() helper to parse storage pool and disk ID
  • Added extractSizeInGB() helper for size conversion
  • Enhanced resizeDisk() function with proper error detection
  • Added tryLVMResize() fallback method
  • Implemented configuration rollback mechanism

Frontend Changes (LXCSettingsModal.tsx)

  • Added new state management for modal flow
  • Updated save mutation handlers for new flow
  • Added result modal component with proper styling
  • Implemented data refresh after operations
  • Removed banner-based notifications

Error Detection Fix

The main bug fix addresses the issue where pct resize returns exit code 0 even when it fails with "Insufficient free space". The solution checks both:

  • Exit code (0 = success, non-zero = failure)
  • Error output content (looks for "error" or "insufficient" keywords)

Testing

  • Successful disk resize (11G → 12G)
  • Error handling for insufficient space
  • Configuration rollback on failure
  • Proper modal flow and user feedback
  • Dark mode styling consistency

🔄 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-Local/pull/177 **Author:** [@michelroegl-brunner](https://github.com/michelroegl-brunner) **Created:** 10/17/2025 **Status:** ✅ Merged **Merged:** 10/17/2025 **Merged by:** [@michelroegl-brunner](https://github.com/michelroegl-brunner) **Base:** `main` ← **Head:** `feat/storage_resize` --- ### 📝 Commits (1) - [`0292034`](https://github.com/community-scripts/ProxmoxVE-Local/commit/02920349003f5cc821dcfb9fec0dc075d04f7233) feat: implement disk resize with improved modal flow and error handling ### 📊 Changes **2 files changed** (+490 additions, -34 deletions) <details> <summary>View changed files</summary> 📝 `src/app/_components/LXCSettingsModal.tsx` (+133 -33) 📝 `src/server/api/routers/installedScripts.ts` (+357 -1) </details> ### 📄 Description ## Summary This PR implements automatic disk resizing when changing LXC disk size in the settings modal, along with a complete modal flow redesign and robust error handling. ## Features Added ### 🔧 Disk Resize Functionality - **Automatic disk resizing**: When changing disk size in LXC settings, the actual disk is now resized automatically - **Size validation**: Only allows increasing disk size for safety - **Multiple resize methods**: Primary `pct resize` command with LVM fallback (`lvresize`, `resize2fs`/`xfs_growfs`) - **Configuration rollback**: If resize fails, the configuration file is automatically rolled back ### 🎨 Improved Modal Flow - **Confirmation Modal**: User confirms disk resize operation - **Loading Modal**: Shows spinner during processing with descriptive text - **Result Modal**: Separate success/error modal that doesn't close automatically - **Settings Modal**: Reopens with updated values after result modal closes - **Clean UI**: Removed success/error banners from settings modal ### 🐛 Enhanced Error Handling - **Better error detection**: Now checks both exit code AND error output from commands - **Detailed error messages**: Captures and displays specific error details (e.g., "Insufficient free space") - **Error propagation**: Proper error flow from SSH commands through to UI - **Debug logging**: Added comprehensive logging for troubleshooting ### 🎨 UI/UX Improvements - **Semantic colors**: Updated modal styling to use CSS custom properties for proper dark mode support - **Consistent styling**: Result modals now match the application's design system - **Responsive design**: Proper mobile and tablet support - **Data refresh**: Settings modal shows updated values after successful operations ## Technical Details ### Backend Changes (`installedScripts.ts`) - Added `parseRootfsStorage()` helper to parse storage pool and disk ID - Added `extractSizeInGB()` helper for size conversion - Enhanced `resizeDisk()` function with proper error detection - Added `tryLVMResize()` fallback method - Implemented configuration rollback mechanism ### Frontend Changes (`LXCSettingsModal.tsx`) - Added new state management for modal flow - Updated save mutation handlers for new flow - Added result modal component with proper styling - Implemented data refresh after operations - Removed banner-based notifications ### Error Detection Fix The main bug fix addresses the issue where `pct resize` returns exit code 0 even when it fails with "Insufficient free space". The solution checks both: - Exit code (0 = success, non-zero = failure) - Error output content (looks for "error" or "insufficient" keywords) ## Testing - ✅ Successful disk resize (11G → 12G) - ✅ Error handling for insufficient space - ✅ Configuration rollback on failure - ✅ Proper modal flow and user feedback - ✅ Dark mode styling consistency --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-26 12:40:46 +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-Local#257
No description provided.