]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
cinder-rtstool: should use acl.node_wwn
authorTomoki Sekiyama <tomoki.sekiyama@hds.com>
Wed, 7 Jan 2015 22:33:51 +0000 (17:33 -0500)
committerTomoki Sekiyama <tomoki.sekiyama@hds.com>
Wed, 7 Jan 2015 23:01:41 +0000 (18:01 -0500)
In newer version of rtslib module, NodeACL is now an object, not a
dict. Thus, acl.node_wwn must be used instead of acl['node_wwn'],
otherwise it will fail with exception.

Change-Id: I0fb53596a2a99609aa4d573f1254b3afa7d9fd91
Closes-Bug: #1408443

cinder/cmd/rtstool.py
cinder/tests/test_cmd.py

index 76c4d11b376368440e80bbd38e9c23501f91e633..afbf8c695120b4eaa1fbc68a29cec23ffc3740ed 100644 (file)
@@ -100,7 +100,7 @@ def add_initiator(target_iqn, initiator_iqn, userid, password):
     tpg = target.tpgs.next()  # get the first one
     for acl in tpg.node_acls:
         # See if this ACL configuration already exists
-        if acl['node_wwn'] == initiator_iqn:
+        if acl.node_wwn == initiator_iqn:
             # No further action required
             return
 
index 63ab732a783fc4a3cc4163bb03de3ac26797f399..f0016bb5626201912dcc63d1738c230641c35f3c 100644 (file)
@@ -844,7 +844,7 @@ class TestCinderRtstoolCmd(test.TestCase):
         target_iqn = mock.MagicMock()
         target_iqn.tpgs.return_value = \
             [{'node_acls': mock.sentinel.initiator_iqn}]
-        acl = {'node_wwn': mock.sentinel.initiator_iqn}
+        acl = mock.MagicMock(node_wwn=mock.sentinel.initiator_iqn)
         tpg = mock.MagicMock(node_acls=[acl])
         tpgs = mock.MagicMock()
         tpgs.next.return_value = tpg