Merge "Byte encoding of member Id" into stable/stein
This commit is contained in:
commit
43e3b39a64
|
@ -18,6 +18,7 @@ import struct
|
||||||
|
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
|
from oslo_utils import encodeutils
|
||||||
from oslo_utils import uuidutils
|
from oslo_utils import uuidutils
|
||||||
import six
|
import six
|
||||||
import tenacity
|
import tenacity
|
||||||
|
@ -114,7 +115,8 @@ class PartitionCoordinator(object):
|
||||||
self.backend_url = self.conf.coordination.backend_url
|
self.backend_url = self.conf.coordination.backend_url
|
||||||
self._coordinator = None
|
self._coordinator = None
|
||||||
self._groups = set()
|
self._groups = set()
|
||||||
self._my_id = my_id or uuidutils.generate_uuid()
|
self._my_id = my_id or \
|
||||||
|
encodeutils.safe_encode(uuidutils.generate_uuid())
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
if self.backend_url:
|
if self.backend_url:
|
||||||
|
|
|
@ -193,6 +193,11 @@ class TestPartitioning(base.BaseTestCase):
|
||||||
self.assertEqual(['group1', 'group2'],
|
self.assertEqual(['group1', 'group2'],
|
||||||
sorted(self.shared_storage.keys()))
|
sorted(self.shared_storage.keys()))
|
||||||
|
|
||||||
|
def test_member_id(self):
|
||||||
|
agent = 'agent'.encode('ascii')
|
||||||
|
coord = self._get_new_started_coordinator({}, agent)
|
||||||
|
self.assertEqual(agent, coord._my_id)
|
||||||
|
|
||||||
def test_partitioning(self):
|
def test_partitioning(self):
|
||||||
all_resources = ['resource_%s' % i for i in range(1000)]
|
all_resources = ['resource_%s' % i for i in range(1000)]
|
||||||
agents = ['agent_%s' % i for i in range(10)]
|
agents = ['agent_%s' % i for i in range(10)]
|
||||||
|
|
Loading…
Reference in New Issue