From: Tomoki Sekiyama Date: Wed, 7 Jan 2015 22:33:51 +0000 (-0500) Subject: cinder-rtstool: should use acl.node_wwn X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=65d9c20b453b7128b09c9069a69d2d520626f905;p=openstack-build%2Fcinder-build.git cinder-rtstool: should use acl.node_wwn 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 --- diff --git a/cinder/cmd/rtstool.py b/cinder/cmd/rtstool.py index 76c4d11b3..afbf8c695 100644 --- a/cinder/cmd/rtstool.py +++ b/cinder/cmd/rtstool.py @@ -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 diff --git a/cinder/tests/test_cmd.py b/cinder/tests/test_cmd.py index 63ab732a7..f0016bb56 100644 --- a/cinder/tests/test_cmd.py +++ b/cinder/tests/test_cmd.py @@ -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