Windows: fix connectors 'disconnect_volume' signature

The Windows connectors do not include the 'device_info' argument
in the 'disconnect_volume' method.

This wasn't an issue for Nova as the Hyper-V driver doesn't pass
this argument, yet Cinder does pass it, which will lead to an
exception.

This change adds the missing argument, defaulting to "None" so that
it won't break the Nova Hyper-V driver.

Change-Id: Iaf8b57c97afc393862a61a7338a35f008b65c8c1
Closes-Bug: #1738390
This commit is contained in:
Lucian Petrut 2017-12-15 12:16:52 +02:00
parent 63b45f5e2a
commit 603d036ff9
5 changed files with 7 additions and 5 deletions

View File

@ -126,6 +126,6 @@ class WindowsFCConnector(win_conn_base.BaseWindowsConnector):
return mappings
@utils.trace
def disconnect_volume(self, connection_properties,
def disconnect_volume(self, connection_properties, device_info=None,
force=False, ignore_errors=False):
pass

View File

@ -134,7 +134,7 @@ class WindowsISCSIConnector(win_conn_base.BaseWindowsConnector,
return device_info
@utils.trace
def disconnect_volume(self, connection_properties,
def disconnect_volume(self, connection_properties, device_info=None,
force=False, ignore_errors=False):
# We want to refresh the cached information first.
self._diskutils.rescan_disks()

View File

@ -49,7 +49,7 @@ class WindowsSMBFSConnector(win_conn_base.BaseWindowsConnector):
return device_info
@utils.trace
def disconnect_volume(self, connection_properties,
def disconnect_volume(self, connection_properties, device_info=None,
force=False, ignore_errors=False):
export_path = self._get_export_path(connection_properties)
self._remotefsclient.unmount(export_path)

View File

@ -168,7 +168,8 @@ class WindowsISCSIConnectorTestCase(test_base.WindowsConnectorTestBase):
mock_get_all_targets.return_value = targets
self._iscsi_utils.get_target_luns.return_value = [mock.sentinel.lun_0]
self._connector.disconnect_volume(mock.sentinel.conn_props)
self._connector.disconnect_volume(mock.sentinel.conn_props,
mock.sentinel.dev_info)
self._diskutils.rescan_disks.assert_called_once_with()
mock_get_all_targets.assert_called_once_with(mock.sentinel.conn_props)

View File

@ -46,7 +46,8 @@ class WindowsSMBFSConnectorTestCase(test_base.WindowsConnectorTestBase):
@mock.patch.object(smbfs.WindowsSMBFSConnector, '_get_export_path')
def test_disconnect_volume(self, mock_get_export_path):
self._connector.disconnect_volume(mock.sentinel.conn_props)
self._connector.disconnect_volume(mock.sentinel.conn_props,
mock.sentinel.dev_info)
self._remotefs.unmount.assert_called_once_with(
mock_get_export_path.return_value)