Cleaning up volume driver paths

Moved all the remaining drivers under
cinder.volume.drivers. Updated the tests with
the new module paths and add backwards compatibilty
for the existing paths.

Implements bp driver-cleanup

Change-Id: I7673b5209cc072ac859d7d32cdeed2e7a17331e8
This commit is contained in:
Nirmal Ranganathan 2012-11-21 11:44:27 -06:00
parent 3f183070f7
commit db39d32c2f
35 changed files with 203 additions and 46 deletions

View File

@ -23,7 +23,7 @@ FLAGS = flags.FLAGS
flags.DECLARE('iscsi_num_targets', 'cinder.volume.driver')
flags.DECLARE('policy_file', 'cinder.policy')
flags.DECLARE('volume_driver', 'cinder.volume.manager')
flags.DECLARE('xiv_proxy', 'cinder.volume.xiv')
flags.DECLARE('xiv_proxy', 'cinder.volume.drivers.xiv')
def_vol_type = 'fake_vol_type'

View File

@ -14,7 +14,7 @@
from cinder import exception
from cinder.openstack.common import log as logging
from cinder import test
from cinder.volume.san.hp_lefthand import HpSanISCSIDriver
from cinder.volume.drivers.san.hp_lefthand import HpSanISCSIDriver
LOG = logging.getLogger(__name__)

View File

@ -21,6 +21,19 @@ FLAGS = flags.FLAGS
RBD_MODULE = "cinder.volume.drivers.rbd.RBDDriver"
SHEEPDOG_MODULE = "cinder.volume.drivers.sheepdog.SheepdogDriver"
NEXENTA_MODULE = "cinder.volume.drivers.nexenta.volume.NexentaDriver"
SAN_MODULE = "cinder.volume.drivers.san.san.SanISCSIDriver"
SOLARIS_MODULE = "cinder.volume.drivers.san.solaris.SolarisISCSIDriver"
LEFTHAND_MODULE = "cinder.volume.drivers.san.hp_lefthand.HpSanISCSIDriver"
NETAPP_MODULE = "cinder.volume.drivers.netapp.NetAppISCSIDriver"
NETAPP_CMODE_MODULE = "cinder.volume.drivers.netapp.NetAppCmodeISCSIDriver"
NETAPP_NFS_MODULE = "cinder.volume.drivers.netapp_nfs.NetAppNFSDriver"
NFS_MODULE = "cinder.volume.drivers.nfs.NfsDriver"
SOLIDFIRE_MODULE = "cinder.volume.drivers.solidfire.SolidFire"
STORWIZE_SVC_MODULE = "cinder.volume.drivers.storwize_svc.StorwizeSVCDriver"
WINDOWS_MODULE = "cinder.volume.drivers.windows.WindowsDriver"
XIV_MODULE = "cinder.volume.drivers.xiv.XIVDriver"
ZADARA_MODULE = "cinder.volume.drivers.zadara.ZadaraVPSAISCSIDriver"
class VolumeDriverCompatibility(test.TestCase):
@ -54,5 +67,109 @@ class VolumeDriverCompatibility(test.TestCase):
self.assertEquals(self._driver_module_name(), SHEEPDOG_MODULE)
def test_sheepdog_new(self):
self._load_driver('cinder.volume.drivers.sheepdog.SheepdogDriver')
self._load_driver(SHEEPDOG_MODULE)
self.assertEquals(self._driver_module_name(), SHEEPDOG_MODULE)
def test_nexenta_old(self):
self._load_driver('cinder.volume.nexenta.volume.NexentaDriver')
self.assertEquals(self._driver_module_name(), NEXENTA_MODULE)
def test_nexenta_new(self):
self._load_driver(NEXENTA_MODULE)
self.assertEquals(self._driver_module_name(), NEXENTA_MODULE)
def test_san_old(self):
self._load_driver('cinder.volume.san.SanISCSIDriver')
self.assertEquals(self._driver_module_name(), SAN_MODULE)
def test_san_new(self):
self._load_driver(SAN_MODULE)
self.assertEquals(self._driver_module_name(), SAN_MODULE)
def test_solaris_old(self):
self._load_driver('cinder.volume.san.SolarisISCSIDriver')
self.assertEquals(self._driver_module_name(), SOLARIS_MODULE)
def test_solaris_new(self):
self._load_driver(SOLARIS_MODULE)
self.assertEquals(self._driver_module_name(), SOLARIS_MODULE)
def test_hp_lefthand_old(self):
self._load_driver('cinder.volume.san.HpSanISCSIDriver')
self.assertEquals(self._driver_module_name(), LEFTHAND_MODULE)
def test_hp_lefthand_new(self):
self._load_driver(LEFTHAND_MODULE)
self.assertEquals(self._driver_module_name(), LEFTHAND_MODULE)
def test_netapp_old(self):
self._load_driver('cinder.volume.netapp.NetAppISCSIDriver')
self.assertEquals(self._driver_module_name(), NETAPP_MODULE)
def test_netapp_new(self):
self._load_driver(NETAPP_MODULE)
self.assertEquals(self._driver_module_name(), NETAPP_MODULE)
def test_netapp_cmode_old(self):
self._load_driver('cinder.volume.netapp.NetAppCmodeISCSIDriver')
self.assertEquals(self._driver_module_name(), NETAPP_CMODE_MODULE)
def test_netapp_cmode_new(self):
self._load_driver(NETAPP_CMODE_MODULE)
self.assertEquals(self._driver_module_name(), NETAPP_CMODE_MODULE)
def test_netapp_nfs_old(self):
self._load_driver('cinder.volume.netapp_nfs.NetAppNFSDriver')
self.assertEquals(self._driver_module_name(), NETAPP_NFS_MODULE)
def test_netapp_nfs_new(self):
self._load_driver(NETAPP_NFS_MODULE)
self.assertEquals(self._driver_module_name(), NETAPP_NFS_MODULE)
def test_nfs_old(self):
self._load_driver('cinder.volume.nfs.NfsDriver')
self.assertEquals(self._driver_module_name(), NFS_MODULE)
def test_nfs_new(self):
self._load_driver(NFS_MODULE)
self.assertEquals(self._driver_module_name(), NFS_MODULE)
def test_solidfire_old(self):
self._load_driver('cinder.volume.solidfire.SolidFire')
self.assertEquals(self._driver_module_name(), SOLIDFIRE_MODULE)
def test_solidfire_new(self):
self._load_driver(SOLIDFIRE_MODULE)
self.assertEquals(self._driver_module_name(), SOLIDFIRE_MODULE)
def test_storwize_svc_old(self):
self._load_driver('cinder.volume.storwize_svc.StorwizeSVCDriver')
self.assertEquals(self._driver_module_name(), STORWIZE_SVC_MODULE)
def test_storwize_svc_new(self):
self._load_driver(STORWIZE_SVC_MODULE)
self.assertEquals(self._driver_module_name(), STORWIZE_SVC_MODULE)
def test_windows_old(self):
self._load_driver('cinder.volume.windows.WindowsDriver')
self.assertEquals(self._driver_module_name(), WINDOWS_MODULE)
def test_windows_new(self):
self._load_driver(WINDOWS_MODULE)
self.assertEquals(self._driver_module_name(), WINDOWS_MODULE)
def test_xiv_old(self):
self._load_driver('cinder.volume.xiv.XIVDriver')
self.assertEquals(self._driver_module_name(), XIV_MODULE)
def test_xiv_new(self):
self._load_driver(XIV_MODULE)
self.assertEquals(self._driver_module_name(), XIV_MODULE)
def test_zadara_old(self):
self._load_driver('cinder.volume.zadara.ZadaraVPSAISCSIDriver')
self.assertEquals(self._driver_module_name(), ZADARA_MODULE)
def test_zadara_new(self):
self._load_driver(ZADARA_MODULE)
self.assertEquals(self._driver_module_name(), ZADARA_MODULE)

View File

@ -27,7 +27,7 @@ from lxml import etree
from cinder.openstack.common import log as logging
from cinder import test
from cinder.volume import netapp
from cinder.volume.drivers import netapp
LOG = logging.getLogger("cinder.volume.driver")

View File

