forked from gnuoy/snap-openstack
-
Notifications
You must be signed in to change notification settings - Fork 36
storage: add Dell Unity and Huawei Dorado backends #805
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ahmad-can
wants to merge
2
commits into
canonical:main
Choose a base branch
from
ahmad-can:feature/generate-charm-dell-unity-and-huawei-dorado
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Empty file.
113 changes: 113 additions & 0 deletions
113
sunbeam-python/sunbeam/storage/backends/dellunity/backend.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| # SPDX-FileCopyrightText: 2025 - Canonical Ltd | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| """Dell Unity backend implementation using base step classes.""" | ||
|
|
||
| import logging | ||
| from enum import StrEnum | ||
| from typing import Annotated | ||
|
|
||
| from pydantic import Field | ||
| from rich.console import Console | ||
|
|
||
| from sunbeam.core.manifest import StorageBackendConfig | ||
| from sunbeam.storage.base import StorageBackendBase | ||
| from sunbeam.storage.models import SecretDictField | ||
|
|
||
| LOG = logging.getLogger(__name__) | ||
| console = Console() | ||
|
|
||
|
|
||
| class Protocol(StrEnum): | ||
| """Enumeration of valid protocol types.""" | ||
|
|
||
| ISCSI = "iscsi" | ||
| FC = "fc" | ||
|
|
||
|
|
||
| class DellunityConfig(StorageBackendConfig): | ||
| """Configuration model for Dell Unity backend. | ||
|
|
||
| This model includes ALL configuration options for the backend. | ||
| Additional configuration can be managed dynamically through the charm. | ||
| """ | ||
|
|
||
| # Mandatory connection parameters | ||
| san_ip: Annotated[str, Field(description="IP address of SAN controller")] | ||
| san_login: Annotated[ | ||
| str, | ||
| Field(description="Username for SAN controller"), | ||
| SecretDictField(field="san-login"), | ||
| ] | ||
| san_password: Annotated[ | ||
| str, | ||
| Field(description="Password for SAN controller"), | ||
| SecretDictField(field="san-password"), | ||
| ] | ||
|
|
||
| # Optional backend configuration | ||
| protocol: Annotated[ | ||
| Protocol | None, | ||
| Field(description="Protocol selector: iscsi, fc."), | ||
| ] = None | ||
| unity_storage_pool_names: Annotated[ | ||
| str | None, | ||
| Field(description="A comma-separated list of storage pool names to be used."), | ||
| ] = None | ||
| unity_io_ports: Annotated[ | ||
| str | None, | ||
| Field(description="A comma-separated list of iSCSI or FC ports to be used."), | ||
| ] = None | ||
| remove_empty_host: Annotated[ | ||
| bool | None, | ||
| Field( | ||
| description=( | ||
| "To remove the host from Unity when the last LUN is detached from it." | ||
| ) | ||
| ), | ||
| ] = None | ||
| san_thin_provision: Annotated[ | ||
| bool | None, | ||
| Field(description="Use thin provisioning for SAN volumes?"), | ||
| ] = None | ||
| use_multipath_for_image_xfer: Annotated[ | ||
| bool | None, | ||
| Field(description="Enable multipathing for image transfer operations."), | ||
| ] = None | ||
|
|
||
|
|
||
| class DellunityBackend(StorageBackendBase): | ||
| """Dell Unity backend implementation.""" | ||
|
|
||
| backend_type = "dellunity" | ||
| display_name = "Dell Unity" | ||
| generally_available = False | ||
|
|
||
| @property | ||
| def charm_name(self) -> str: | ||
| """Return the charm name for Dell Unity.""" | ||
| return "cinder-volume-dellunity" | ||
|
|
||
| @property | ||
| def charm_channel(self) -> str: | ||
| """Return the default charm channel.""" | ||
| return "latest/edge" | ||
|
|
||
| @property | ||
| def charm_revision(self) -> str | None: | ||
| """Return the pinned charm revision, if any.""" | ||
| return None | ||
|
|
||
| @property | ||
| def charm_base(self) -> str: | ||
| """Return the charm base OS.""" | ||
| return "ubuntu@24.04" | ||
|
|
||
| @property | ||
| def supports_ha(self) -> bool: | ||
| """Return whether this backend supports high availability.""" | ||
| return False | ||
|
|
||
| def config_type(self) -> type[StorageBackendConfig]: | ||
| """Return the configuration model class for Dell Unity.""" | ||
| return DellunityConfig | ||
Empty file.
135 changes: 135 additions & 0 deletions
135
sunbeam-python/sunbeam/storage/backends/huawei/backend.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,135 @@ | ||
| # SPDX-FileCopyrightText: 2025 - Canonical Ltd | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| """Huawei OceanStor Dorado backend implementation using base step classes.""" | ||
|
|
||
| import logging | ||
| from enum import StrEnum | ||
| from typing import Annotated | ||
|
|
||
| from pydantic import Field | ||
| from rich.console import Console | ||
|
|
||
| from sunbeam.core.manifest import StorageBackendConfig | ||
| from sunbeam.storage.base import StorageBackendBase | ||
| from sunbeam.storage.models import SecretDictField | ||
|
|
||
| LOG = logging.getLogger(__name__) | ||
| console = Console() | ||
|
|
||
|
|
||
| class Protocol(StrEnum): | ||
| """Enumeration of valid protocol types.""" | ||
|
|
||
| ISCSI = "iscsi" | ||
| FC = "fc" | ||
|
|
||
|
|
||
| class HuaweiConfig(StorageBackendConfig): | ||
| """Configuration model for Huawei OceanStor Dorado backend. | ||
|
|
||
| This model includes ALL configuration options for the backend. | ||
| Additional configuration can be managed dynamically through the charm. | ||
| """ | ||
|
|
||
| # Mandatory connection parameters | ||
| san_ip: Annotated[ | ||
| str, | ||
| Field( | ||
| description="IP address or hostname of the Huawei OceanStor storage array" | ||
| ), | ||
| ] | ||
| san_login: Annotated[ | ||
| str, | ||
| Field(description="Username for Huawei storage array REST API"), | ||
| SecretDictField(field="san-login"), | ||
| ] | ||
| san_password: Annotated[ | ||
| str, | ||
| Field(description="Password for Huawei storage array REST API"), | ||
| SecretDictField(field="san-password"), | ||
| ] | ||
|
|
||
| # Optional backend configuration | ||
| protocol: Annotated[ | ||
| Protocol | None, | ||
| Field(description="Protocol selector: iscsi, fc."), | ||
| ] = None | ||
|
ahmad-can marked this conversation as resolved.
|
||
|
|
||
| cinder_huawei_conf_file: Annotated[ | ||
| str | None, | ||
| Field(description="The configuration file for the Cinder Huawei driver."), | ||
| ] = None | ||
|
|
||
| hypermetro_devices: Annotated[ | ||
| str | None, | ||
| Field(description="The remote device hypermetro will use."), | ||
| ] = None | ||
|
|
||
| metro_san_user: Annotated[ | ||
| str | None, | ||
| Field(description="The remote metro device san user."), | ||
| ] = None | ||
|
|
||
| metro_san_password: Annotated[ | ||
| str | None, | ||
| Field( | ||
| description=( | ||
| "The remote metro device san password" | ||
| " (only needed for HyperMetro replication)." | ||
| ) | ||
| ), | ||
| SecretDictField(field="metro-san-password"), | ||
| ] = None | ||
|
|
||
| metro_domain_name: Annotated[ | ||
| str | None, | ||
| Field(description="The remote metro device domain name."), | ||
| ] = None | ||
|
|
||
| metro_san_address: Annotated[ | ||
| str | None, | ||
| Field(description="The remote metro device request url."), | ||
| ] = None | ||
|
|
||
| metro_storage_pools: Annotated[ | ||
| str | None, | ||
| Field(description="The remote metro device pool names."), | ||
| ] = None | ||
|
|
||
|
|
||
| class HuaweiBackend(StorageBackendBase): | ||
| """Huawei OceanStor Dorado backend implementation.""" | ||
|
|
||
| backend_type = "huawei" | ||
| display_name = "Huawei OceanStor Dorado" | ||
| generally_available = False | ||
|
|
||
| @property | ||
| def charm_name(self) -> str: | ||
| """Return the charm name for Huawei OceanStor Dorado.""" | ||
| return "cinder-volume-huawei" | ||
|
|
||
| @property | ||
| def charm_channel(self) -> str: | ||
| """Return the default charm channel.""" | ||
| return "latest/edge" | ||
|
|
||
| @property | ||
| def charm_revision(self) -> str | None: | ||
| """Return the pinned charm revision, if any.""" | ||
| return None | ||
|
|
||
| @property | ||
| def charm_base(self) -> str: | ||
| """Return the charm base OS.""" | ||
| return "ubuntu@24.04" | ||
|
|
||
| @property | ||
| def supports_ha(self) -> bool: | ||
| """Return whether this backend supports high availability.""" | ||
| return False | ||
|
|
||
| def config_type(self) -> type[StorageBackendConfig]: | ||
| """Return the configuration model class for Huawei OceanStor Dorado.""" | ||
| return HuaweiConfig | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.