[API] Support new GALERA protocol in the API

When a Galera load balancer is requested, we validate the
node definitions in the API rather than rely on the worker
for validation. Make sure that number of primary nodes is
one, no more and no less.

When using POST to add nodes, we check that a primary node
is not being added. We assume a primary is already defined
since the LB cannot exist without a primary.

DELETE is checked to make sure that the primary node is not
being removed.

Set the default port for GALERA protocol to 3306.

Change-Id: I8cf1489e1cae6c790bc05c5573dee959f93d20c9
This commit is contained in:
David Shrewsbury
2013-09-25 21:24:55 +00:00
parent 684cb24611
commit 627d89b5ff
7 changed files with 88 additions and 8 deletions

View File

@@ -117,7 +117,7 @@ class Node(DeclarativeBase):
__tablename__ = 'nodes'
#column definitions
address = Column(u'address', VARCHAR(length=128), nullable=False)
enabled = Column(u'enabled', Integer(), nullable=False)
enabled = Column(u'enabled', INTEGER(), nullable=False)
id = Column(u'id', BIGINT(), primary_key=True, nullable=False)
lbid = Column(
u'lbid', BIGINT(), ForeignKey('loadbalancers.id'), nullable=False
@@ -125,6 +125,7 @@ class Node(DeclarativeBase):
port = Column(u'port', INTEGER(), nullable=False)
status = Column(u'status', VARCHAR(length=128), nullable=False)
weight = Column(u'weight', INTEGER(), nullable=False)
backup = Column(u'backup', INTEGER(), nullable=False, default=0)
class HealthMonitor(DeclarativeBase):