]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Use Unique SCST Group names in SCST cinder helper driver.
authornikeshmahalka <Nikesh.Mahalka@emulex.com>
Wed, 25 Feb 2015 15:14:13 +0000 (20:44 +0530)
committernikeshmahalka <Nikesh.Mahalka@emulex.com>
Wed, 25 Feb 2015 15:21:30 +0000 (20:51 +0530)
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

index c8f5aeb4e4aefc8fed5f480290249a7b63a4141d..35dce9e51a83f23efc3b9a5b0796c438dc91bae9 100644 (file)
@@ -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(