summaryrefslogtreecommitdiffstats
path: root/ufo/gluster/swift/common/ring.py
diff options
context:
space:
mode:
authorPeter Portante <peter.portante@redhat.com>2013-05-08 21:51:58 -0400
committerAnand Avati <avati@redhat.com>2013-05-10 11:03:55 -0700
commit40d026e10013f533c4fee33b87dabc4ca11c94b3 (patch)
treeaa6315c23a49288b72424f58a71c3f87d8aca7ff /ufo/gluster/swift/common/ring.py
parentfef1270fc2d665c67084c4ce06f60fc8faed4d52 (diff)
object-storage: final removal of ufo code
See https://git.gluster.org/gluster-swift.git for the new location of the Gluster-Swift code. With this patch, no OpenStack Swift related RPMs are constructed. This patch also removes the unused code that references the user.ufo-test xattr key in the DHT translator. Change-Id: I2da32642cbd777737a41c5f9f6d33f059c85a2c1 BUG: 961902 (https://bugzilla.redhat.com/show_bug.cgi?id=961902) Signed-off-by: Peter Portante <peter.portante@redhat.com> Reviewed-on: http://review.gluster.org/4970 Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Reviewed-by: Luis Pabon <lpabon@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'ufo/gluster/swift/common/ring.py')
-rw-r--r--ufo/gluster/swift/common/ring.py111
1 files changed, 0 insertions, 111 deletions
diff --git a/ufo/gluster/swift/common/ring.py b/ufo/gluster/swift/common/ring.py
deleted file mode 100644
index 06aab8d3..00000000
--- a/ufo/gluster/swift/common/ring.py
+++ /dev/null
@@ -1,111 +0,0 @@
-# Copyright (c) 2013 Red Hat, Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-# implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-from ConfigParser import ConfigParser
-from swift.common.ring import ring
-from swift.common.utils import search_tree
-from gluster.swift.common.Glusterfs import SWIFT_DIR
-
-reseller_prefix = "AUTH_"
-conf_files = search_tree(SWIFT_DIR, "proxy-server*", 'conf')
-if conf_files:
- conf_file = conf_files[0]
-
-_conf = ConfigParser()
-if conf_files and _conf.read(conf_file):
- if _conf.defaults().get("reseller_prefix", None):
- reseller_prefix = _conf.defaults().get("reseller_prefix")
- else:
- for key, value in _conf._sections.items():
- if value.get("reseller_prefix", None):
- reseller_prefix = value["reseller_prefix"]
- break
-
-if not reseller_prefix.endswith('_'):
- reseller_prefix = reseller_prefix + '_'
-
-class Ring(ring.Ring):
- def _get_part_nodes(self, part):
- seen_ids = set()
- nodes = [dev for dev in self._devs \
- if dev['device'] == self.acc_name \
- and not (dev['id'] in seen_ids \
- or seen_ids.add(dev['id']))]
- if not nodes:
- nodes = [self.false_node]
- return nodes
-
- def get_part_nodes(self, part):
- """
- Get the nodes that are responsible for the partition. If one
- node is responsible for more than one replica of the same
- partition, it will only appear in the output once.
-
- :param part: partition to get nodes for
- :returns: list of node dicts
-
- See :func:`get_nodes` for a description of the node dicts.
- """
- return self._get_part_nodes(part)
-
- def get_nodes(self, account, container=None, obj=None):
- """
- Get the partition and nodes for an account/container/object.
- If a node is responsible for more than one replica, it will
- only appear in the output once.
- :param account: account name
- :param container: container name
- :param obj: object name
- :returns: a tuple of (partition, list of node dicts)
-
- Each node dict will have at least the following keys:
- ====== ===============================================================
- id unique integer identifier amongst devices
- weight a float of the relative weight of this device as compared to
- others; this indicates how many partitions the builder will try
- to assign to this device
- zone integer indicating which zone the device is in; a given
- partition will not be assigned to multiple devices within the
- same zone
- ip the ip address of the device
- port the tcp port of the device
- device the device's name on disk (sdb1, for example)
- meta general use 'extra' field; for example: the online date, the
- hardware description
- ====== ===============================================================
- """
- self.false_node = {'zone': 1, 'weight': 100.0, 'ip': '127.0.0.1', 'id': 0, \
- 'meta': '', 'device': 'volume_not_in_ring', \
- 'port': 6012}
- if account.startswith(reseller_prefix):
- self.acc_name = account.replace(reseller_prefix, '', 1)
- else:
- self.acc_name = account
-
- part = 0
- return part, self._get_part_nodes(part)
-
-
- def get_more_nodes(self, part):
- """
- Generator to get extra nodes for a partition for hinted handoff.
-
- :param part: partition to get handoff nodes for
- :returns: generator of node dicts
-
- 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