From 9b9aee668b0978507f37b9bf40e8ddaa16d2280b Mon Sep 17 00:00:00 2001 From: Victor Rodionov Date: Thu, 5 Sep 2013 02:02:51 +0400 Subject: [PATCH] Refactor Nexenta iSCSI driver 1) Rename volume.py to iscsi.py 2) Rename NexentaDriver to NexentaISCSIDriver DocImpact Change-Id: I117d881e1f5a70ea50e44c4a409e65961b85978f --- cinder/tests/test_drivers_compatibility.py | 2 +- cinder/tests/test_nexenta.py | 10 +++++----- cinder/volume/drivers/nexenta/{volume.py => iscsi.py} | 7 ++++--- cinder/volume/manager.py | 4 +++- 4 files changed, 13 insertions(+), 10 deletions(-) rename cinder/volume/drivers/nexenta/{volume.py => iscsi.py} (98%) diff --git a/cinder/tests/test_drivers_compatibility.py b/cinder/tests/test_drivers_compatibility.py index d88b856d121..59c026bc9c7 100644 --- a/cinder/tests/test_drivers_compatibility.py +++ b/cinder/tests/test_drivers_compatibility.py @@ -25,7 +25,7 @@ CONF = cfg.CONF RBD_MODULE = "cinder.volume.drivers.rbd.RBDDriver" SHEEPDOG_MODULE = "cinder.volume.drivers.sheepdog.SheepdogDriver" -NEXENTA_MODULE = "cinder.volume.drivers.nexenta.volume.NexentaDriver" +NEXENTA_MODULE = "cinder.volume.drivers.nexenta.iscsi.NexentaISCSIDriver" 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" diff --git a/cinder/tests/test_nexenta.py b/cinder/tests/test_nexenta.py index 3742b5acd61..8ecebf67d14 100644 --- a/cinder/tests/test_nexenta.py +++ b/cinder/tests/test_nexenta.py @@ -28,12 +28,12 @@ from cinder import test from cinder import units from cinder.volume import configuration as conf from cinder.volume.drivers import nexenta +from cinder.volume.drivers.nexenta import iscsi from cinder.volume.drivers.nexenta import jsonrpc from cinder.volume.drivers.nexenta import nfs -from cinder.volume.drivers.nexenta import volume -class TestNexentaDriver(test.TestCase): +class TestNexentaISCSIDriver(test.TestCase): TEST_VOLUME_NAME = 'volume1' TEST_VOLUME_NAME2 = 'volume2' TEST_SNAPSHOT_NAME = 'snapshot1' @@ -53,10 +53,10 @@ class TestNexentaDriver(test.TestCase): } def __init__(self, method): - super(TestNexentaDriver, self).__init__(method) + super(TestNexentaISCSIDriver, self).__init__(method) def setUp(self): - super(TestNexentaDriver, self).setUp() + super(TestNexentaISCSIDriver, self).setUp() self.configuration = mox_lib.MockObject(conf.Configuration) self.configuration.nexenta_host = '1.1.1.1' self.configuration.nexenta_user = 'admin' @@ -75,7 +75,7 @@ class TestNexentaDriver(test.TestCase): setattr(self.nms_mock, mod, self.mox.CreateMockAnything()) self.stubs.Set(jsonrpc, 'NexentaJSONProxy', lambda *_, **__: self.nms_mock) - self.drv = volume.NexentaDriver(configuration=self.configuration) + self.drv = iscsi.NexentaISCSIDriver(configuration=self.configuration) self.drv.do_setup({}) def test_setup_error(self): diff --git a/cinder/volume/drivers/nexenta/volume.py b/cinder/volume/drivers/nexenta/iscsi.py similarity index 98% rename from cinder/volume/drivers/nexenta/volume.py rename to cinder/volume/drivers/nexenta/iscsi.py index 0792d3f6130..af4ec4ab139 100644 --- a/cinder/volume/drivers/nexenta/volume.py +++ b/cinder/volume/drivers/nexenta/iscsi.py @@ -42,19 +42,20 @@ CONF.register_opts(options.NEXENTA_ISCSI_OPTIONS) CONF.register_opts(options.NEXENTA_VOLUME_OPTIONS) -class NexentaDriver(driver.ISCSIDriver): # pylint: disable=R0921 +class NexentaISCSIDriver(driver.ISCSIDriver): # pylint: disable=R0921 """Executes volume driver commands on Nexenta Appliance. Version history: 1.0.0 - Initial driver version. 1.0.1 - Fixed bug #1236626: catch "does not exist" exception of lu_exists. + 1.1.0 - Changed class name to NexentaISCSIDriver. """ - VERSION = '1.0.1' + VERSION = '1.1.0' def __init__(self, *args, **kwargs): - super(NexentaDriver, self).__init__(*args, **kwargs) + super(NexentaISCSIDriver, self).__init__(*args, **kwargs) self.nms = None if self.configuration: self.configuration.append_config_values( diff --git a/cinder/volume/manager.py b/cinder/volume/manager.py index dda76285883..38da689d049 100644 --- a/cinder/volume/manager.py +++ b/cinder/volume/manager.py @@ -92,7 +92,9 @@ MAPPING = { 'cinder.volume.driver.SheepdogDriver': 'cinder.volume.drivers.sheepdog.SheepdogDriver', 'cinder.volume.nexenta.volume.NexentaDriver': - 'cinder.volume.drivers.nexenta.volume.NexentaDriver', + 'cinder.volume.drivers.nexenta.iscsi.NexentaISCSIDriver', + 'cinder.volume.drivers.nexenta.volume.NexentaDriver': + 'cinder.volume.drivers.nexenta.iscsi.NexentaISCSIDriver', 'cinder.volume.san.SanISCSIDriver': 'cinder.volume.drivers.san.san.SanISCSIDriver', 'cinder.volume.san.SolarisISCSIDriver':