Merge "Cleaning up volume driver paths"
This commit is contained in:
@@ -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'
|
||||
|
||||
|
||||
@@ -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__)
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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")
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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__)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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',
|
||||
@@ -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',
|
||||
@@ -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):
|
||||
@@ -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 = [
|
||||
@@ -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',
|
||||
@@ -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__)
|
||||
@@ -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__)
|
||||
@@ -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__)
|
||||
@@ -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__)
|
||||
|
||||
@@ -34,7 +34,7 @@ if os.name == 'nt':
|
||||
import wmi
|
||||
|
||||
|
||||
LOG = logging.getLogger("cinder.volume.windows.volume")
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
FLAGS = flags.FLAGS
|
||||
|
||||
13
cinder/volume/drivers/xenapi/__init__.py
Normal file
13
cinder/volume/drivers/xenapi/__init__.py
Normal 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.
|
||||
@@ -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 = [
|
||||
@@ -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',
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user