|
5 | 5 | from cinder import interface
|
6 | 6 | from cinder.objects import volume_type as vol_type_obj
|
7 | 7 | from cinder.volume import driver as volume_driver
|
| 8 | +from cinder.volume import volume_utils |
8 | 9 | from cinder.volume.drivers.netapp import options as na_opts
|
| 10 | +from cinder.volume.drivers.netapp import utils as na_utils |
9 | 11 | from cinder.volume.drivers.netapp.dataontap.client.client_cmode_rest import (
|
10 | 12 | RestClient as RestNaServer,
|
11 | 13 | )
|
@@ -851,6 +853,73 @@ def create_volume(self, volume):
|
851 | 853 | ) from e
|
852 | 854 |
|
853 | 855 |
|
| 856 | +class NetAppMinimalLibrary(NetAppNVMeStorageLibrary): |
| 857 | + """Minimal overriding library. |
| 858 | +
|
| 859 | + The purpose of this class is to take the existing upstream class |
| 860 | + and patch it as necessary to allow for our multi-SVM approach. |
| 861 | + This class is still intended to exist per SVM, its just fixes |
| 862 | + for that approach. |
| 863 | + """ |
| 864 | + |
| 865 | + def __init__(self, driver_name, driver_protocol, **kwargs): |
| 866 | + super().__init__(driver_name, driver_protocol, **kwargs) |
| 867 | + # the upstream library sets this field by parsing the host |
| 868 | + # which is "pod@config_group" in syntax. The issue is that |
| 869 | + # will point to our parent group. This backend_name is then |
| 870 | + # used by the connection code which reloads the whole configuration |
| 871 | + # but now it loaded the parent configuration and not the one targeting |
| 872 | + # the SVM. By fixing this backend_name it should point to the |
| 873 | + # right place. |
| 874 | + self.backend_name = self.configuration.config_group |
| 875 | + |
| 876 | + def do_setup(self, ctxt): |
| 877 | + """Override the upstream call. |
| 878 | +
|
| 879 | + This is a copy and paste except for the self.client setup, |
| 880 | + instead of calling the library function which makes a brand new |
| 881 | + self.configuration object and then reads from that. This creates |
| 882 | + the rest client from our existing self.configuration so that we |
| 883 | + can supply our overridden one. If we had used the upstream one it |
| 884 | + would check that the dynamic config group we made existed in the |
| 885 | + parsed config, which it does not and it would then fail. |
| 886 | + """ |
| 887 | + na_utils.check_flags(self.REQUIRED_FLAGS, self.configuration) |
| 888 | + self.namespace_ostype = ( |
| 889 | + self.configuration.netapp_namespace_ostype or self.DEFAULT_NAMESPACE_OS |
| 890 | + ) |
| 891 | + self.host_type = self.configuration.netapp_host_type or self.DEFAULT_HOST_TYPE |
| 892 | + |
| 893 | + na_utils.check_flags(self.REQUIRED_CMODE_FLAGS, self.configuration) |
| 894 | + |
| 895 | + # this is the change from upstream right here |
| 896 | + self.client = RestNaServer( |
| 897 | + transport_type=self.configuration.netapp_transport_type, |
| 898 | + ssl_cert_path=self.configuration.netapp_ssl_cert_path, |
| 899 | + username=self.configuration.netapp_login, |
| 900 | + password=self.configuration.netapp_password, |
| 901 | + hostname=self.configuration.netapp_server_hostname, |
| 902 | + port=self.configuration.netapp_server_port, |
| 903 | + vserver=self.configuration.netapp_vserver, |
| 904 | + trace=volume_utils.TRACE_API, |
| 905 | + api_trace_pattern=self.configuration.netapp_api_trace_pattern, |
| 906 | + async_rest_timeout=self.configuration.netapp_async_rest_timeout, |
| 907 | + ) |
| 908 | + self.vserver = self.client.vserver |
| 909 | + |
| 910 | + # Storage service catalog. |
| 911 | + self.ssc_library = capabilities.CapabilitiesLibrary( |
| 912 | + self.driver_protocol, self.vserver, self.client, self.configuration |
| 913 | + ) |
| 914 | + |
| 915 | + self.ssc_library.check_api_permissions() |
| 916 | + |
| 917 | + self.using_cluster_credentials = self.ssc_library.cluster_user_supported() |
| 918 | + |
| 919 | + # Performance monitoring library. |
| 920 | + self.perf_library = perf_cmode.PerformanceCmodeLibrary(self.client) |
| 921 | + |
| 922 | + |
854 | 923 | @interface.volumedriver
|
855 | 924 | class NetappCinderDynamicDriver(volume_driver.BaseVD):
|
856 | 925 | """NetApp NVMe driver with dynamic multi-SVM support.
|
|
0 commit comments