Skip to content

Conversation

@michelroegl-brunner
Copy link
Member

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

- Add automatic disk resizing when changing LXC disk size in settings
- Implement separate modal flow: confirmation -> loading -> result -> settings
- Add proper error detection for pct resize command (check both exit code and output)
- Add LVM fallback resize method when pct resize fails
- Implement configuration rollback on resize failure
- Update modal styling to use semantic color classes for proper dark mode support
- Add data refresh after result modal close to show updated values
- Remove success/error banners from settings modal for cleaner UI
@michelroegl-brunner michelroegl-brunner requested a review from a team as a code owner October 17, 2025 11:33
@michelroegl-brunner michelroegl-brunner changed the title feat: implement disk resize with improved modal flow and error handling feat: implement disk resize in LXC settings Oct 17, 2025
@michelroegl-brunner michelroegl-brunner merged commit 08b7eec into main Oct 17, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants