with mock.patch.object(manager.VolumeManager,
'_add_or_delete_fc_connection')\
as add_del_conn_mock:
- self.terminate_connection(None, None, None, False)
+ self.terminate_connection(self.context_mock, None, None, False)
add_del_conn_mock.assert_called_once_with(conn_info, 0)
@mock.patch.object(utils, 'require_driver_initialized')
as add_del_conn_mock:
self.configuration.zoning_mode = 'none'
self.zonemanager = None
- self.terminate_connection(None, None, None, False)
+ self.terminate_connection(self.context_mock, None, None, False)
assert not add_del_conn_mock.called
@mock.patch.object(utils, 'require_driver_initialized')
with mock.patch.object(manager.VolumeManager,
'_add_or_delete_fc_connection')\
as add_del_conn_mock:
- self.terminate_connection(None, None, None, False)
+ self.terminate_connection(self.context_mock, None, None, False)
assert not add_del_conn_mock.called
@mock.patch.object(fc_zone_manager.ZoneManager, 'add_connection')
model_update = None
try:
LOG.debug(_("Volume %s: creating export"), volume_id)
- model_update = self.driver.create_export(context, volume)
+ model_update = self.driver.create_export(context.elevated(),
+ volume)
if model_update:
volume = self.db.volume_update(context,
volume_id,
try:
conn_info = self.driver.initialize_connection(volume, connector)
except Exception as err:
- self.driver.remove_export(context, volume)
err_msg = (_('Unable to fetch connection information from '
'backend: %(err)s') % {'err': err})
LOG.error(err_msg)
+ self.driver.remove_export(context.elevated(), volume)
raise exception.VolumeBackendAPIException(data=err_msg)
# Add qos_specs to connection info
try:
LOG.debug(_("volume %s: removing export"), volume_id)
- self.driver.remove_export(context, volume_ref)
+ self.driver.remove_export(context.elevated(), volume_ref)
except Exception as ex:
LOG.exception(_("Error detaching volume %(volume)s, "
"due to remove export failure."),