From cb5e6b35b0900fd950c8bbbcee1794b0ee5f75e7 Mon Sep 17 00:00:00 2001 From: nikeshmahalka Date: Wed, 25 Feb 2015 20:44:13 +0530 Subject: [PATCH] Use Unique SCST Group names in SCST cinder helper driver. Currently, while setting up GROUPS under targets in scst.conf, we are using the Initiator IQN as the group name. When we have multiple targets and we want to connect LUN's from these multiple targets to the same initiator, we are using the same GROUP name in all the Target sections. It would be good to provide a unique group name by prepending the GROUP name with the target name. So the GROUP name will be "Target name+Initiator IQN". Change-Id: Ia0fbab18f792e602e1f4dae6f9ca0e607d0cfde3 Closes-Bug: #1424973 --- cinder/volume/targets/scst.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cinder/volume/targets/scst.py b/cinder/volume/targets/scst.py index c8f5aeb4e..35dce9e51 100644 --- a/cinder/volume/targets/scst.py +++ b/cinder/volume/targets/scst.py @@ -67,14 +67,14 @@ class SCSTAdm(iscsi.ISCSITarget): return parsed[1] def _get_group(self): - scst_group = self.initiator_iqn + scst_group = "%s%s" % (self.initiator_iqn, self.target_name) (out, _err) = self.scst_execute('-list_group') if scst_group in out: return out return None def _get_luns_info(self): - scst_group = self.initiator_iqn + scst_group = "%s%s" % (self.initiator_iqn, self.target_name) (out, _err) = self.scst_execute('-list_group', scst_group, '-driver', self.target_driver, '-target', self.target_name) @@ -108,7 +108,7 @@ class SCSTAdm(iscsi.ISCSITarget): def create_iscsi_target(self, name, vol_id, tid, lun, path, chap_auth=None): - scst_group = self.initiator_iqn + scst_group = "%s%s" % (self.initiator_iqn, self.target_name) vol_name = path.split("/")[3] try: (out, _err) = self.scst_execute('-noprompt', @@ -318,10 +318,12 @@ class SCSTAdm(iscsi.ISCSITarget): if not int(lun) in self._get_luns_info(): raise exception.ISCSITargetRemoveFailed(volume_id=vol_id) try: + scst_group = "%s%s" % (self.remove_initiator_iqn, + self.target_name) self.scst_execute('-noprompt', '-rem_lun', lun, '-driver', self.target_driver, '-target', iqn, '-group', - self.remove_initiator_iqn) + scst_group) except putils.ProcessExecutionError as e: LOG.error(_LE("Failed to remove LUN %s"), e) raise exception.ISCSITargetHelperCommandFailed( -- 2.45.2