From d7b66d21966dc99ca062193552eaec81455da852 Mon Sep 17 00:00:00 2001
From: Dirk Mueller <dirk@dmllr.de>
Date: Thu, 12 Dec 2013 14:17:43 +0100
Subject: [PATCH] [Netapp/Nexenta] Move registration of config options

This doesn't really make a difference in practice, but
makes it possible for the sample config generator to figure
out the config group relationship when options are in one
file.

Change-Id: I3bc6ab5bcc85a8c11c9261b0d8c520fb846a7864
---
 cinder/volume/drivers/netapp/common.py   |  6 ------
 cinder/volume/drivers/netapp/iscsi.py    | 10 ----------
 cinder/volume/drivers/netapp/nfs.py      |  9 ---------
 cinder/volume/drivers/netapp/options.py  | 10 ++++++++++
 cinder/volume/drivers/nexenta/iscsi.py   |  7 -------
 cinder/volume/drivers/nexenta/nfs.py     |  5 -----
 cinder/volume/drivers/nexenta/options.py |  7 +++++++
 7 files changed, 17 insertions(+), 37 deletions(-)

diff --git a/cinder/volume/drivers/netapp/common.py b/cinder/volume/drivers/netapp/common.py
index 4c45354ea..956b8d7bf 100644
--- a/cinder/volume/drivers/netapp/common.py
+++ b/cinder/volume/drivers/netapp/common.py
@@ -21,8 +21,6 @@ Unified driver for NetApp storage systems.
 Supports call to multiple storage systems of different families and protocols.
 """
 
-from oslo.config import cfg
-
 from cinder import exception
 from cinder.openstack.common import importutils
 from cinder.openstack.common import log as logging
@@ -33,10 +31,6 @@ from cinder.volume.drivers.netapp.options import netapp_proxy_opts
 LOG = logging.getLogger(__name__)
 
 
-CONF = cfg.CONF
-CONF.register_opts(netapp_proxy_opts)
-
-
 #NOTE(singn): Holds family:{protocol:driver} registration information.
 #Plug in new families and protocols to support new drivers.
 #No other code modification required.
diff --git a/cinder/volume/drivers/netapp/iscsi.py b/cinder/volume/drivers/netapp/iscsi.py
index e28adf45a..92e520d77 100644
--- a/cinder/volume/drivers/netapp/iscsi.py
+++ b/cinder/volume/drivers/netapp/iscsi.py
@@ -49,21 +49,11 @@ from cinder.volume.drivers.netapp.utils import provide_ems
 from cinder.volume.drivers.netapp.utils import set_safe_attr
 from cinder.volume.drivers.netapp.utils import validate_instantiation
 from cinder.volume import volume_types
-from oslo.config import cfg
 
 
 LOG = logging.getLogger(__name__)
 
 
-CONF = cfg.CONF
-CONF.register_opts(netapp_connection_opts)
-CONF.register_opts(netapp_transport_opts)
-CONF.register_opts(netapp_basicauth_opts)
-CONF.register_opts(netapp_cluster_opts)
-CONF.register_opts(netapp_7mode_opts)
-CONF.register_opts(netapp_provisioning_opts)
-
-
 class NetAppLun(object):
     """Represents a LUN on NetApp storage."""
 
diff --git a/cinder/volume/drivers/netapp/nfs.py b/cinder/volume/drivers/netapp/nfs.py
index 2c3dfba32..6ec3686af 100644
--- a/cinder/volume/drivers/netapp/nfs.py
+++ b/cinder/volume/drivers/netapp/nfs.py
@@ -26,8 +26,6 @@ from threading import Timer
 import time
 import urlparse
 
-from oslo.config import cfg
-
 from cinder import exception
 from cinder.image import image_utils
 from cinder.openstack.common import excutils
@@ -54,13 +52,6 @@ from cinder.volume.drivers import nfs
 LOG = logging.getLogger(__name__)
 
 
-CONF = cfg.CONF
-CONF.register_opts(netapp_connection_opts)
-CONF.register_opts(netapp_transport_opts)
-CONF.register_opts(netapp_basicauth_opts)
-CONF.register_opts(netapp_img_cache_opts)
-
-
 class NetAppNFSDriver(nfs.NfsDriver):
     """Base class for NetApp NFS driver.
       Executes commands relating to Volumes.
diff --git a/cinder/volume/drivers/netapp/options.py b/cinder/volume/drivers/netapp/options.py
index cb5b6a428..0f922bd66 100644
--- a/cinder/volume/drivers/netapp/options.py
+++ b/cinder/volume/drivers/netapp/options.py
@@ -134,3 +134,13 @@ netapp_img_cache_opts = [
                      'not been accessed in the last M minutes, where M is '
                      'the value of this parameter, will be deleted from the '
                      'cache to create free space on the NFS share.')), ]
+
+CONF = cfg.CONF
+CONF.register_opts(netapp_proxy_opts)
+CONF.register_opts(netapp_connection_opts)
+CONF.register_opts(netapp_transport_opts)
+CONF.register_opts(netapp_basicauth_opts)
+CONF.register_opts(netapp_cluster_opts)
+CONF.register_opts(netapp_7mode_opts)
+CONF.register_opts(netapp_provisioning_opts)
+CONF.register_opts(netapp_img_cache_opts)
diff --git a/cinder/volume/drivers/nexenta/iscsi.py b/cinder/volume/drivers/nexenta/iscsi.py
index a909e8a36..81d1c84f6 100644
--- a/cinder/volume/drivers/nexenta/iscsi.py
+++ b/cinder/volume/drivers/nexenta/iscsi.py
@@ -24,8 +24,6 @@
 .. moduleauthor:: Yuriy Taraday <yorik.sar@gmail.com>
 """
 
-from oslo.config import cfg
-
 from cinder import exception
 from cinder.openstack.common import log as logging
 from cinder.volume import driver
@@ -37,11 +35,6 @@ from cinder.volume.drivers.nexenta import utils
 VERSION = '1.1.3'
 LOG = logging.getLogger(__name__)
 
-CONF = cfg.CONF
-CONF.register_opts(options.NEXENTA_CONNECTION_OPTIONS)
-CONF.register_opts(options.NEXENTA_ISCSI_OPTIONS)
-CONF.register_opts(options.NEXENTA_VOLUME_OPTIONS)
-
 
 class NexentaISCSIDriver(driver.ISCSIDriver):  # pylint: disable=R0921
     """Executes volume driver commands on Nexenta Appliance.
diff --git a/cinder/volume/drivers/nexenta/nfs.py b/cinder/volume/drivers/nexenta/nfs.py
index 047e3f8ee..53b9832e5 100644
--- a/cinder/volume/drivers/nexenta/nfs.py
+++ b/cinder/volume/drivers/nexenta/nfs.py
@@ -26,8 +26,6 @@
 import hashlib
 import os
 
-from oslo.config import cfg
-
 from cinder import context
 from cinder import db
 from cinder import exception
@@ -42,9 +40,6 @@ from cinder.volume.drivers import nfs
 VERSION = '1.1.3'
 LOG = logging.getLogger(__name__)
 
-CONF = cfg.CONF
-CONF.register_opts(options.NEXENTA_NFS_OPTIONS)
-
 
 class NexentaNfsDriver(nfs.NfsDriver):  # pylint: disable=R0921
     """Executes volume driver commands on Nexenta Appliance.
diff --git a/cinder/volume/drivers/nexenta/options.py b/cinder/volume/drivers/nexenta/options.py
index f56340b16..8a04d4242 100644
--- a/cinder/volume/drivers/nexenta/options.py
+++ b/cinder/volume/drivers/nexenta/options.py
@@ -116,3 +116,10 @@ NEXENTA_RRMGR_OPTIONS = [
                default=2,
                help='Number of TCP connections.'),
 ]
+
+CONF = cfg.CONF
+CONF.register_opts(NEXENTA_CONNECTION_OPTIONS)
+CONF.register_opts(NEXENTA_ISCSI_OPTIONS)
+CONF.register_opts(NEXENTA_VOLUME_OPTIONS)
+CONF.register_opts(NEXENTA_NFS_OPTIONS)
+CONF.register_opts(NEXENTA_RRMGR_OPTIONS)
-- 
2.45.2