Speed up swift-get-nodes by 2x.

It was loading the ring off disk once to print the primary nodes, and
then loading the whole thing off disk again to print the handoff
nodes. Changed it to only load the ring off disk once.
Change-Id: I6f4cd0af9762e1e69660c3eb20586590b5339e5f
This commit is contained in:
Samuel Merritt
2012年05月10日 00:07:57 -07:00
parent 47f0dbb125
commit 8e6f099daa

View File

@@ -42,27 +42,30 @@ obj = None
if len(sys.argv) > 4:
# Acount, Container and Object
ring, account, container, obj = sys.argv[1:5]
ring_file, account, container, obj = sys.argv[1:5]
ring = Ring(ring_file)
hash_str = hash_path(account, container, obj)
part, nodes = Ring(ring).get_nodes(account, container, obj)
part, nodes = ring.get_nodes(account, container, obj)
target = "%s/%s/%s" % (account, container, obj)
loc = 'objects'
elif len(sys.argv) > 3:
# Account, Container
ring, account, container = sys.argv[1:4]
ring_file, account, container = sys.argv[1:4]
ring = Ring(ring_file)
hash_str = hash_path(account, container)
part, nodes = Ring(ring).get_nodes(account, container)
part, nodes = ring.get_nodes(account, container)
target = "%s/%s" % (account, container)
loc = 'containers'
elif len(sys.argv) > 2:
# Account
ring, account = sys.argv[1:3]
ring_file, account = sys.argv[1:3]
ring = Ring(ring_file)
hash_str = hash_path(account)
part, nodes = Ring(ring).get_nodes(account)
part, nodes = ring.get_nodes(account)
target = "%s" % (account)
loc = 'accounts'
more_nodes = list(Ring(ring).get_more_nodes(part))
more_nodes = list(ring.get_more_nodes(part))
print '\nAccount \t%s' % account
print 'Container\t%s' % container
Reference in New Issue
openstack/swift
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.

The note is not visible to the blocked user.