From 65d9c20b453b7128b09c9069a69d2d520626f905 Mon Sep 17 00:00:00 2001 From: Tomoki Sekiyama Date: Wed, 7 Jan 2015 17:33:51 -0500 Subject: [PATCH] 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 --- cinder/cmd/rtstool.py | 2 +- cinder/tests/test_cmd.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cinder/cmd/rtstool.py b/cinder/cmd/rtstool.py index 76c4d11b376..afbf8c69512 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 63ab732a783..f0016bb5626 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