feat(storage): Add external storage backend integration via Sunbeam CLI#544
feat(storage): Add external storage backend integration via Sunbeam CLI#544happyhackerhour wants to merge 8 commits into
Conversation
a79d504 to
73f7b79
Compare
3288a99 to
a4161b5
Compare
wolsen
left a comment
There was a problem hiding this comment.
I'm currently making some inflight comments. I have not had a chance to perform an exhaustive review.
bf6bc4f to
71f46b9
Compare
|
My main comment was lost with that whole shebang of pending review... This is overall a nice work, and thank you very much for your contribution. Can you ensure this is inline with the rest of the code base? |
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a comprehensive storage backend management system for Sunbeam, featuring Terraform-managed Hitachi VSP support, dynamic backend discovery via a pluggable registry, and robust unit testing coverage with 109 tests. The implementation provides CLI commands for storage backend deployment, configuration management, and lifecycle operations.
Key changes:
- Storage backend framework with base classes, service layer, and registry system for dynamic backend discovery
- Hitachi VSP backend implementation with complete Terraform deployment and credential management via Juju secrets
- CLI integration providing commands for add, remove, list, and config operations with both interactive and inline configuration modes
Reviewed Changes
Copilot reviewed 24 out of 26 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| sunbeam/storage/base.py | Base classes and interfaces for storage backend implementations with Terraform integration |
| sunbeam/storage/backends/hitachi/backend.py | Complete Hitachi VSP backend implementation with configuration model and deployment steps |
| sunbeam/storage/backends/hitachi/deploy-hitachi-backend/main.tf | Terraform configuration for Hitachi backend deployment with Juju secrets management |
| sunbeam/storage/registry.py | Dynamic backend discovery and CLI command registration system |
| sunbeam/storage/service.py | Service layer for backend operations and configuration management |
| sunbeam/storage/steps.py | Base step classes for deployment, destruction, and configuration update workflows |
| sunbeam/commands/storage.py | CLI commands for storage backend management |
| tests/unit/sunbeam/storage/ | Comprehensive unit test suite with 109 tests covering all modules |
Comments suppressed due to low confidence (2)
sunbeam-python/sunbeam/storage/steps.py:24
- Import error:
BackendNotFoundExceptionis imported from.modelsbut according to the models.py file, this exception should be imported from.modelswhich is correct. However, there's also an import fromsunbeam.storage.modelson line 25 which creates a redundant import structure. The imports should be consolidated.
from sunbeam.storage.models import BackendNotFoundException
sunbeam-python/sunbeam/storage/backends/hitachi/deploy-hitachi-backend/main.tf:8
- The Juju Terraform provider version "= 0.20.0" may not exist or may be outdated. Consider using a more recent or verified version, or use a version constraint like "~> 0.20" to allow patch updates.
version = "= 0.20.0"
061e4a2 to
9d2e7ed
Compare
|
Hi team, I’ve finished the requested fixes and rewrites, doing my best to align with the current style and patterns across the project. I appreciate your time and effort in reviewing this work! |
976e5af to
0d03b5b
Compare
6841354 to
0bce6e1
Compare
0bce6e1 to
c8ba460
Compare
reimplement Unit testing to conform to new signatures and changes to use terraform
- Fix partial removal regression: write updated Terraform variables before apply - Remove global registry instance, follow Provider pattern for CLI registration - Add Juju application name validation to prevent invalid backend names - Implement atomic removal operations with proper rollback on failure - Add cleanup-config command to resolve invalid backend configurations - Improve error handling and logging throughout storage backend system - Update deprecated Pydantic __fields__ usage for v2 compatibility - Consolidate imports and reduce emoji usage in console output
d245143 to
42f3917
Compare
- Move CLI code to dedicated module (hitachi/cli.py) with proper separation - Remove duplicate backend_exists() methods, consolidate in service layer - Eliminate unused service methods (set/reset_backend_config) and tests - Refactor duplicate config filtering logic into reusable internal function - Clean up storage backend __init__.py files to match provider pattern - Update all CLI and backend code to use service layer properly - Fix missing abstract method implementations in test mocks - Update test mocking to reflect architectural changes All tests pass (1029/1029) with clean, maintainable, well-structured codebase. Signed-off-by: Hugo Vinicius Garcia Razera <root@happyhackerhour.net>
42f3917 to
8b93190
Compare
- Shows friendly error messege on state locks - Verify juju login status, before add and remove. Signed-off-by: Hugo Vinicius Garcia Razera <root@happyhackerhour.net>
1fc9511 to
92ee838
Compare
dd845cc to
f2e54aa
Compare
- Implement PureStorage Backend - separate terraforms-key for each backend
f2e54aa to
45e7a80
Compare
- fix show config options for pure storage
Sunbeam Storage Backend Management
Summary
This PR introduces a comprehensive storage backend management system for Sunbeam with full unit testing coverage. It provides a clean, maintainable framework for managing Cinder storage backends, starting with Hitachi VSP support, featuring separated CLI architecture, dynamic configuration management, and 1029+ tests ensuring reliability.
Context & Related Work
Builds on:
Key Changes
1. Storage Backend Framework (
sunbeam/storage/)base.py- Core service layer withStorageBackendServiceand proper CLI registration hooksregistry.py- Dynamic backend discovery and CLI registration with plugin architectureservice.py- Centralized Terraform state management and backend existence checkingsteps.py- Deployment workflow with comprehensive error handling2. Hitachi VSP Backend (
sunbeam/storage/backends/hitachi/)backend.py- Core deployment and management logic withHitachiConfigPydantic modelcli.py- Dedicated CLI commands with proper separation of concerns3. Dynamic Configuration Management
get_backend_config()- Retrieve current configuration with filteringCLI Commands
Backend Management
Configuration Management
Example Usage
Deploy Backend
Interactive deployment:
$ sunbeam storage add hitachi SAN Management IP: 192.168.1.100 SAN Username: maintenance Storage Pools: pool1,pool2 Protocol: FC ✅ Successfully deployed Hitachi backend 'production-hitachi'Direct deployment with parameters:
$ sunbeam storage add hitachi --name vsp350 \ --san-ip=192.168.1.100 \ --san-username=maintenance \ --san-password=12345 \ --hitachi-pools=pool1,pool2 \ --protocol=FC \ --hitachi-storage-id=123123123Manage Configuration
View configuration:
$ sunbeam storage config show hitachi vsp350 ┏━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━┓ ┃ Configuration Key ┃ Value ┃ ┡━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━┩ │ san-ip │ 192.168.1.100 │ │ san-login │ maintenance │ │ hitachi-pools │ pool1,pool2 │ │ protocol │ FC │ │ san-password │ ******** │ └────────────────────┴────────────────────┘Update configuration:
$ sunbeam storage config set hitachi vsp350 --hitachi-copy-speed=3 ✅ Configuration updated successfullyList available options: