1# Copyright (c) 2012 NetApp, Inc.  All rights reserved.
2# Copyright (c) 2014 Navneet Singh.  All rights reserved.
3# Copyright (c) 2014 Bob Callaway.  All rights reserved.
4#
5#    Licensed under the Apache License, Version 2.0 (the "License"); you may
6#    not use this file except in compliance with the License. You may obtain
7#    a copy of the License at
8#
9#         http://www.apache.org/licenses/LICENSE-2.0
10#
11#    Unless required by applicable law or agreed to in writing, software
12#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14#    License for the specific language governing permissions and limitations
15#    under the License.
16
17"""Contains configuration options for NetApp drivers.
18
19Common place to hold configuration options for all NetApp drivers.
20Options need to be grouped into granular units to be able to be reused
21by different modules and classes. This does not restrict declaring options in
22individual modules. If options are not re usable then can be declared in
23individual modules. It is recommended to Keep options at a single
24place to ensure re usability and better management of configuration options.
25"""
26
27from oslo_config import cfg
28from oslo_config import types
29
30from cinder.volume import configuration as conf
31
32NETAPP_SIZE_MULTIPLIER_DEFAULT = 1.2
33
34netapp_proxy_opts = [
35    cfg.StrOpt('netapp_storage_family',
36               default='ontap_cluster',
37               choices=['ontap_cluster', 'eseries'],
38               help=('The storage family type used on the storage system; '
39                     'valid values are ontap_cluster for using clustered '
40                     'Data ONTAP, or eseries for using E-Series.')),
41    cfg.StrOpt('netapp_storage_protocol',
42               choices=['iscsi', 'fc', 'nfs'],
43               help=('The storage protocol to be used on the data path with '
44                     'the storage system.')), ]
45
46netapp_connection_opts = [
47    cfg.StrOpt('netapp_server_hostname',
48               help='The hostname (or IP address) for the storage system or '
49                    'proxy server.'),
50    cfg.IntOpt('netapp_server_port',
51               help=('The TCP port to use for communication with the storage '
52                     'system or proxy server. If not specified, Data ONTAP '
53                     'drivers will use 80 for HTTP and 443 for HTTPS; '
54                     'E-Series will use 8080 for HTTP and 8443 for HTTPS.')), ]
55
56netapp_transport_opts = [
57    cfg.StrOpt('netapp_transport_type',
58               default='http',
59               choices=['http', 'https'],
60               help=('The transport protocol used when communicating with '
61                     'the storage system or proxy server.')), ]
62
63netapp_basicauth_opts = [
64    cfg.StrOpt('netapp_login',
65               help=('Administrative user account name used to access the '
66                     'storage system or proxy server.')),
67    cfg.StrOpt('netapp_password',
68               help=('Password for the administrative user account '
69                     'specified in the netapp_login option.'),
70               secret=True), ]
71
72netapp_provisioning_opts = [
73    cfg.FloatOpt('netapp_size_multiplier',
74                 default=NETAPP_SIZE_MULTIPLIER_DEFAULT,
75                 help=('The quantity to be multiplied by the requested '
76                       'volume size to ensure enough space is available on '
77                       'the virtual storage server (Vserver) to fulfill '
78                       'the volume creation request.  Note: this option '
79                       'is deprecated and will be removed in favor of '
80                       '"reserved_percentage" in the Mitaka release.')),
81    cfg.StrOpt('netapp_lun_space_reservation',
82               default='enabled',
83               choices=['enabled', 'disabled'],
84               help=('This option determines if storage space is reserved '
85                     'for LUN allocation. If enabled, LUNs are thick '
86                     'provisioned. If space reservation is disabled, '
87                     'storage space is allocated on demand.')), ]
88
89netapp_cluster_opts = [
90    cfg.StrOpt('netapp_vserver',
91               help=('This option specifies the virtual storage server '
92                     '(Vserver) name on the storage cluster on which '
93                     'provisioning of block storage volumes should occur.')), ]
94
95netapp_img_cache_opts = [
96    cfg.IntOpt('thres_avl_size_perc_start',
97               default=20,
98               help=('If the percentage of available space for an NFS share '
99                     'has dropped below the value specified by this option, '
100                     'the NFS image cache will be cleaned.')),
101    cfg.IntOpt('thres_avl_size_perc_stop',
102               default=60,
103               help=('When the percentage of available space on an NFS share '
104                     'has reached the percentage specified by this option, '
105                     'the driver will stop clearing files from the NFS image '
106                     'cache that have not been accessed in the last M '
107                     'minutes, where M is the value of the '
108                     'expiry_thres_minutes configuration option.')),
109    cfg.IntOpt('expiry_thres_minutes',
110               default=720,
111               help=('This option specifies the threshold for last access '
112                     'time for images in the NFS image cache. When a cache '
113                     'cleaning cycle begins, images in the cache that have '
114                     'not been accessed in the last M minutes, where M is '
115                     'the value of this parameter, will be deleted from the '
116                     'cache to create free space on the NFS share.')), ]
117
118netapp_eseries_opts = [
119    cfg.StrOpt('netapp_webservice_path',
120               default='/devmgr/v2',
121               help=('This option is used to specify the path to the E-Series '
122                     'proxy application on a proxy server. The value is '
123                     'combined with the value of the netapp_transport_type, '
124                     'netapp_server_hostname, and netapp_server_port options '
125                     'to create the URL used by the driver to connect to the '
126                     'proxy application.')),
127    cfg.StrOpt('netapp_controller_ips',
128               help=('This option is only utilized when the storage family '
129                     'is configured to eseries. This option is used to '
130                     'restrict provisioning to the specified controllers. '
131                     'Specify the value of this option to be a comma '
132                     'separated list of controller hostnames or IP addresses '
133                     'to be used for provisioning.')),
134    cfg.StrOpt('netapp_sa_password',
135               help=('Password for the NetApp E-Series storage array.'),
136               secret=True),
137    cfg.BoolOpt('netapp_enable_multiattach',
138                default=False,
139                help='This option specifies whether the driver should allow '
140                     'operations that require multiple attachments to a '
141                     'volume. An example would be live migration of servers '
142                     'that have volumes attached. When enabled, this backend '
143                     'is limited to 256 total volumes in order to '
144                     'guarantee volumes can be accessed by more than one '
145                     'host.'),
146]
147netapp_nfs_extra_opts = [
148    cfg.StrOpt('netapp_copyoffload_tool_path',
149               help=('This option specifies the path of the NetApp copy '
150                     'offload tool binary. Ensure that the binary has execute '
151                     'permissions set which allow the effective user of the '
152                     'cinder-volume process to execute the file.')), ]
153netapp_san_opts = [
154    cfg.StrOpt('netapp_lun_ostype',
155               help=('This option defines the type of operating system that'
156                     ' will access a LUN exported from Data ONTAP; it is'
157                     ' assigned to the LUN at the time it is created.')),
158    cfg.StrOpt('netapp_host_type',
159               help=('This option defines the type of operating system for'
160                     ' all initiators that can access a LUN. This information'
161                     ' is used when mapping LUNs to individual hosts or'
162                     ' groups of hosts.')),
163    cfg.StrOpt('netapp_pool_name_search_pattern',
164               deprecated_opts=[cfg.DeprecatedOpt(name='netapp_volume_list'),
165                                cfg.DeprecatedOpt(name='netapp_storage_pools')
166                                ],
167               default="(.+)",
168               help=('This option is used to restrict provisioning to the '
169                     'specified pools. Specify the value of '
170                     'this option to be a regular expression which will be '
171                     'applied to the names of objects from the storage '
172                     'backend which represent pools in Cinder. This option '
173                     'is only utilized when the storage protocol is '
174                     'configured to use iSCSI or FC.')), ]
175
176netapp_replication_opts = [
177    cfg.MultiOpt('netapp_replication_aggregate_map',
178                 item_type=types.Dict(),
179                 help="Multi opt of dictionaries to represent the aggregate "
180                      "mapping between source and destination back ends when "
181                      "using whole back end replication. For every "
182                      "source aggregate associated with a cinder pool (NetApp "
183                      "FlexVol), you would need to specify the destination "
184                      "aggregate on the replication target device. A "
185                      "replication target device is configured with the "
186                      "configuration option replication_device. Specify this "
187                      "option as many times as you have replication devices. "
188                      "Each entry takes the standard dict config form: "
189                      "netapp_replication_aggregate_map = "
190                      "backend_id:<name_of_replication_device_section>,"
191                      "src_aggr_name1:dest_aggr_name1,"
192                      "src_aggr_name2:dest_aggr_name2,..."),
193    cfg.IntOpt('netapp_snapmirror_quiesce_timeout',
194               min=0,
195               default=3600,  # One Hour
196               help='The maximum time in seconds to wait for existing '
197                    'SnapMirror transfers to complete before aborting '
198                    'during a failover.'), ]
199
200netapp_support_opts = [
201    cfg.StrOpt('netapp_api_trace_pattern',
202               default='(.*)',
203               help=('A regular expression to limit the API tracing. This '
204                     'option is honored only if enabling ``api`` tracing '
205                     'with the ``trace_flags`` option. By default, '
206                     'all APIs will be traced.')),
207]
208
209CONF = cfg.CONF
210CONF.register_opts(netapp_proxy_opts, group=conf.SHARED_CONF_GROUP)
211CONF.register_opts(netapp_connection_opts, group=conf.SHARED_CONF_GROUP)
212CONF.register_opts(netapp_transport_opts, group=conf.SHARED_CONF_GROUP)
213CONF.register_opts(netapp_basicauth_opts, group=conf.SHARED_CONF_GROUP)
214CONF.register_opts(netapp_cluster_opts, group=conf.SHARED_CONF_GROUP)
215CONF.register_opts(netapp_provisioning_opts, group=conf.SHARED_CONF_GROUP)
216CONF.register_opts(netapp_img_cache_opts, group=conf.SHARED_CONF_GROUP)
217CONF.register_opts(netapp_eseries_opts, group=conf.SHARED_CONF_GROUP)
218CONF.register_opts(netapp_nfs_extra_opts, group=conf.SHARED_CONF_GROUP)
219CONF.register_opts(netapp_san_opts, group=conf.SHARED_CONF_GROUP)
220CONF.register_opts(netapp_replication_opts, group=conf.SHARED_CONF_GROUP)
221CONF.register_opts(netapp_support_opts, group=conf.SHARED_CONF_GROUP)
222