From 9d4e67e741f13b4b93620fbb972886e1dc975fee Mon Sep 17 00:00:00 2001 From: Peter Portante Date: Mon, 15 Jul 2013 16:52:46 -0400 Subject: Updates to support Havana interim version 1.9.1. The code changes are basically: * Apply refactoring in the DiskFile class to use the new DiskWriter abstraction * Move and rename our diskfile module to match upstream * ThreadPools allow us to remove the tpool usage around fsync * Update the Ring subclass to support the get_part() method * Update to use the 1.9.1 proxy server unit tests * Move the DebugLogger class to test.unit * Rebuild the Rings to use the new layout * Remove backup ring builder files * Update spec files to 1.9.1, and tox to use swift 1.9.1 * Updated version to 1.9.0-0 Change-Id: Ica12cac8b351627d67500723f1dbd8a54d45f7c8 Signed-off-by: Peter Portante Signed-off-by: Luis Pabon Reviewed-on: http://review.gluster.org/5331 --- gluster/swift/common/ring.py | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) (limited to 'gluster/swift/common/ring.py') diff --git a/gluster/swift/common/ring.py b/gluster/swift/common/ring.py index f4df8da..f8c268a 100644 --- a/gluster/swift/common/ring.py +++ b/gluster/swift/common/ring.py @@ -91,6 +91,29 @@ class Ring(ring.Ring): """ return self._get_part_nodes(part) + def get_part(self, account, container=None, obj=None): + """ + Get the partition for an account/container/object. + + :param account: account name + :param container: container name + :param obj: object name + :returns: the partition number + """ + if account.startswith(reseller_prefix): + account = account.replace(reseller_prefix, '', 1) + + # Save the account name in the table + # This makes part be the index of the location of the account + # in the list + try: + part = self.account_list.index(account) + except ValueError: + self.account_list.append(account) + part = self.account_list.index(account) + + return part + def get_nodes(self, account, container=None, obj=None): """ Get the partition and nodes for an account/container/object. @@ -117,18 +140,7 @@ class Ring(ring.Ring): hardware description ====== =============================================================== """ - if account.startswith(reseller_prefix): - account = account.replace(reseller_prefix, '', 1) - - # Save the account name in the table - # This makes part be the index of the location of the account - # in the list - try: - part = self.account_list.index(account) - except ValueError: - self.account_list.append(account) - part = self.account_list.index(account) - + part = self.get_part(account, container, obj) return part, self._get_part_nodes(part) def get_more_nodes(self, part): @@ -141,4 +153,4 @@ class Ring(ring.Ring): See :func:`get_nodes` for a description of the node dicts. Should never be called in the swift UFO environment, so yield nothing """ - yield self.false_node + return [] -- cgit