Add config support for ZooKeeper servers
Allows defining a cluster of ZooKeeper servers within the nodepool configuration file. Validation of the new config values is supported, and the new values are documented. Change-Id: I24401d08135a071dee1d00711fdd82c1d728b31a
This commit is contained in:
parent
3c8bfe5e82
commit
9126b47650
@ -152,6 +152,21 @@ Example::
|
|||||||
|
|
||||||
The ``port`` key is optional (default: 4730).
|
The ``port`` key is optional (default: 4730).
|
||||||
|
|
||||||
|
zookeeper-servers
|
||||||
|
-----------------
|
||||||
|
Lists the ZooKeeper servers uses for coordinating information between
|
||||||
|
nodepool workers. Example::
|
||||||
|
|
||||||
|
zookeeper-servers:
|
||||||
|
- host: zk1.example.com
|
||||||
|
port: 2181
|
||||||
|
chroot: /nodepool
|
||||||
|
|
||||||
|
The ``port`` key is optional (default: 2181).
|
||||||
|
|
||||||
|
The ``chroot`` key, used for interpreting ZooKeeper paths relative to
|
||||||
|
the supplied root path, is also optional and has no default.
|
||||||
|
|
||||||
.. _labels:
|
.. _labels:
|
||||||
|
|
||||||
labels
|
labels
|
||||||
|
@ -122,6 +122,11 @@ class ConfigValidator:
|
|||||||
'host': str,
|
'host': str,
|
||||||
'port': int,
|
'port': int,
|
||||||
}],
|
}],
|
||||||
|
'zookeeper-servers': [{
|
||||||
|
'host': str,
|
||||||
|
'port': int,
|
||||||
|
'chroot': str,
|
||||||
|
}],
|
||||||
'cron': cron,
|
'cron': cron,
|
||||||
'providers': [providers],
|
'providers': [providers],
|
||||||
'labels': [labels],
|
'labels': [labels],
|
||||||
|
@ -102,6 +102,10 @@ class GearmanServer(ConfigValue):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class ZooKeeperServer(ConfigValue):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class DiskImage(ConfigValue):
|
class DiskImage(ConfigValue):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -128,6 +132,7 @@ def loadConfig(config_path):
|
|||||||
newconfig.jenkins_managers = {}
|
newconfig.jenkins_managers = {}
|
||||||
newconfig.zmq_publishers = {}
|
newconfig.zmq_publishers = {}
|
||||||
newconfig.gearman_servers = {}
|
newconfig.gearman_servers = {}
|
||||||
|
newconfig.zookeeper_servers = {}
|
||||||
newconfig.diskimages = {}
|
newconfig.diskimages = {}
|
||||||
newconfig.crons = {}
|
newconfig.crons = {}
|
||||||
|
|
||||||
@ -155,6 +160,14 @@ def loadConfig(config_path):
|
|||||||
g.name = g.host + '_' + str(g.port)
|
g.name = g.host + '_' + str(g.port)
|
||||||
newconfig.gearman_servers[g.name] = g
|
newconfig.gearman_servers[g.name] = g
|
||||||
|
|
||||||
|
for server in config.get('zookeeper-servers', []):
|
||||||
|
z = ZooKeeperServer()
|
||||||
|
z.host = server['host']
|
||||||
|
z.port = server.get('port', 2181)
|
||||||
|
z.chroot = server.get('chroot', '')
|
||||||
|
z.name = z.host + '_' + str(z.port)
|
||||||
|
newconfig.zookeeper_servers[z.name] = z
|
||||||
|
|
||||||
for provider in config.get('providers', []):
|
for provider in config.get('providers', []):
|
||||||
p = Provider()
|
p = Provider()
|
||||||
p.name = provider['name']
|
p.name = provider['name']
|
||||||
|
@ -19,6 +19,11 @@ zmq-publishers:
|
|||||||
gearman-servers:
|
gearman-servers:
|
||||||
- host: zuul.openstack.org
|
- host: zuul.openstack.org
|
||||||
|
|
||||||
|
zookeeper-servers:
|
||||||
|
- host: zk1.openstack.org
|
||||||
|
port: 2181
|
||||||
|
chroot: /test
|
||||||
|
|
||||||
labels:
|
labels:
|
||||||
- name: devstack-precise
|
- name: devstack-precise
|
||||||
image: devstack-precise
|
image: devstack-precise
|
||||||
|
@ -19,6 +19,9 @@ zmq-publishers:
|
|||||||
gearman-servers:
|
gearman-servers:
|
||||||
- host: zuul.openstack.org
|
- host: zuul.openstack.org
|
||||||
|
|
||||||
|
zookeeper-servers:
|
||||||
|
- host: zk1.openstack.org
|
||||||
|
|
||||||
labels:
|
labels:
|
||||||
- name: devstack-precise
|
- name: devstack-precise
|
||||||
image: devstack-precise
|
image: devstack-precise
|
||||||
|
@ -147,7 +147,3 @@ class TestNodepoolBuilder(tests.DBTestCase):
|
|||||||
# We failed to upload first_fail_id and have
|
# We failed to upload first_fail_id and have
|
||||||
# moved onto another upload that will fail.
|
# moved onto another upload that will fail.
|
||||||
break
|
break
|
||||||
|
|
||||||
class TestZookeeper(tests.ZKTestCase):
|
|
||||||
def test_zk(self):
|
|
||||||
self.zkclient.get('/')
|
|
||||||
|
Loading…
Reference in New Issue
Block a user