Working Hot Stanby HA on any driver of oslo.messaging

Current Congress supports Hot Stanby HA in old/new architecture.
In new architecture, if a driver of oslo.messaging shares its
messaging topic namespace among multi DseNode, RPC from each
DseNode will be mixed up and doesn't work correctly.

This patch separates each the topic namespace by adding a topic
partition DseNode uses.

Closes-Bugs: 1585975
Change-Id: I6763248faf0f81d53f2970274903b9c035a51eed
This commit is contained in:
Masahito Muroi 2016-05-26 19:18:41 +09:00
parent 7e95abf2a7
commit 0fd23cb0f9
3 changed files with 11 additions and 3 deletions

View File

@ -91,7 +91,11 @@ class APIServer(service.ServiceBase):
messaging_config = helper.generate_messaging_config()
messaging_config.rpc_response_timeout = 10
self.node = dse_node.DseNode(messaging_config, self.name, [])
# TODO(masa): To support Active-Active HA with DseNode on any
# driver of oslo.messaging, make sure to use same partition_id
# among multi DseNodes sharing same message topic namespace.
self.node = dse_node.DseNode(messaging_config, self.name, [],
partition_id=self.name)
def start(self, key=None, backlog=128):
"""Run a WSGI server with the given application."""

View File

@ -281,7 +281,9 @@ def create2(node=None):
bus = node
else:
messaging_config = helper.generate_messaging_config()
bus = dse_node.DseNode(messaging_config, "root", [])
bus_name = "root"
bus = dse_node.DseNode(messaging_config, bus_name, [],
partition_id=bus_name)
# create services
services = {}

View File

@ -14,6 +14,7 @@
# under the License.
import os
import re
import socket
import subprocess
import tempfile
@ -78,7 +79,8 @@ class TestHA(manager_congress.ScenarioPolicyBase):
'datasource_sync_period = 5\n' + conf[index:])
sindex = conf.find('signing_dir')
conf = conf[:sindex] + '#' + conf[sindex:]
conf = re.sub(r'node_id[ ]*=[ ]*[a-zA-Z_-]+[ ]*',
'node_id = replica-node', conf)
f.write(conf)
f.close()