forked from gnuoy/snap-openstack
-
Notifications
You must be signed in to change notification settings - Fork 35
feat: generate necv charm #763
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
3
commits into
canonical:main
Choose a base branch
from
ahmad-can:feature/generate-necv-charm
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
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
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,4 @@ | ||
| # SPDX-FileCopyrightText: 2026 - Canonical Ltd | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| """NEC V backend for Sunbeam storage.""" |
298 changes: 298 additions & 0 deletions
298
sunbeam-python/sunbeam/storage/backends/necv/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,298 @@ | ||
| # SPDX-FileCopyrightText: 2026 - Canonical Ltd | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| """VStorage 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 | ||
|
|
||
| LOG = logging.getLogger(__name__) | ||
| console = Console() | ||
|
|
||
|
|
||
| class Protocol(StrEnum): | ||
| """Enumeration of valid protocol types.""" | ||
|
|
||
| FC = "fc" | ||
| ISCSI = "iscsi" | ||
|
|
||
|
|
||
| class NecvConfig(StorageBackendConfig): | ||
| """Configuration model for VStorage 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="Storage array management IP address or hostname") | ||
| ] | ||
|
|
||
| # Optional backend configuration | ||
| protocol: Annotated[ | ||
| Protocol | None, | ||
| Field(description="Protocol selector: fc, iscsi."), | ||
| ] = None | ||
| nec_v_storage_id: Annotated[ | ||
| str | None, Field(description="Product number of the storage system.") | ||
| ] = None | ||
| nec_v_pools: Annotated[ | ||
| str | None, Field(description="Pool number[s] or pool name[s] of the DP pool.") | ||
| ] = None | ||
| nec_v_snap_pool: Annotated[ | ||
| str | None, Field(description="Pool number or pool name of the snapshot pool.") | ||
| ] = None | ||
| nec_v_ldev_range: Annotated[ | ||
| str | None, | ||
| Field( | ||
| description=( | ||
| "Range of the LDEV numbers in the format of " | ||
| "'xxxx-yyyy' that can be used by the driver." | ||
| ) | ||
| ), | ||
| ] = None | ||
| nec_v_target_ports: Annotated[ | ||
| str | None, | ||
| Field( | ||
| description=( | ||
| "IDs of the storage ports used to attach volumes " | ||
| "to the controller node." | ||
| ) | ||
| ), | ||
| ] = None | ||
| nec_v_compute_target_ports: Annotated[ | ||
| str | None, | ||
| Field( | ||
| description=( | ||
| "IDs of the storage ports used to attach volumes to compute nodes." | ||
| ) | ||
| ), | ||
| ] = None | ||
| nec_v_group_create: Annotated[ | ||
| bool | None, | ||
| Field( | ||
| description=( | ||
| "If True, the driver will create host groups or iSCSI " | ||
| "targets on storage ports as needed." | ||
| ) | ||
| ), | ||
| ] = None | ||
| nec_v_group_delete: Annotated[ | ||
| bool | None, | ||
| Field( | ||
| description=( | ||
| "If True, the driver will delete host groups or iSCSI " | ||
| "targets on storage ports as needed." | ||
| ) | ||
| ), | ||
| ] = None | ||
| nec_v_copy_speed: Annotated[ | ||
| int | None, | ||
| Field( | ||
| description=( | ||
| "Copy speed of storage system. 1 or 2 indicates low speed, " | ||
| "3 indicates middle speed, and a value between 4 and 15 " | ||
| "indicates high speed." | ||
| ) | ||
| ), | ||
| ] = None | ||
| nec_v_copy_check_interval: Annotated[ | ||
| int | None, | ||
| Field( | ||
| description=( | ||
| "Interval in seconds to check copying status during a volume copy." | ||
| ) | ||
| ), | ||
| ] = None | ||
| nec_v_async_copy_check_interval: Annotated[ | ||
| int | None, | ||
| Field( | ||
| description=( | ||
| "Interval in seconds to check asynchronous copying status " | ||
| "during copy pair deletion or data restoration." | ||
| ) | ||
| ), | ||
| ] = None | ||
| nec_v_manage_drs_volumes: Annotated[ | ||
| bool | None, | ||
| Field( | ||
| description=( | ||
| "If true, the driver creates a driver-managed vClone " | ||
| "parent for each non-cloned DRS volume." | ||
| ) | ||
| ), | ||
| ] = None | ||
| nec_v_rest_disable_io_wait: Annotated[ | ||
| bool | None, | ||
| Field( | ||
| description=( | ||
| "It may take time to detach volume after I/O. This option " | ||
| "allows detaching volume to complete immediately." | ||
| ) | ||
| ), | ||
| ] = None | ||
| nec_v_rest_tcp_keepalive: Annotated[ | ||
| bool | None, | ||
| Field(description="Enables or disables use of REST API tcp keepalive"), | ||
| ] = None | ||
| nec_v_discard_zero_page: Annotated[ | ||
| bool | None, | ||
| Field(description="Enable or disable zero page reclamation in a DP-VOL."), | ||
| ] = None | ||
| nec_v_lun_timeout: Annotated[ | ||
| int | None, | ||
| Field(description="Maximum wait time in seconds for adding a LUN to complete."), | ||
| ] = None | ||
| nec_v_lun_retry_interval: Annotated[ | ||
| int | None, | ||
| Field(description="Retry interval in seconds for REST API adding a LUN."), | ||
| ] = None | ||
| nec_v_restore_timeout: Annotated[ | ||
| int | None, | ||
| Field( | ||
| description=( | ||
| "Maximum wait time in seconds for the restore operation to complete." | ||
| ) | ||
| ), | ||
| ] = None | ||
| nec_v_state_transition_timeout: Annotated[ | ||
| int | None, | ||
| Field( | ||
| description=( | ||
| "Maximum wait time in seconds for a volume transition to complete." | ||
| ) | ||
| ), | ||
| ] = None | ||
| nec_v_lock_timeout: Annotated[ | ||
| int | None, | ||
| Field(description="Maximum wait time in seconds for storage to be unlocked."), | ||
| ] = None | ||
| nec_v_rest_timeout: Annotated[ | ||
| int | None, | ||
| Field( | ||
| description=( | ||
| "Maximum wait time in seconds for REST API execution to complete." | ||
| ) | ||
| ), | ||
| ] = None | ||
| nec_v_extend_timeout: Annotated[ | ||
| int | None, | ||
| Field( | ||
| description=( | ||
| "Maximum wait time in seconds for a volume extension to complete." | ||
| ) | ||
| ), | ||
| ] = None | ||
| nec_v_exec_retry_interval: Annotated[ | ||
| int | None, | ||
| Field(description="Retry interval in seconds for REST API execution."), | ||
| ] = None | ||
| nec_v_rest_connect_timeout: Annotated[ | ||
| int | None, | ||
| Field( | ||
| description=( | ||
| "Maximum wait time in seconds for REST API connection to complete." | ||
| ) | ||
| ), | ||
| ] = None | ||
| nec_v_rest_job_api_response_timeout: Annotated[ | ||
| int | None, | ||
| Field(description="Maximum wait time in seconds for a response from REST API."), | ||
| ] = None | ||
| nec_v_rest_get_api_response_timeout: Annotated[ | ||
| int | None, | ||
| Field( | ||
| description=( | ||
| "Maximum wait time in seconds for a response " | ||
| "against GET method of REST API." | ||
| ) | ||
| ), | ||
| ] = None | ||
| nec_v_rest_server_busy_timeout: Annotated[ | ||
| int | None, | ||
| Field(description="Maximum wait time in seconds when REST API returns busy."), | ||
| ] = None | ||
| nec_v_rest_keep_session_loop_interval: Annotated[ | ||
| int | None, | ||
| Field(description="Loop interval in seconds for keeping REST API session."), | ||
| ] = None | ||
| nec_v_rest_another_ldev_mapped_retry_timeout: Annotated[ | ||
| int | None, | ||
| Field( | ||
| description="Retry time in seconds when new LUN allocation request fails." | ||
| ), | ||
| ] = None | ||
| nec_v_rest_tcp_keepidle: Annotated[ | ||
| int | None, | ||
| Field( | ||
| description="Wait time in seconds for sending a first TCP keepalive packet." | ||
| ), | ||
| ] = None | ||
| nec_v_rest_tcp_keepintvl: Annotated[ | ||
| int | None, | ||
| Field( | ||
| description="Interval of transmissions in seconds for TCP keepalive packet." | ||
| ), | ||
| ] = None | ||
| nec_v_rest_tcp_keepcnt: Annotated[ | ||
| int | None, | ||
| Field(description="Maximum number of transmissions for TCP keepalive packet."), | ||
| ] = None | ||
| nec_v_host_mode_options: Annotated[ | ||
| str | None, Field(description="Host mode option for host group or iSCSI target") | ||
| ] = None | ||
| nec_v_zoning_request: Annotated[ | ||
| bool | None, | ||
| Field( | ||
| description=( | ||
| "If True, the driver will configure FC zoning between " | ||
| "the server and storage system when FC zoning manager " | ||
| "is enabled." | ||
| ) | ||
| ), | ||
| ] = None | ||
|
|
||
|
|
||
| class NecvBackend(StorageBackendBase): | ||
| """VStorage backend implementation.""" | ||
|
|
||
| backend_type = "necv" | ||
| display_name = "VStorage" | ||
| generally_available = True | ||
|
ahmad-can marked this conversation as resolved.
|
||
|
|
||
| @property | ||
| def charm_name(self) -> str: | ||
| """Return the charm application name.""" | ||
| return "cinder-volume-necv" | ||
|
|
||
| @property | ||
| def charm_channel(self) -> str: | ||
| """Return the default charm channel.""" | ||
| return "latest/edge" | ||
|
|
||
| @property | ||
| def charm_revision(self) -> str | None: | ||
| """Return a pinned charm revision, if any.""" | ||
| return None | ||
|
|
||
| @property | ||
| def charm_base(self) -> str: | ||
| """Return the target base for this charm.""" | ||
| return "ubuntu@24.04" | ||
|
|
||
| @property | ||
| def supports_ha(self) -> bool: | ||
| """Whether this backend supports HA deployments.""" | ||
| return False | ||
|
|
||
| def config_type(self) -> type[StorageBackendConfig]: | ||
| """Return the configuration model type for this backend.""" | ||
| return NecvConfig | ||
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
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.