@ -20,9 +20,9 @@ from cinder import context
from cinder import exception
from cinder import test
from cinder.volume import netapp
from cinder.volume import netapp_nfs
from cinder.volume import nfs
from cinder.volume.drivers import netapp
from cinder.volume.drivers import netapp_nfs
from cinder.volume.drivers import nfs
from mox import IgnoreArg
from mox import IsA
from mox import MockObject

View File

@ -24,9 +24,9 @@ import urllib2
import cinder.flags
import cinder.test
from cinder.volume import nexenta
from cinder.volume.nexenta import jsonrpc
from cinder.volume.nexenta import volume
from cinder.volume.drivers import nexenta
from cinder.volume.drivers.nexenta import jsonrpc
from cinder.volume.drivers.nexenta import volume
FLAGS = cinder.flags.FLAGS

View File

@ -30,7 +30,7 @@ from cinder import exception
from cinder.exception import ProcessExecutionError
from cinder import test
from cinder.volume import nfs
from cinder.volume.drivers import nfs
class DumbVolume(object):

View File

@ -18,7 +18,7 @@
from cinder import exception
from cinder.openstack.common import log as logging
from cinder import test
from cinder.volume.solidfire import SolidFire
from cinder.volume.drivers.solidfire import SolidFire
LOG = logging.getLogger(__name__)

View File

@ -32,7 +32,7 @@ from cinder import flags
from cinder.openstack.common import excutils
from cinder.openstack.common import log as logging
from cinder import test
from cinder.volume import storwize_svc
from cinder.volume.drivers import storwize_svc
FLAGS = flags.FLAGS

View File

@ -24,7 +24,7 @@ import cinder.flags
from cinder.tests.windows import basetestcase
from cinder.tests.windows import db_fakes
from cinder.tests.windows import windowsutils
from cinder.volume import windows
from cinder.volume.drivers import windows
FLAGS = cinder.flags.FLAGS

View File

@ -27,7 +27,6 @@ import webob.dec
from cinder.api import openstack as openstack_api
from cinder import exception
from cinder import test
from cinder.volume import xiv
import cinder.wsgi

View File

@ -16,8 +16,8 @@
# License for the specific language governing permissions and limitations
# under the License.
from cinder.volume.xenapi import lib
from cinder.volume import xenapi_sm as driver
from cinder.volume.drivers.xenapi import lib
from cinder.volume.drivers.xenapi import sm as driver
import mox
import unittest

View File

@ -23,7 +23,7 @@
from cinder import exception
from cinder import flags
from cinder import test
from cinder.volume import xiv
from cinder.volume.drivers import xiv
FLAGS = flags.FLAGS

View File

@ -25,7 +25,7 @@ import httplib
from cinder import exception
from cinder.openstack.common import log as logging
from cinder import test
from cinder.volume import zadara
from cinder.volume.drivers import zadara
from lxml import etree

View File

