Remove useless get_one() method in SG API

Removes the servicegroup API had a get_one() method that was not used.

Related blueprint: servicegroup-api-is-up-host-topic

Change-Id: Ic2ee3f5cf31d0deab744d8bf23e2092c51ab1f36
This commit is contained in:
Jay Pipes 2015-01-25 19:18:23 -08:00 committed by EdLeafe
parent 7c38763761
commit cec4198f0a
2 changed files with 0 additions and 22 deletions

View File

@ -95,10 +95,3 @@ class API(object):
LOG.debug('Returns ALL members of the [%s] '
'ServiceGroup', group_id)
return self._driver.get_all(group_id)
def get_one(self, group_id):
"""Returns one member of the given group. The strategy to select
the member is decided by the driver (e.g. random or round-robin).
"""
LOG.debug('Returns one member of the [%s] group', group_id)
return self._driver.get_one(group_id)

View File

@ -11,8 +11,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import random
class Driver(object):
"""Base class for all ServiceGroup drivers."""
@ -33,16 +31,3 @@ class Driver(object):
def get_all(self, group_id):
"""Returns ALL members of the given group."""
raise NotImplementedError()
def get_one(self, group_id):
"""The default behavior of get_one is to randomly pick one from
the result of get_all(). This is likely to be overridden in the
actual driver implementation.
"""
members = self.get_all(group_id)
if members is None:
return None
length = len(members)
if length == 0:
return None
return random.choice(members)