Rename 'WindowsDriver' to 'WindowsISCSIDriver'

This was the first Cinder Volume driver available on Windows,
for which reason it was simply called 'WindowsDriver'.

As we've added another driver available on Windows, the SMB driver,
this has caused quite some confusion.

For this reason, we're now renaming it to 'WindowsISCSIDriver'.
The new location will be:
    cinder.volume.drivers.windows.iscsi.WindowsISCSIDriver

Change-Id: I3877491463dce3d46f7ac0e194ffdf46a0e7c84c
This commit is contained in:
Lucian Petrut 2018-01-18 13:31:55 +02:00
parent 7c2cbe5254
commit 0914b850f9
6 changed files with 42 additions and 31 deletions

View File

@ -162,10 +162,10 @@ from cinder.volume.drivers import tintri as cinder_volume_drivers_tintri
from cinder.volume.drivers.vmware import vmdk as \
cinder_volume_drivers_vmware_vmdk
from cinder.volume.drivers import vzstorage as cinder_volume_drivers_vzstorage
from cinder.volume.drivers.windows import iscsi as \
cinder_volume_drivers_windows_iscsi
from cinder.volume.drivers.windows import smbfs as \
cinder_volume_drivers_windows_smbfs
from cinder.volume.drivers.windows import windows as \
cinder_volume_drivers_windows_windows
from cinder.volume.drivers import zadara as cinder_volume_drivers_zadara
from cinder.volume.drivers.zfssa import zfssaiscsi as \
cinder_volume_drivers_zfssa_zfssaiscsi
@ -355,8 +355,8 @@ def list_opts():
cinder_volume_drivers_tintri.tintri_opts,
cinder_volume_drivers_vmware_vmdk.vmdk_opts,
cinder_volume_drivers_vzstorage.vzstorage_opts,
cinder_volume_drivers_windows_iscsi.windows_opts,
cinder_volume_drivers_windows_smbfs.volume_opts,
cinder_volume_drivers_windows_windows.windows_opts,
cinder_volume_drivers_zadara.zadara_opts,
cinder_volume_drivers_zfssa_zfssaiscsi.ZFSSA_OPTS,
cinder_volume_drivers_zfssa_zfssanfs.ZFSSA_OPTS,

View File

@ -33,20 +33,21 @@ from cinder.tests.unit import fake_snapshot
from cinder.tests.unit import fake_volume
from cinder.tests.unit.windows import db_fakes
from cinder.volume import configuration as conf
from cinder.volume.drivers.windows import windows
from cinder.volume.drivers.windows import iscsi as windows_iscsi
@ddt.ddt
class TestWindowsDriver(test.TestCase):
@mock.patch.object(windows, 'utilsfactory')
class TestWindowsISCSIDriver(test.TestCase):
@mock.patch.object(windows_iscsi, 'utilsfactory')
def setUp(self, mock_utilsfactory):
super(TestWindowsDriver, self).setUp()
super(TestWindowsISCSIDriver, self).setUp()
self.configuration = conf.Configuration(None)
self.configuration.append_config_values(windows.windows_opts)
self.configuration.append_config_values(windows_iscsi.windows_opts)
self.flags(windows_iscsi_lun_path='fake_iscsi_lun_path')
self.flags(image_conversion_dir='fake_image_conversion_dir')
self._driver = windows.WindowsDriver(configuration=self.configuration)
self._driver = windows_iscsi.WindowsISCSIDriver(
configuration=self.configuration)
@mock.patch.object(fileutils, 'ensure_tree')
def test_do_setup(self, mock_ensure_tree):
@ -56,7 +57,7 @@ class TestWindowsDriver(test.TestCase):
[mock.call('fake_iscsi_lun_path'),
mock.call('fake_image_conversion_dir')])
@mock.patch.object(windows.WindowsDriver, '_get_portals')
@mock.patch.object(windows_iscsi.WindowsISCSIDriver, '_get_portals')
def test_check_for_setup_error(self, mock_get_portals):
self._driver.check_for_setup_error()
@ -93,8 +94,8 @@ class TestWindowsDriver(test.TestCase):
fail_if_none_found=True)
@ddt.data(True, False)
@mock.patch.object(windows.WindowsDriver, '_get_portals')
@mock.patch.object(windows.WindowsDriver, '_get_target_name')
@mock.patch.object(windows_iscsi.WindowsISCSIDriver, '_get_portals')
@mock.patch.object(windows_iscsi.WindowsISCSIDriver, '_get_target_name')
def test_get_host_information(self, multipath, mock_get_target_name,
mock_get_portals):
tgt_utils = self._driver._tgt_utils
@ -140,7 +141,8 @@ class TestWindowsDriver(test.TestCase):
tgt_utils.get_target_information.assert_called_once_with(
mock.sentinel.target_name)
@mock.patch.object(windows.WindowsDriver, '_get_host_information')
@mock.patch.object(windows_iscsi.WindowsISCSIDriver,
'_get_host_information')
def test_initialize_connection(self, mock_get_host_info):
tgt_utils = self._driver._tgt_utils
@ -173,7 +175,7 @@ class TestWindowsDriver(test.TestCase):
self._driver._tgt_utils.deassociate_initiator.assert_called_once_with(
fake_initiator['initiator'], volume.provider_location)
@mock.patch.object(windows.WindowsDriver, 'local_path')
@mock.patch.object(windows_iscsi.WindowsISCSIDriver, 'local_path')
def test_create_volume(self, mock_local_path):
volume = fake_volume.fake_volume_obj(mock.sentinel.fake_context)
@ -203,7 +205,7 @@ class TestWindowsDriver(test.TestCase):
self.assertEqual(expected_disk_path, disk_path)
mock_get_fmt.assert_called_once_with()
@mock.patch.object(windows.WindowsDriver, 'local_path')
@mock.patch.object(windows_iscsi.WindowsISCSIDriver, 'local_path')
@mock.patch.object(fileutils, 'delete_if_exists')
def test_delete_volume(self, mock_delete_if_exists, mock_local_path):
volume = fake_volume.fake_volume_obj(mock.sentinel.fake_context)
@ -227,7 +229,7 @@ class TestWindowsDriver(test.TestCase):
self._driver._tgt_utils.create_snapshot.assert_called_once_with(
snapshot.volume_name, snapshot.name)
@mock.patch.object(windows.WindowsDriver, 'local_path')
@mock.patch.object(windows_iscsi.WindowsISCSIDriver, 'local_path')
def test_create_volume_from_snapshot(self, mock_local_path):
volume = fake_volume.fake_volume_obj(context.get_admin_context())
snapshot = fake_snapshot.fake_snapshot_obj(context.get_admin_context())
@ -257,9 +259,9 @@ class TestWindowsDriver(test.TestCase):
target_name = self._driver._get_target_name(volume)
self.assertEqual(expected_target_name, target_name)
@mock.patch.object(windows.WindowsDriver, '_get_target_name')
@mock.patch.object(windows.utils, 'generate_username')
@mock.patch.object(windows.utils, 'generate_password')
@mock.patch.object(windows_iscsi.WindowsISCSIDriver, '_get_target_name')
@mock.patch.object(windows_iscsi.utils, 'generate_username')
@mock.patch.object(windows_iscsi.utils, 'generate_password')
def test_create_export(self, mock_generate_password,
mock_generate_username,
mock_get_target_name):
@ -298,7 +300,7 @@ class TestWindowsDriver(test.TestCase):
provider_auth=expected_provider_auth)
self.assertEqual(expected_vol_updates, vol_updates)
@mock.patch.object(windows.WindowsDriver, '_get_target_name')
@mock.patch.object(windows_iscsi.WindowsISCSIDriver, '_get_target_name')
def test_remove_export(self, mock_get_target_name):
volume = fake_volume.fake_volume_obj(mock.sentinel.fake_context)
@ -308,7 +310,7 @@ class TestWindowsDriver(test.TestCase):
self._driver._tgt_utils.delete_iscsi_target.assert_called_once_with(
mock_get_target_name.return_value)
@mock.patch.object(windows.WindowsDriver, 'local_path')
@mock.patch.object(windows_iscsi.WindowsISCSIDriver, 'local_path')
@mock.patch.object(image_utils, 'temporary_file')
@mock.patch.object(image_utils, 'fetch_to_vhd')
@mock.patch('os.unlink')
@ -347,7 +349,7 @@ class TestWindowsDriver(test.TestCase):
[mock.call(volume.name, enabled=False),
mock.call(volume.name, enabled=True)])
@mock.patch.object(windows.uuidutils, 'generate_uuid')
@mock.patch.object(windows_iscsi.uuidutils, 'generate_uuid')
def test_temporary_snapshot(self, mock_generate_uuid):
tgt_utils = self._driver._tgt_utils
mock_generate_uuid.return_value = mock.sentinel.snap_uuid
@ -363,7 +365,7 @@ class TestWindowsDriver(test.TestCase):
tgt_utils.delete_snapshot.assert_called_once_with(
expected_snap_name)
@mock.patch.object(windows.WindowsDriver, '_temporary_snapshot')
@mock.patch.object(windows_iscsi.WindowsISCSIDriver, '_temporary_snapshot')
@mock.patch.object(image_utils, 'upload_volume')
@mock.patch.object(fileutils, 'delete_if_exists')
def test_copy_volume_to_image(self, mock_delete_if_exists,
@ -400,8 +402,8 @@ class TestWindowsDriver(test.TestCase):
mock_delete_if_exists.assert_called_once_with(
expected_tmp_vhd_path)
@mock.patch.object(windows.WindowsDriver, '_temporary_snapshot')
@mock.patch.object(windows.WindowsDriver, 'local_path')
@mock.patch.object(windows_iscsi.WindowsISCSIDriver, '_temporary_snapshot')
@mock.patch.object(windows_iscsi.WindowsISCSIDriver, 'local_path')
def test_create_cloned_volume(self, mock_local_path,
mock_tmp_snap):
tgt_utils = self._driver._tgt_utils
@ -444,7 +446,7 @@ class TestWindowsDriver(test.TestCase):
mock.sentinel.drive)
mock_splitdrive.assert_called_once_with('fake_iscsi_lun_path')
@mock.patch.object(windows.WindowsDriver, '_get_capacity_info')
@mock.patch.object(windows_iscsi.WindowsISCSIDriver, '_get_capacity_info')
def test_update_volume_stats(self, mock_get_capacity_info):
mock_get_capacity_info.return_value = (
mock.sentinel.size_gb,

View File

@ -31,6 +31,7 @@ from oslo_utils import uuidutils
from cinder import exception
from cinder.image import image_utils
from cinder import interface
from cinder.volume import configuration
from cinder.volume import driver
from cinder.volume import utils
@ -47,7 +48,8 @@ CONF = cfg.CONF
CONF.register_opts(windows_opts, group=configuration.SHARED_CONF_GROUP)
class WindowsDriver(driver.ISCSIDriver):
@interface.volumedriver
class WindowsISCSIDriver(driver.ISCSIDriver):
"""Executes volume driver commands on Windows Storage server."""
VERSION = '1.0.0'
@ -56,7 +58,7 @@ class WindowsDriver(driver.ISCSIDriver):
CI_WIKI_NAME = "Microsoft_iSCSI_CI"
def __init__(self, *args, **kwargs):
super(WindowsDriver, self).__init__(*args, **kwargs)
super(WindowsISCSIDriver, self).__init__(*args, **kwargs)
self.configuration = kwargs.get('configuration', None)
if self.configuration:
self.configuration.append_config_values(windows_opts)

View File

@ -174,6 +174,8 @@ MAPPING = {
'DellStorageCenterFCDriver':
'cinder.volume.drivers.dell_emc.sc.storagecenter_fc.'
'SCFCDriver',
'cinder.volume.drivers.windows.windows.WindowsDriver':
'cinder.volume.drivers.windows.iscsi.WindowsISCSIDriver',
}

View File

@ -7,7 +7,7 @@ Target service that can be used with OpenStack Block Storage in your stack.
Being entirely a software solution, consider it in particular for mid-sized
networks where the costs of a SAN might be excessive.
The Windows Block Storage driver works with OpenStack Compute on any
The Windows iSCSI Block Storage driver works with OpenStack Compute on any
hypervisor. It includes snapshotting support and the ``boot from volume``
feature.
@ -95,7 +95,7 @@ configuration sample for using the Windows iSCSI Driver:
[DEFAULT]
auth_strategy = keystone
volume_name_template = volume-%s
volume_driver = cinder.volume.drivers.windows.WindowsDriver
volume_driver = cinder.volume.drivers.windows.iscsi.WindowsISCSIDriver
glance_api_servers = IP_ADDRESS:9292
rabbit_host = IP_ADDRESS
rabbit_port = 5672
@ -107,7 +107,7 @@ configuration sample for using the Windows iSCSI Driver:
debug = True
The following table contains a reference to the only driver specific
option that will be used by the Block Storage Windows driver:
option that will be used by the Block Storage Windows iSCSI driver:
.. include:: ../../tables/cinder-windows.inc

View File

@ -0,0 +1,5 @@
---
upgrade:
- |
The Windows iSCSI driver has been renamed. The updated driver location
is ``cinder.volume.drivers.windows.iscsi.WindowsISCSIDriver``.