TEST_CONNECTOR = {'host': 'localhost1'}
data = self.drv.initialize_connection(TEST_VOLUME1, TEST_CONNECTOR)
- expected_data = {'data': {'auth_method': 'a',
- 'auth_password': 'c',
- 'auth_username': 'b',
- 'encrypted': False,
- 'target_discovered': False,
- 'target_iqn': '2',
- 'target_lun': 3,
- 'target_portal': '1',
- 'volume_id': 'fake-uuid'},
- 'driver_volume_type': 'iscsi'}
+ expected_data = {'data': {'device_path': '/dev/loop1'},
+ 'driver_volume_type': 'local'}
self.assertEqual(expected_data, data)
export_info = self.target_driver.create_export(context,
volume,
volume_path)
- return {'provider_location': export_info['location'],
- 'provider_auth': export_info['auth'], }
+ return {
+ 'provider_location': export_info['location'] + ' ' + volume_path,
+ 'provider_auth': export_info['auth'],
+ }
def remove_export(self, context, volume):
self.target_driver.remove_export(context, volume)
def initialize_connection(self, volume, connector):
- return self.target_driver.initialize_connection(volume, connector)
+ if connector['host'] != volutils.extract_host(volume['host'], 'host'):
+ return self.target_driver.initialize_connection(volume, connector)
+ else:
+ return {
+ 'driver_volume_type': 'local',
+ 'data': {'device_path': self.local_path(volume)},
+ }
def validate_connector(self, connector):
return self.target_driver.validate_connector(connector)