@ -36,7 +36,7 @@ from cinder.openstack.common import log as logging
from cinder.volume import driver
from cinder.volume import volume_types
LOG = logging.getLogger("cinder.volume.driver")
LOG = logging.getLogger(__name__)
netapp_opts = [
cfg.StrOpt('netapp_wsdl_url',

View File

@ -27,10 +27,10 @@ from cinder import exception
from cinder import flags
from cinder.openstack.common import cfg
from cinder.openstack.common import log as logging
from cinder.volume.netapp import netapp_opts
from cinder.volume import nfs
from cinder.volume.drivers.netapp import netapp_opts
from cinder.volume.drivers import nfs
LOG = logging.getLogger("cinder.volume.driver")
LOG = logging.getLogger(__name__)
netapp_nfs_opts = [
cfg.IntOpt('synchronous_snapshot_create',

View File

@ -26,9 +26,9 @@ import urllib2
from cinder.openstack.common import jsonutils
from cinder.openstack.common import log as logging
from cinder.volume import nexenta
from cinder.volume.drivers import nexenta
LOG = logging.getLogger("cinder.volume.nexenta.jsonrpc")
LOG = logging.getLogger(__name__)
class NexentaJSONException(nexenta.NexentaException):

View File

@ -27,10 +27,10 @@ from cinder import flags
from cinder.openstack.common import cfg
from cinder.openstack.common import log as logging
from cinder.volume import driver
from cinder.volume import nexenta
from cinder.volume.nexenta import jsonrpc
from cinder.volume.drivers import nexenta
from cinder.volume.drivers.nexenta import jsonrpc
LOG = logging.getLogger("cinder.volume.nexenta.volume")
LOG = logging.getLogger(__name__)
FLAGS = flags.FLAGS
nexenta_opts = [

View File

@ -25,7 +25,7 @@ from cinder.openstack.common import cfg
from cinder.openstack.common import log as logging
from cinder.volume import driver
LOG = logging.getLogger("cinder.volume.driver")
LOG = logging.getLogger(__name__)
volume_opts = [
cfg.StrOpt('nfs_shares_config',

View File

@ -23,7 +23,7 @@ from lxml import etree
from cinder import exception
from cinder import flags
from cinder.openstack.common import log as logging
from cinder.volume.san.san import SanISCSIDriver
from cinder.volume.drivers.san.san import SanISCSIDriver
LOG = logging.getLogger(__name__)

View File

@ -16,7 +16,7 @@ from cinder import exception
from cinder import flags
from cinder.openstack.common import cfg
from cinder.openstack.common import log as logging
from cinder.volume.san.san import SanISCSIDriver
from cinder.volume.drivers.san.san import SanISCSIDriver
LOG = logging.getLogger(__name__)

View File

@ -33,7 +33,7 @@ from cinder import exception
from cinder import flags
from cinder.openstack.common import cfg
from cinder.openstack.common import log as logging
from cinder.volume.san.san import SanISCSIDriver
from cinder.volume.drivers.san.san import SanISCSIDriver
LOG = logging.getLogger(__name__)

View File

@ -49,7 +49,7 @@ from cinder import flags
from cinder.openstack.common import cfg
from cinder.openstack.common import excutils
from cinder.openstack.common import log as logging
from cinder.volume.san import san
from cinder.volume.drivers.san import san
LOG = logging.getLogger(__name__)

View File

@ -34,7 +34,7 @@ if os.name == 'nt':
import wmi
LOG = logging.getLogger("cinder.volume.windows.volume")
LOG = logging.getLogger(__name__)
FLAGS = flags.FLAGS

View File

@ -0,0 +1,13 @@
# Copyright 2012 OpenStack LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

View File

@ -19,7 +19,7 @@
from cinder import flags
from cinder.openstack.common import cfg
from cinder.volume import driver
from cinder.volume.xenapi import lib as xenapi_lib
from cinder.volume.drivers.xenapi import lib as xenapi_lib
xenapi_opts = [

View File

@ -29,7 +29,7 @@ from cinder import flags
from cinder.openstack.common import cfg
from cinder.openstack.common import importutils
from cinder.openstack.common import log as logging
from cinder.volume.san import san
from cinder.volume.drivers.san import san
ibm_xiv_opts = [
cfg.StrOpt('xiv_proxy',

View File

@ -72,6 +72,32 @@ MAPPING = {
'cinder.volume.driver.RBDDriver': 'cinder.volume.drivers.rbd.RBDDriver',
'cinder.volume.driver.SheepdogDriver':
'cinder.volume.drivers.sheepdog.SheepdogDriver',
'cinder.volume.nexenta.volume.NexentaDriver':
'cinder.volume.drivers.nexenta.volume.NexentaDriver',
'cinder.volume.san.SanISCSIDriver':
'cinder.volume.drivers.san.san.SanISCSIDriver',
'cinder.volume.san.SolarisISCSIDriver':
'cinder.volume.drivers.san.solaris.SolarisISCSIDriver',
'cinder.volume.san.HpSanISCSIDriver':
'cinder.volume.drivers.san.hp_lefthand.HpSanISCSIDriver',
'cinder.volume.netapp.NetAppISCSIDriver':
'cinder.volume.drivers.netapp.NetAppISCSIDriver',
'cinder.volume.netapp.NetAppCmodeISCSIDriver':
'cinder.volume.drivers.netapp.NetAppCmodeISCSIDriver',
'cinder.volume.netapp_nfs.NetAppNFSDriver':
'cinder.volume.drivers.netapp_nfs.NetAppNFSDriver',
'cinder.volume.nfs.NfsDriver':
'cinder.volume.drivers.nfs.NfsDriver',
'cinder.volume.solidfire.SolidFire':
'cinder.volume.drivers.solidfire.SolidFire',
'cinder.volume.storwize_svc.StorwizeSVCDriver':
'cinder.volume.drivers.storwize_svc.StorwizeSVCDriver',
'cinder.volume.windows.WindowsDriver':
'cinder.volume.drivers.windows.WindowsDriver',
'cinder.volume.xiv.XIVDriver':
'cinder.volume.drivers.xiv.XIVDriver',
'cinder.volume.zadara.ZadaraVPSAISCSIDriver':
'cinder.volume.drivers.zadara.ZadaraVPSAISCSIDriver'
}
@ -85,6 +111,8 @@ class VolumeManager(manager.SchedulerDependentManager):
if not volume_driver:
volume_driver = FLAGS.volume_driver
if volume_driver in MAPPING:
LOG.warn(_("Driver path %s is deprecated, update your "
"configuration to the new path."), volume_driver)
self.driver = importutils.import_object(MAPPING[volume_driver])
else:
self.driver = importutils.import_object(volume_driver)

View File

@ -570,7 +570,7 @@
#### (BoolOpt) if True will force update capabilities on each check
######## defined in cinder.volume.netapp ########
######## defined in cinder.volume.drivers.netapp ########
# netapp_wsdl_url=<None>
#### (StrOpt) URL of the WSDL file for the DFM server
@ -599,7 +599,7 @@
#### (StrOpt) Vfiler to use for provisioning
######## defined in cinder.volume.netapp_nfs ########
######## defined in cinder.volume.drivers.netapp_nfs ########
# synchronous_snapshot_create=0
#### (IntOpt) Does snapshot creation call returns immediately
@ -631,7 +631,7 @@
#### (StrOpt) Vfiler to use for provisioning
######## defined in cinder.volume.nexenta.volume ########
######## defined in cinder.volume.drivers.nexenta.volume ########
# nexenta_host=
#### (StrOpt) IP address of Nexenta SA
@ -667,7 +667,7 @@
#### (BoolOpt) flag to create sparse volumes
######## defined in cinder.volume.nfs ########
######## defined in cinder.volume.drivers.nfs ########
# nfs_shares_config=<None>
#### (StrOpt) File with the list of available nfs shares
@ -684,7 +684,7 @@
#### volume creation takes a lot of time.
######## defined in cinder.volume.san ########
######## defined in cinder.volume.drivers.san.san ########
# san_thin_provision=true
#### (BoolOpt) Use thin provisioning for SAN volumes?
@ -721,13 +721,13 @@
#### (IntOpt) Maximum ssh connections in the pool
######## defined in cinder.volume.solaris ########
######## defined in cinder.volume.drivers.san.solaris ########
# san_zfs_volume_base=rpool/
#### (StrOpt) The ZFS path under which to create zvols for volumes.
######## defined in cinder.volume.solidfire ########
######## defined in cinder.volume.drivers.solidfire ########
# sf_emulate_512=true
#### (BoolOpt) Set 512 byte emulation on volume creation;
@ -745,7 +745,7 @@
#### (BoolOpt) Allow tenants to specify QOS on create
######## defined in cinder.volume.storwize_svc ########
######## defined in cinder.volume.drivers.storwize_svc ########
# storwize_svc_volpool_name=volpool
#### (StrOpt) Storage system storage pool for volumes
@ -774,13 +774,13 @@
#### prepared. Maximum value is 600 seconds (10 minutes).
######## defined in cinder.volume.xiv ########
######## defined in cinder.volume.drivers.xiv ########
# xiv_proxy=xiv_openstack.nova_proxy.XIVNovaProxy
#### (StrOpt) Proxy driver
######## defined in cinder.volume.zadara ########
######## defined in cinder.volume.drivers.zadara ########
# zadara_vpsa_ip=<None>
#### (StrOpt) Management IP of Zadara VPSA