Skip to content

Storage Framework Implementation#609

Merged
hemanthnakkina merged 4 commits into
canonical:mainfrom
gboutry:feat/storage-cli
Nov 5, 2025
Merged

Storage Framework Implementation#609
hemanthnakkina merged 4 commits into
canonical:mainfrom
gboutry:feat/storage-cli

Conversation

@gboutry
Copy link
Copy Markdown
Collaborator

@gboutry gboutry commented Oct 22, 2025

This pull requests introduces the Sunbeam Storage Framework. This framework goal is to simplify enabling third party backend storage solutions in Sunbeam.
First iteration is only enabling cinder backends, but as the feature evolves, Manila shall also be a target.

For simplicy, a backend is defined by:

  • A pydantic configuration, basemodel holding no default values except None when the value is not required
  • A Backend class that will define the strict minimum information about this backend. (Charm, channel...)

Backends can be defined inside the manifest. this will lead, when using sunbeam storage add <type> <name> --accept-defaults, to an automated installation, without user interaction.

Risk enablement, by default, any new storage backend shall be available only under beta and edge channel. After proof of rigorous testing only, can a backend be promoted to "stable-r" risks.

Based on the contribution from @happyhackerhour
#544

fix: tox -e fmt, pep8, mypy

reimplement Unit testing to conform to new signatures and changes to use terraform

Fix storage backend removal regression and address reviewer comments

- 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

refactor: clean up Hitachi backend CLI and eliminate code duplication

- 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

Signed-off-by: Hugo Vinicius Garcia Razera <root@happyhackerhour.net>

- Retry apply and destroy plans on terraform locks
- 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>

- Refactor common Backend Methods into Base Class
- Implement PureStorage Backend
- separate terraforms-key for each backend

- Implementaion of Dell Storage Center Backend
- fix show config options for pure storage
@gboutry gboutry requested a review from Copilot October 22, 2025 10:59
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request introduces the Sunbeam Storage Framework, enabling third-party backend storage solutions for Cinder. The implementation provides a pluggable architecture where backends are defined by Pydantic configuration models and backend classes, with support for automated installation via manifest definitions.

Key Changes:

  • Implements base storage framework with pluggable backend architecture
  • Adds three initial backend implementations: Hitachi VSP, Pure Storage FlashArray, and Dell Storage Center
  • Introduces Terraform-based deployment infrastructure for storage backends
  • Adds database schema and API endpoints for storage backend management

Reviewed Changes

Copilot reviewed 44 out of 45 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
sunbeam-python/sunbeam/storage/*.py Core storage framework files including base classes, models, service layer, and CLI
sunbeam-python/sunbeam/storage/backends/*/backend.py Backend-specific implementations for Hitachi, Pure Storage, and Dell SC
sunbeam-python/tests/unit/sunbeam/storage/*.py Comprehensive test suite covering framework and backend implementations
sunbeam-microcluster/*.go Backend storage database schema and API endpoints
cloud/etc/deploy-storage/*.tf Terraform modules for deploying storage backends
sunbeam-python/sunbeam/core/manifest.py Manifest extensions for storage configuration
sunbeam-python/sunbeam/main.py Storage manager registration in main CLI

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread sunbeam-microcluster/database/storage_backend.mapper.go Outdated
Comment thread sunbeam-microcluster/database/storage_backend.mapper.go Outdated
@gboutry gboutry requested a review from Copilot October 22, 2025 11:50
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 44 out of 45 changed files in this pull request and generated 5 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread sunbeam-python/sunbeam/storage/backends/purestorage/backend.py
Comment thread sunbeam-python/sunbeam/storage/backends/hitachi/backend.py
Comment thread sunbeam-python/sunbeam/storage/backends/dellsc/backend.py
Comment thread sunbeam-microcluster/database/storage_backend.mapper.go Outdated
Comment thread sunbeam-microcluster/database/storage_backend.mapper.go Outdated
Copy link
Copy Markdown
Collaborator

@hemanthnakkina hemanthnakkina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! One minor nit

Comment thread sunbeam-python/sunbeam/core/manifest.py Outdated
Based on the assumptions that only a single subordinate charm is
required, simplify the backends to only contain: a pydantic config,
holding no default values (except none), and a backend instance to host
the backend specific values (charm, channel...).

Implement the a storage-backends api/database in clusterd to have a
single managed places where we store these information.

Remove backend_type from all commands except add, we don't support
having multiple backends named the same way across providers.

Signed-off-by: Guillaume Boutry <guillaume.boutry@canonical.com>
Validate interactive questions from the user using pydantic.
Merge generate question functions as they have the same purpose.

Signed-off-by: Guillaume Boutry <guillaume.boutry@canonical.com>
wolsen
wolsen previously approved these changes Oct 24, 2025
Copy link
Copy Markdown
Collaborator

@wolsen wolsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few minor comments in-line, but nothing major. I think that this PR is already large enough and would like to see follow up patches to address relevant comments - specifically the drivers that are unsupported in the upstream should have an indicator as such. Until then, this can be handled in documentation.

Comment thread sunbeam-python/sunbeam/storage/manager.py Outdated
return

table = Table(title="Storage Backends")
table.add_column("Name", style="cyan")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I'm not sure we really need / want the colors in here? We can follow up in a separate PR though as this is already large enough.



@pytest.fixture
def dellsc_backend():
Copy link
Copy Markdown
Collaborator

@wolsen wolsen Oct 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will note that the dellsc backend FC and iSCSI backends are unsupported in the upstream as they don't have voting CI tests. We should potentially find a way to mark that this is an unsupported driver. Unsupported drivers risk being removed in the upstream.

Signed-off-by: Guillaume Boutry <guillaume.boutry@canonical.com>
@hemanthnakkina hemanthnakkina merged commit bf06431 into canonical:main Nov 5, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants