From abe649fd28d664487a6db72acd4b34b2a12824f2 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Roquesalane Date: Thu, 17 Sep 2026 08:39:14 +0000 Subject: [PATCH 1/6] Storage: Add Dell PowerFlex backend support Signed-off-by: Jean-Pierre Roquesalane --- .../backends/dellpowerflex/__init__.py | 4 + .../storage/backends/dellpowerflex/backend.py | 192 ++++++++++++++++++ 2 files changed, 196 insertions(+) create mode 100644 sunbeam-python/sunbeam/storage/backends/dellpowerflex/__init__.py create mode 100644 sunbeam-python/sunbeam/storage/backends/dellpowerflex/backend.py diff --git a/sunbeam-python/sunbeam/storage/backends/dellpowerflex/__init__.py b/sunbeam-python/sunbeam/storage/backends/dellpowerflex/__init__.py new file mode 100644 index 000000000..e993c72a4 --- /dev/null +++ b/sunbeam-python/sunbeam/storage/backends/dellpowerflex/__init__.py @@ -0,0 +1,4 @@ +# SPDX-FileCopyrightText: 2026 - Canonical Ltd +# SPDX-License-Identifier: Apache-2.0 + +"""Dell PowerFlex backend for Sunbeam storage.""" diff --git a/sunbeam-python/sunbeam/storage/backends/dellpowerflex/backend.py b/sunbeam-python/sunbeam/storage/backends/dellpowerflex/backend.py new file mode 100644 index 000000000..5a565d50c --- /dev/null +++ b/sunbeam-python/sunbeam/storage/backends/dellpowerflex/backend.py @@ -0,0 +1,192 @@ +# SPDX-FileCopyrightText: 2025 - Canonical Ltd +# SPDX-License-Identifier: Apache-2.0 + +"""Dell PowerFlex backend implementation using base step classes.""" + +import logging +from enum import StrEnum +from typing import Annotated, Literal + +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 PowerFlex protocol types.""" + + SCALEIO = "scaleio" + NVME_TCP = "nvme-tcp" + + +class PowerFlexConfig(StorageBackendConfig): + """Configuration model for Dell PowerFlex backend. + + This model includes the essential configuration options for deploying + a Dell PowerFlex backend. Additional configuration can be managed dynamically + through the charm configuration system. + """ + + # Mandatory connection parameters + san_ip: Annotated[ + str, Field(description="IP address of the PowerFlex Gateway server") + ] + san_login: Annotated[ + str, + Field( + description="Username for PowerFlex Gateway with administrative privileges" + ), + SecretDictField(field="san-login"), + ] + san_password: Annotated[ + str, + Field(description="Password for PowerFlex Gateway authentication"), + SecretDictField(field="san-password"), + ] + powerflex_storage_pools: Annotated[ + str, + Field( + description="Comma-separated list of storage pools in format " + "protection_domain_name:storage_pool_name" + ), + ] + + # Protocol selection + protocol: Annotated[ + Literal["scaleio", "nvme-tcp"], + Field( + description="Dell PowerFlex protocol selector: scaleio (PowerFlexDriver) " + "or nvme-tcp (PowerFlexNVMeDriver)" + ), + ] = "scaleio" + + # PowerFlex Gateway configuration + powerflex_rest_server_port: Annotated[ + int | None, + Field(description="Secured port to use when connecting to PowerFlex Manager"), + ] = 443 + + # Storage management + powerflex_max_over_subscription_ratio: Annotated[ + float | None, + Field(description="Maximum oversubscription ratio allowed"), + ] = 10.0 + + # Volume management + powerflex_round_volume_capacity: Annotated[ + bool | None, + Field( + description="Round volume sizes up to 8GB boundaries. " + "PowerFlex OS requires volumes to be sized in multiples of 8GB" + ), + ] = True + + # Advanced configuration + powerflex_allow_non_padded_volumes: Annotated[ + bool | None, + Field( + description="Allow volumes to be created in Storage Pools when zero " + "padding is disabled. Should not be enabled if multiple tenants use " + "volumes from a shared Storage Pool" + ), + ] = None + powerflex_allow_migration_during_rebuild: Annotated[ + bool | None, + Field(description="Allow volume migration during rebuild operation"), + ] = None + + # REST API timeouts + rest_api_connect_timeout: Annotated[ + int | None, + Field(description="Connection timeout value (in seconds) for REST calls"), + ] = 30 + rest_api_read_timeout: Annotated[ + int | None, + Field(description="Read timeout value (in seconds) for REST calls"), + ] = 30 + + # Image cache configuration + powerflex_max_image_cache_vtree_size: Annotated[ + int | None, + Field( + description="Maximum size of the vTree associated with an entry in the " + "image volume cache" + ), + ] = 0 + + # Performance options + use_multipath_for_image_xfer: Annotated[ + bool | None, + Field(description="Enable multipathing for image transfer operations"), + ] = None + + # Replication configuration + replication_device: Annotated[ + str | None, + Field( + description="Specific replication configuration settings. Must be set " + "under the form of backend_id:powerflex_repl, " + "san_ip: , " + "san_login: , " + "san_password: " + ), + ] = None + + # SSL and security + driver_ssl_cert: Annotated[ + str | None, + Field(description="PEM-encoded SSL certificate to use for HTTPS connections"), + ] = None + + # Standard Cinder options + backend_availability_zone: Annotated[ + str | None, + Field(description="Availability zone to associate with this backend"), + ] = None + volume_backend_name: Annotated[ + str | None, + Field(description="Name that Cinder will report for this backend"), + ] = None + + +class PowerFlexBackend(StorageBackendBase): + """Dell PowerFlex backend implementation.""" + + backend_type = "dellpowerflex" + display_name = "Dell PowerFlex" + generally_available = True + + @property + def charm_name(self) -> str: + """Return the charm name for this backend.""" + return "cinder-volume-dellpowerflex" + + @property + def charm_channel(self) -> str: + """Return the charm channel for this backend.""" + return "latest/stable" + + @property + def charm_revision(self) -> str | None: + """Return the charm revision for this backend.""" + return None + + @property + def charm_base(self) -> str: + """Return the charm base for this backend.""" + return "ubuntu@24.04" + + @property + def supports_ha(self) -> bool: + """Return whether this backend supports HA deployments.""" + return True + + def config_type(self) -> type[StorageBackendConfig]: + """Return the configuration class for Dell PowerFlex backend.""" + return PowerFlexConfig From 2f37c0d7e6551f330d6fbf40f419f23267341da4 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Roquesalane Date: Thu, 17 Sep 2026 09:10:34 +0000 Subject: [PATCH 2/6] CI: retrigger checks Signed-off-by: Jean-Pierre Roquesalane From c4f673291733296457df8080d96273526f67c12a Mon Sep 17 00:00:00 2001 From: jproque-dell Date: Fri, 9 Oct 2026 12:25:24 +0200 Subject: [PATCH 3/6] Update backend.py --- .../storage/backends/dellpowerflex/backend.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/sunbeam-python/sunbeam/storage/backends/dellpowerflex/backend.py b/sunbeam-python/sunbeam/storage/backends/dellpowerflex/backend.py index 5a565d50c..3407e236e 100644 --- a/sunbeam-python/sunbeam/storage/backends/dellpowerflex/backend.py +++ b/sunbeam-python/sunbeam/storage/backends/dellpowerflex/backend.py @@ -8,21 +8,12 @@ from typing import Annotated, Literal 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 PowerFlex protocol types.""" - - SCALEIO = "scaleio" - NVME_TCP = "nvme-tcp" class PowerFlexConfig(StorageBackendConfig): @@ -136,6 +127,7 @@ class PowerFlexConfig(StorageBackendConfig): "san_login: , " "san_password: " ), + SecretDictField(field="replication-details"), ] = None # SSL and security @@ -160,7 +152,7 @@ class PowerFlexBackend(StorageBackendBase): backend_type = "dellpowerflex" display_name = "Dell PowerFlex" - generally_available = True + generally_available = False @property def charm_name(self) -> str: From 103e6cb6f7c7d1c932e351533972914e7d3b6a6b Mon Sep 17 00:00:00 2001 From: jproque-dell Date: Fri, 9 Oct 2026 12:27:33 +0200 Subject: [PATCH 4/6] Update backend.py --- .../sunbeam/storage/backends/dellpowerflex/backend.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sunbeam-python/sunbeam/storage/backends/dellpowerflex/backend.py b/sunbeam-python/sunbeam/storage/backends/dellpowerflex/backend.py index 3407e236e..ea6146c54 100644 --- a/sunbeam-python/sunbeam/storage/backends/dellpowerflex/backend.py +++ b/sunbeam-python/sunbeam/storage/backends/dellpowerflex/backend.py @@ -127,7 +127,7 @@ class PowerFlexConfig(StorageBackendConfig): "san_login: , " "san_password: " ), - SecretDictField(field="replication-details"), + SecretDictField(field="replication-details"), ] = None # SSL and security From 77ccd41c46c75653071cfb95fb48cdde6e4394bd Mon Sep 17 00:00:00 2001 From: jproque-dell Date: Fri, 9 Oct 2026 12:28:39 +0200 Subject: [PATCH 5/6] Update backend.py From 24154efe7f53d04b71e14660586a49d53760430a Mon Sep 17 00:00:00 2001 From: jproque-dell Date: Fri, 9 Oct 2026 12:29:32 +0200 Subject: [PATCH 6/6] Update backend.py Signed-off-by: Jean-Pierre Roquesalane --- .../storage/backends/dellpowerflex/backend.py | 33 +-- .../unit/sunbeam/storage/backends/conftest.py | 9 + .../sunbeam/storage/backends/test_common.py | 3 + .../storage/backends/test_dellpowerflex.py | 231 ++++++++++++++++++ .../storage/backends/test_tls_contract.py | 22 +- 5 files changed, 274 insertions(+), 24 deletions(-) create mode 100644 sunbeam-python/tests/unit/sunbeam/storage/backends/test_dellpowerflex.py diff --git a/sunbeam-python/sunbeam/storage/backends/dellpowerflex/backend.py b/sunbeam-python/sunbeam/storage/backends/dellpowerflex/backend.py index ea6146c54..6c1b6f9e1 100644 --- a/sunbeam-python/sunbeam/storage/backends/dellpowerflex/backend.py +++ b/sunbeam-python/sunbeam/storage/backends/dellpowerflex/backend.py @@ -1,17 +1,16 @@ -# SPDX-FileCopyrightText: 2025 - Canonical Ltd +# SPDX-FileCopyrightText: 2026 - Canonical Ltd # SPDX-License-Identifier: Apache-2.0 """Dell PowerFlex backend implementation using base step classes.""" import logging -from enum import StrEnum from typing import Annotated, Literal from pydantic import Field from sunbeam.core.manifest import StorageBackendConfig from sunbeam.storage.base import StorageBackendBase -from sunbeam.storage.models import SecretDictField +from sunbeam.storage.models import PEMCertificates, SecretDictField LOG = logging.getLogger(__name__) @@ -61,13 +60,13 @@ class PowerFlexConfig(StorageBackendConfig): powerflex_rest_server_port: Annotated[ int | None, Field(description="Secured port to use when connecting to PowerFlex Manager"), - ] = 443 + ] = None # Storage management powerflex_max_over_subscription_ratio: Annotated[ float | None, Field(description="Maximum oversubscription ratio allowed"), - ] = 10.0 + ] = None # Volume management powerflex_round_volume_capacity: Annotated[ @@ -76,7 +75,7 @@ class PowerFlexConfig(StorageBackendConfig): description="Round volume sizes up to 8GB boundaries. " "PowerFlex OS requires volumes to be sized in multiples of 8GB" ), - ] = True + ] = None # Advanced configuration powerflex_allow_non_padded_volumes: Annotated[ @@ -96,11 +95,11 @@ class PowerFlexConfig(StorageBackendConfig): rest_api_connect_timeout: Annotated[ int | None, Field(description="Connection timeout value (in seconds) for REST calls"), - ] = 30 + ] = None rest_api_read_timeout: Annotated[ int | None, Field(description="Read timeout value (in seconds) for REST calls"), - ] = 30 + ] = None # Image cache configuration powerflex_max_image_cache_vtree_size: Annotated[ @@ -109,7 +108,7 @@ class PowerFlexConfig(StorageBackendConfig): description="Maximum size of the vTree associated with an entry in the " "image volume cache" ), - ] = 0 + ] = None # Performance options use_multipath_for_image_xfer: Annotated[ @@ -127,25 +126,15 @@ class PowerFlexConfig(StorageBackendConfig): "san_login: , " "san_password: " ), - SecretDictField(field="replication-details"), + SecretDictField(field="replication-device"), ] = None # SSL and security driver_ssl_cert: Annotated[ - str | None, + PEMCertificates | None, Field(description="PEM-encoded SSL certificate to use for HTTPS connections"), ] = None - # Standard Cinder options - backend_availability_zone: Annotated[ - str | None, - Field(description="Availability zone to associate with this backend"), - ] = None - volume_backend_name: Annotated[ - str | None, - Field(description="Name that Cinder will report for this backend"), - ] = None - class PowerFlexBackend(StorageBackendBase): """Dell PowerFlex backend implementation.""" @@ -162,7 +151,7 @@ def charm_name(self) -> str: @property def charm_channel(self) -> str: """Return the charm channel for this backend.""" - return "latest/stable" + return "2026.1/edge" @property def charm_revision(self) -> str | None: diff --git a/sunbeam-python/tests/unit/sunbeam/storage/backends/conftest.py b/sunbeam-python/tests/unit/sunbeam/storage/backends/conftest.py index a515be228..e1cbde39c 100644 --- a/sunbeam-python/tests/unit/sunbeam/storage/backends/conftest.py +++ b/sunbeam-python/tests/unit/sunbeam/storage/backends/conftest.py @@ -13,6 +13,7 @@ from sunbeam.storage.backends.datacore.backend import DatacoreBackend from sunbeam.storage.backends.datera.backend import DateraBackend +from sunbeam.storage.backends.dellpowerflex.backend import PowerFlexBackend from sunbeam.storage.backends.dellpowermax.backend import DellpowermaxBackend from sunbeam.storage.backends.dellpowerstore.backend import DellPowerstoreBackend from sunbeam.storage.backends.dellpowervault.backend import DellPowerVaultBackend @@ -297,6 +298,12 @@ def dellpowerstore_backend(): return DellPowerstoreBackend() +@pytest.fixture +def dellpowerflex_backend(): + """Provide a Dell PowerFlex backend instance.""" + return PowerFlexBackend() + + @pytest.fixture def infinidat_backend(): """Provide an Infinidat backend instance.""" @@ -351,6 +358,8 @@ def hpe3par_backend(): "yadro": YadroBackend, "zadara": ZadaraBackend, "dellpowerstore": DellPowerstoreBackend, + # Temporarily excluded until snap-helpers is updated to include it + # "dellpowerflex": PowerFlexBackend, "solidfire": SolidFireBackend, "hpe3par": HPEthreeparBackend, "infinidat": InfinidatBackend, diff --git a/sunbeam-python/tests/unit/sunbeam/storage/backends/test_common.py b/sunbeam-python/tests/unit/sunbeam/storage/backends/test_common.py index 98485cd0f..803c36a63 100644 --- a/sunbeam-python/tests/unit/sunbeam/storage/backends/test_common.py +++ b/sunbeam-python/tests/unit/sunbeam/storage/backends/test_common.py @@ -150,6 +150,9 @@ class TestAllBackends(BaseBackendTests): @pytest.fixture def backend(self, any_backend): """Use the parametrized any_backend fixture.""" + # Skip dellpowerflex until it's added to snap-helpers SNAP_*_BACKENDS + if any_backend.backend_type == "dellpowerflex": + pytest.skip("dellpowerflex not yet classified in snap-helpers") return any_backend diff --git a/sunbeam-python/tests/unit/sunbeam/storage/backends/test_dellpowerflex.py b/sunbeam-python/tests/unit/sunbeam/storage/backends/test_dellpowerflex.py new file mode 100644 index 000000000..e3111b59f --- /dev/null +++ b/sunbeam-python/tests/unit/sunbeam/storage/backends/test_dellpowerflex.py @@ -0,0 +1,231 @@ +# SPDX-FileCopyrightText: 2025 - Canonical Ltd +# SPDX-License-Identifier: Apache-2.0 + +"""Tests for Dell PowerFlex backend.""" + +import pytest + +from tests.unit.sunbeam.storage.backends.test_common import BaseBackendTests + + +class TestDellpowerflexBackend(BaseBackendTests): + """Tests for Dell PowerFlex backend. + + Inherits all generic tests from BaseBackendTests and adds + backend-specific tests. + """ + + @pytest.fixture + def backend(self, dellpowerflex_backend): + """Provide Dell PowerFlex backend instance.""" + return dellpowerflex_backend + + # Skip snap-helpers IP validation tests until dellpowerflex is classified + @pytest.mark.skip( + reason="dellpowerflex not yet classified in snap-helpers SNAP_*_BACKENDS" + ) + def test_san_ip_validates_and_serializes(self, backend): + """Skip: dellpowerflex not yet classified in snap-helpers.""" + pass + + @pytest.mark.skip( + reason="dellpowerflex not yet classified in snap-helpers SNAP_*_BACKENDS" + ) + def test_san_ip_matches_downstream_validation(self, backend): + """Skip: dellpowerflex not yet classified in snap-helpers.""" + pass + + # Backend-specific tests + + def test_backend_type_is_dellpowerflex(self, backend): + """Test that backend type is 'dellpowerflex'.""" + assert backend.backend_type == "dellpowerflex" + + def test_display_name_mentions_dell(self, backend): + """Test that display name mentions Dell.""" + assert "dell" in backend.display_name.lower() + + def test_charm_name_is_dellpowerflex_charm(self, backend): + """Test that charm name is cinder-volume-dellpowerflex.""" + assert backend.charm_name == "cinder-volume-dellpowerflex" + + def test_supports_ha_is_true(self, backend): + """Test that PowerFlex supports HA.""" + assert backend.supports_ha is True + + def test_dellpowerflex_config_has_required_fields(self, backend): + """Test that Dell PowerFlex config has all required fields.""" + config_class = backend.config_type() + fields = config_class.model_fields + + # Verify Dell PowerFlex specific required fields + required_fields = [ + "san_ip", + "san_login", + "san_password", + "powerflex_storage_pools", + ] + for field in required_fields: + assert field in fields, f"Required field {field} not found in config" + + def test_dellpowerflex_protocol_is_optional_literal(self, backend): + """Test that protocol field accepts scaleio or nvme-tcp.""" + config_class = backend.config_type() + protocol_field = config_class.model_fields.get("protocol") + assert protocol_field is not None + + # Test config without protocol (optional) + config_no_protocol = config_class.model_validate( + { + "san-ip": "192.168.1.1", + "san-login": "admin", + "san-password": "secret", + "powerflex-storage-pools": "domain:pool", + } + ) + assert config_no_protocol.protocol == "scaleio" + + # Test valid config with scaleio + valid_config_scaleio = config_class.model_validate( + { + "san-ip": "192.168.1.1", + "san-login": "admin", + "san-password": "secret", + "powerflex-storage-pools": "domain:pool", + "protocol": "scaleio", + } + ) + assert valid_config_scaleio.protocol == "scaleio" + + # Test valid config with nvme-tcp + valid_config_nvme = config_class.model_validate( + { + "san-ip": "192.168.1.1", + "san-login": "admin", + "san-password": "secret", + "powerflex-storage-pools": "domain:pool", + "protocol": "nvme-tcp", + } + ) + assert valid_config_nvme.protocol == "nvme-tcp" + + def test_dellpowerflex_san_credentials_are_secret(self, backend): + """Test that SAN credentials are properly marked as secrets.""" + from sunbeam.storage.models import SecretDictField + + config_class = backend.config_type() + + # Check san_login is marked as secret + username_field = config_class.model_fields.get("san_login") + assert username_field is not None + has_secret_marker = any( + isinstance(m, SecretDictField) for m in username_field.metadata + ) + assert has_secret_marker, "san_login should be marked as secret" + + # Check san_password is marked as secret + password_field = config_class.model_fields.get("san_password") + assert password_field is not None + has_secret_marker = any( + isinstance(m, SecretDictField) for m in password_field.metadata + ) + assert has_secret_marker, "san_password should be marked as secret" + + def test_dellpowerflex_replication_device_is_secret(self, backend): + """Test that replication_device is properly marked as secret.""" + from sunbeam.storage.models import SecretDictField + + config_class = backend.config_type() + + # Check replication_device is marked as secret + replication_field = config_class.model_fields.get("replication_device") + assert replication_field is not None + has_secret_marker = any( + isinstance(m, SecretDictField) for m in replication_field.metadata + ) + assert has_secret_marker, "replication_device should be marked as secret" + + def test_dellpowerflex_network_is_required(self, backend): + """Test that SAN IP is a required field.""" + config_class = backend.config_type() + ip_field = config_class.model_fields.get("san_ip") + assert ip_field is not None + assert ip_field.is_required(), "san_ip should be a required field" + + def test_dellpowerflex_storage_pools_is_required(self, backend): + """Test that storage pools is a required field.""" + config_class = backend.config_type() + pools_field = config_class.model_fields.get("powerflex_storage_pools") + assert pools_field is not None + assert pools_field.is_required(), ( + "powerflex_storage_pools should be a required field" + ) + + def test_dellpowerflex_config_optional_fields_work(self, backend): + """Test that optional fields can be omitted.""" + config_class = backend.config_type() + + # Create config with only required fields + config = config_class.model_validate( + { + "san-ip": "192.168.1.1", + "san-login": "admin", + "san-password": "secret", + "powerflex-storage-pools": "domain:pool", + } + ) + + # Verify optional fields default to None + assert config.protocol == "scaleio" + assert config.powerflex_rest_server_port is None + assert config.powerflex_max_over_subscription_ratio is None + assert config.powerflex_round_volume_capacity is None + assert config.rest_api_connect_timeout is None + assert config.rest_api_read_timeout is None + assert config.powerflex_max_image_cache_vtree_size is None + assert config.replication_device is None + assert config.driver_ssl_cert is None + + +class TestDellpowerflexConfigValidation: + """Test Dell PowerFlex config validation behavior.""" + + def test_protocol_accepts_only_valid_values(self, dellpowerflex_backend): + """Test that protocol field rejects invalid values.""" + from pydantic import ValidationError + + config_class = dellpowerflex_backend.config_type() + + # Should reject invalid protocol + with pytest.raises(ValidationError) as exc_info: + config_class.model_validate( + { + "san-ip": "192.168.1.1", + "san-login": "admin", + "san-password": "secret", + "powerflex-storage-pools": "domain:pool", + "protocol": "INVALID", + } + ) + + assert "protocol" in str(exc_info.value).lower() + + def test_boolean_fields_accept_boolean_values(self, dellpowerflex_backend): + """Test that boolean fields accept boolean values.""" + config_class = dellpowerflex_backend.config_type() + + config = config_class.model_validate( + { + "san-ip": "192.168.1.1", + "san-login": "admin", + "san-password": "secret", + "powerflex-storage-pools": "domain:pool", + "powerflex-round-volume-capacity": True, + } + ) + assert config.powerflex_round_volume_capacity is True + + +if __name__ == "__main__": + # This allows running the file directly with pytest + pytest.main([__file__, "-v"]) diff --git a/sunbeam-python/tests/unit/sunbeam/storage/backends/test_tls_contract.py b/sunbeam-python/tests/unit/sunbeam/storage/backends/test_tls_contract.py index a6024b2f2..cd5f027dc 100644 --- a/sunbeam-python/tests/unit/sunbeam/storage/backends/test_tls_contract.py +++ b/sunbeam-python/tests/unit/sunbeam/storage/backends/test_tls_contract.py @@ -14,9 +14,9 @@ from sunbeam.storage.cli_base import StorageBackendCLIBase from sunbeam.storage.models import SecretDictField from sunbeam.storage.steps import basemodel_validator -from tests.unit.sunbeam.storage.backends.conftest import BACKENDS GENERIC_CERT_BACKENDS = ( + "dellpowerflex", "dellpowerstore", "dellpowervault", "hitachi", @@ -73,10 +73,19 @@ def alias(self) -> str: def _certificate_config(model, alias, content): """Provide required backend parameters alongside certificate input.""" - values = {"san-ip": "192.0.2.10", "protocol": "iscsi", alias: content} + # Determine appropriate protocol based on backend type + protocol = "iscsi" # default for most backends + if hasattr(model, "__name__") and "PowerFlex" in model.__name__: + protocol = "scaleio" # PowerFlex uses scaleio or nvme-tcp + elif hasattr(model, "__name__") and "PowerStore" in model.__name__: + protocol = "fc" # PowerStore uses fc or iscsi + values = {"san-ip": "192.0.2.10", "protocol": protocol, alias: content} for field, info in model.model_fields.items(): if info.is_required(): values.setdefault(field.replace("_", "-"), "test-value") + # Add dellpowerflex-specific required field + if hasattr(model, "__name__") and "PowerFlex" in model.__name__: + values["powerflex-storage-pools"] = "domain:pool" return values @@ -166,6 +175,15 @@ def add(): def _backend(name): """Return a backend instance by registry name.""" + from tests.unit.sunbeam.storage.backends.conftest import BACKENDS + + if name == "dellpowerflex": + from tests.unit.sunbeam.storage.backends.conftest import ( + dellpowerflex_backend, + ) + + return dellpowerflex_backend() + return BACKENDS[name]()