From: Andy Grover Date: Thu, 9 Oct 2014 23:08:13 +0000 (-0700) Subject: Use object.property instead of object.dump()['property'] X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=13d524389ef727a2ce1d5a9e640062a89bdb6e54;p=openstack-build%2Fcinder-build.git Use object.property instead of object.dump()['property'] Less verbose and requires less work for the library. Change-Id: Ied2196b548c91324fdfce39ec4f8801e59da4f6c --- diff --git a/bin/cinder-rtstool b/bin/cinder-rtstool index 4eba658ac..6d6b7f967 100755 --- a/bin/cinder-rtstool +++ b/bin/cinder-rtstool @@ -42,7 +42,7 @@ def create(backing_device, name, userid, password, initiator_iqns=None): # Look to see if BlockStorageObject already exists for x in rtsroot.storage_objects: - if x.dump()['name'] == name: + if x.name == name: # Already exists, use this one return @@ -90,7 +90,7 @@ def _lookup_target(target_iqn, initiator_iqn): # Look for the target for t in rtsroot.targets: - if t.dump()['wwn'] == target_iqn: + if t.wwn == target_iqn: return t raise RtstoolError(_('Could not find target %s') % target_iqn) @@ -98,7 +98,7 @@ def _lookup_target(target_iqn, initiator_iqn): def add_initiator(target_iqn, initiator_iqn, userid, password): target = _lookup_target(target_iqn, initiator_iqn) tpg = target.tpgs.next() # get the first one - for acl in tpg.dump()['node_acls']: + for acl in tpg.node_acls: # See if this ACL configuration already exists if acl['node_wwn'] == initiator_iqn: # No further action required @@ -125,18 +125,18 @@ def delete_initiator(target_iqn, initiator_iqn): def get_targets(): rtsroot = rtslib.root.RTSRoot() for x in rtsroot.targets: - print(x.dump()['wwn']) + print(x.wwn) def delete(iqn): rtsroot = rtslib.root.RTSRoot() for x in rtsroot.targets: - if x.dump()['wwn'] == iqn: + if x.wwn == iqn: x.delete() break for x in rtsroot.storage_objects: - if x.dump()['name'] == iqn: + if x.name == iqn: x.delete() break