From: Aviram Bar-Haim Date: Fri, 16 Jan 2015 00:45:30 +0000 (+0200) Subject: Fix the iSER legacy usage in the new targets flow X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=009a6c301bb9f366eaaa76e1026ae962deda6d3b;p=openstack-build%2Fcinder-build.git Fix the iSER legacy usage in the new targets flow The iSER driver flow, after setting volume_driver to LVMISERDriver, is broken in the new driver - target model in the master, due to a mismatch in the target prefixes and a lack of iSER target initialization, with the correct parameters. In order to fix this: 1. The function initialize_connection, that sets the iSER required parameters, was added to cinder/volume/targets/iser.py (and overrides the new connection initialization in cinder/volume/targets/tgt.py). 2. The iSER and iSCSI prefixes equalized, due to the removal of brick/iscsi with the different default prefix for ISERTgtAdm (and for stability). Closes-Bug:#1411470 Change-Id: Ie4b9b85b47e9da20a1de1e10415766413cd01f04 --- diff --git a/cinder/volume/driver.py b/cinder/volume/driver.py index 78f13885d..2b690fd88 100644 --- a/cinder/volume/driver.py +++ b/cinder/volume/driver.py @@ -141,7 +141,7 @@ iser_opts = [ default=100, help='The maximum number of iSER target IDs per host'), cfg.StrOpt('iser_target_prefix', - default='iqn.2010-10.org.iser.openstack:', + default='iqn.2010-10.org.openstack:', help='Prefix for iSER volumes'), cfg.StrOpt('iser_ip_address', default='$my_ip', diff --git a/cinder/volume/targets/iser.py b/cinder/volume/targets/iser.py index ec730d605..2a41f504c 100644 --- a/cinder/volume/targets/iser.py +++ b/cinder/volume/targets/iser.py @@ -52,3 +52,25 @@ class ISERTgtAdm(TgtAdm): self.configuration.iscsi_ip_address = \ self.configuration.iser_ip_address self.configuration.iscsi_port = self.configuration.iser_port + + def initialize_connection(self, volume, connector): + """Initializes the connection and returns connection info. + The iser driver returns a driver_volume_type of 'iser'. + The format of the driver data is defined in _get_iscsi_properties. + Example return value:: + { + 'driver_volume_type': 'iser' + 'data': { + 'target_discovered': True, + 'target_iqn': + 'iqn.2010-10.org.iser.openstack:volume-00000001', + 'target_portal': '127.0.0.0.1:3260', + 'volume_id': 1, + } + } + """ + iser_properties = self._get_iscsi_properties(volume) + return { + 'driver_volume_type': 'iser', + 'data': iser_properties + }