Skip to content

Commit cf072a3

Browse files
committed
fix(cinder-understack): update options to behave more like upstream
This configuration of the options before we call the parent class isn't necessary to configure the options. Import them the same way upstream code imports them as well to minimize the differences.
1 parent eedb53a commit cf072a3

File tree

1 file changed

+13
-62
lines changed

1 file changed

+13
-62
lines changed

python/cinder-understack/cinder_understack/dynamic_netapp_driver.py

Lines changed: 13 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from cinder import interface
66
from cinder.objects import volume_type as vol_type_obj
77
from cinder.volume import driver as volume_driver
8-
from cinder.volume.drivers.netapp import options
8+
from cinder.volume.drivers.netapp import options as na_opts
99
from cinder.volume.drivers.netapp.dataontap.client.client_cmode_rest import (
1010
RestClient as RestNaServer,
1111
)
@@ -21,14 +21,13 @@
2121
# Configuration options for dynamic NetApp driver
2222
# Using cinder.volume.configuration approach for better abstraction
2323
NETAPP_DYNAMIC_OPTS = [
24-
options.netapp_proxy_opts,
25-
options.netapp_connection_opts,
26-
options.netapp_transport_opts,
27-
options.netapp_basicauth_opts,
28-
options.netapp_provisioning_opts,
29-
options.netapp_cluster_opts,
30-
options.netapp_san_opts,
31-
volume_driver.volume_opts,
24+
na_opts.netapp_connection_opts,
25+
na_opts.netapp_basicauth_opts,
26+
na_opts.netapp_transport_opts,
27+
na_opts.netapp_provisioning_opts,
28+
na_opts.netapp_support_opts,
29+
na_opts.netapp_san_opts,
30+
na_opts.netapp_cluster_opts,
3231
]
3332

3433

@@ -48,64 +47,11 @@ def __init__(self, *args, **kwargs):
4847
Parent driver creates static connections during init. We defer
4948
SVM connections until volume creation when we know which SVM to use.
5049
"""
51-
self._setup_configuration(**kwargs)
52-
5350
super().__init__(*args, **kwargs)
5451
self.client = None
5552
self.ssc_library = None
5653
self.perf_library = None
5754

58-
def _setup_configuration(self, **kwargs):
59-
"""Setup configuration using cinder.volume.configuration module."""
60-
from cinder.volume import configuration
61-
62-
config_obj = kwargs.get("configuration", None)
63-
64-
if config_obj:
65-
# here we can access any cinder-provided config .
66-
self.configuration = config_obj
67-
config_group = getattr(config_obj, "config_group", "netapp_nvme")
68-
69-
# Register NetApp-specific options using configuration.append()
70-
# Following the exact pattern from upstream NetApp drivers
71-
72-
try:
73-
for opt_group in NETAPP_DYNAMIC_OPTS:
74-
self.configuration.append_config_values(opt_group)
75-
76-
LOG.info(
77-
"Registered NetApp configuration options for group: %s",
78-
config_group,
79-
)
80-
81-
except Exception as e:
82-
LOG.warning("Failed to register configuration options: %s", e)
83-
# Continue default configuration handling for backward compatibility
84-
else:
85-
# Testing/Fallback: Create configuration object with all options
86-
config_group = "netapp_nvme"
87-
self.configuration = configuration.Configuration(
88-
volume_driver.volume_opts, config_group=config_group
89-
)
90-
91-
# Register additional NetApp options for testing
92-
try:
93-
for opt_group in NETAPP_DYNAMIC_OPTS:
94-
if (
95-
opt_group != volume_driver.volume_opts
96-
): # Avoid duplicate registration
97-
self.configuration.append_config_values(opt_group)
98-
99-
LOG.info(
100-
"Registered NetApp configuration options for testing group: %s",
101-
config_group,
102-
)
103-
104-
except Exception as e:
105-
LOG.warning(
106-
"Failed to register configuration options for testing: %s", e
107-
)
108-
10955
def do_setup(self, context):
11056
"""Skip static NetApp connections, defer to volume creation time."""
11157
LOG.info("Skipping static setup, will connect to SVMs dynamically")
@@ -952,6 +898,11 @@ def __init__(self, *args, **kwargs):
952898
super().__init__(*args, **kwargs)
953899
self.library = NetappDynamicLibrary(self.DRIVER_NAME, "NVMe", **kwargs)
954900

901+
@staticmethod
902+
def get_driver_options():
903+
"""All options this driver supports."""
904+
return [item for sublist in NETAPP_DYNAMIC_OPTS for item in sublist]
905+
955906
def do_setup(self, context):
956907
"""Setup the driver."""
957908
self.library.do_setup(context)

0 commit comments

Comments
 (0)