LIO: Don't add ACL for local initiator name

Currently cinder-rtstool requires /etc/iscsi/initiatorname.iscsi
to be present in order to create a LUN/ACL/portal successfully.
However, this is not required since Cinder will create the
required ACLs dynamically at attach time as well.

Removing this path means that iscsi-initiator-utils no longer
needs to be installed locally when using a remote Nova compute
node.

Closes-Bug: 1328580

Change-Id: Ieb5e28e3f81987ab8518b861fff885f371969a56
This commit is contained in:
Eric Harney 2014-06-10 11:25:01 -04:00
parent 7e57a36a3d
commit 37472be084

View File

@ -17,7 +17,6 @@
# limitations under the License.
import gettext
import re
import sys
import rtslib
@ -56,30 +55,6 @@ def create(backing_device, name, userid, password, initiator_iqns=None):
lun_new = rtslib.LUN(tpg_new, storage_object=so_new)
initiator_name = None
name_file = '/etc/iscsi/initiatorname.iscsi'
try:
with open(name_file, 'r') as f:
for line in f:
m = re.match('InitiatorName=(.+)', line)
if m != None:
initiator_name = m.group(1)
break
except IOError:
raise RtstoolError(_('Could not open %s') % name_file)
if initiator_name == None:
raise RtstoolError(_('Could not read InitiatorName from %s') %
name_file)
acl_new = rtslib.NodeACL(tpg_new, initiator_name, mode='create')
acl_new.chap_userid = userid
acl_new.chap_password = password
rtslib.MappedLUN(acl_new, lun_new.lun, lun_new.lun)
if initiator_iqns:
initiator_iqns = initiator_iqns.strip(' ')
for i in initiator_iqns.split(','):