Add support for health monitors.
Adds new options and updates documentation. Change-Id: I5d240d8633ddd0be448f92550e6f8031a46f8d56
This commit is contained in:
172
doc/command.rst
172
doc/command.rst
@@ -71,6 +71,13 @@ Global Options
|
||||
Client Commands
|
||||
---------------
|
||||
|
||||
.. program:: libra_client algorithms
|
||||
|
||||
algorithms
|
||||
^^^^^^^^^^
|
||||
|
||||
Gets a list of supported algorithms
|
||||
|
||||
.. program:: libra_client create
|
||||
|
||||
create
|
||||
@@ -98,6 +105,62 @@ Create a load balancer
|
||||
|
||||
The virtual IP ID of an existing load balancer to attach to
|
||||
|
||||
.. program:: libra_client delete
|
||||
|
||||
delete
|
||||
^^^^^^
|
||||
|
||||
Delete a load balancer
|
||||
|
||||
.. option:: --id <id>
|
||||
|
||||
The ID of the load balancer
|
||||
|
||||
.. program:: libra_client limits
|
||||
|
||||
limits
|
||||
^^^^^^
|
||||
|
||||
Show the API limits for the user
|
||||
|
||||
.. program:: libra_client list
|
||||
|
||||
list
|
||||
^^^^
|
||||
|
||||
List all load balancers
|
||||
|
||||
.. option:: --deleted
|
||||
|
||||
Show deleted load balancers
|
||||
|
||||
.. program:: libra_client logs
|
||||
|
||||
logs
|
||||
^^^^
|
||||
|
||||
Send a snapshot of logs to an object store
|
||||
|
||||
.. option:: --id <id>
|
||||
|
||||
The ID of the load balancer
|
||||
|
||||
.. option:: --storage <store>
|
||||
|
||||
Storage type
|
||||
|
||||
.. option:: --endpoint <endpoint>
|
||||
|
||||
Object store endpoint to use
|
||||
|
||||
.. option:: --basepath <basepath>
|
||||
|
||||
Object store based directory
|
||||
|
||||
.. option:: --token <token>
|
||||
|
||||
Object store authentication token
|
||||
|
||||
.. program:: libra_client modify
|
||||
|
||||
modify
|
||||
@@ -117,71 +180,54 @@ Update a load balancer's configuration
|
||||
|
||||
A new algorithm for the load balancer
|
||||
|
||||
.. program:: libra_client list
|
||||
.. program:: libra_client monitor-list
|
||||
|
||||
list
|
||||
^^^^
|
||||
monitor-list
|
||||
^^^^^^^^^^^^
|
||||
|
||||
List all load balancers
|
||||
|
||||
.. option:: --deleted
|
||||
|
||||
Show deleted load balancers
|
||||
|
||||
.. program:: libra_client limits
|
||||
|
||||
limits
|
||||
^^^^^^
|
||||
|
||||
Show the API limits for the user
|
||||
|
||||
.. program:: libra_client algorithms
|
||||
|
||||
algorithms
|
||||
^^^^^^^^^^
|
||||
|
||||
Gets a list of supported algorithms
|
||||
|
||||
.. program:: libra_client protocols
|
||||
|
||||
protocols
|
||||
^^^^^^^^^
|
||||
|
||||
Gets a list of supported protocols
|
||||
|
||||
.. program:: libra_client status
|
||||
|
||||
status
|
||||
^^^^^^
|
||||
|
||||
Get the status of a single load balancer
|
||||
List the health monitor for a load balancer
|
||||
|
||||
.. option:: --id <id>
|
||||
|
||||
The ID of the load balancer
|
||||
|
||||
.. program:: libra_client delete
|
||||
.. program:: libra_client monitor-delete
|
||||
|
||||
delete
|
||||
^^^^^^
|
||||
monitor-delete
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
Delete a load balancer
|
||||
Delete the health monitor for a load balancer
|
||||
|
||||
.. option:: --id <id>
|
||||
|
||||
The ID of the load balancer
|
||||
|
||||
.. program:: libra_client node-list
|
||||
.. program:: libra_client monitor-modify
|
||||
|
||||
node-list
|
||||
^^^^^^^^^
|
||||
monitor-modify
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
List the nodes in a load balancer
|
||||
Modify the health monitor for a load balancer
|
||||
|
||||
.. option:: --id <id>
|
||||
|
||||
The ID of the load balancer
|
||||
|
||||
.. program:: libra_client node-add
|
||||
|
||||
node-add
|
||||
^^^^^^^^
|
||||
|
||||
Add a node to a load balancer
|
||||
|
||||
.. option:: --id <id>
|
||||
|
||||
The ID of the load balancer
|
||||
|
||||
.. option:: --node <ip:port>
|
||||
|
||||
The node address in ip:port format (can be used multiple times to add multiple nodes)
|
||||
|
||||
.. program:: libra_client node-delete
|
||||
|
||||
node-delete
|
||||
@@ -197,21 +243,17 @@ Delete a node from the load balancer
|
||||
|
||||
The ID of the node to be removed
|
||||
|
||||
.. program:: libra_client node-add
|
||||
.. program:: libra_client node-list
|
||||
|
||||
node-add
|
||||
^^^^^^^^
|
||||
node-list
|
||||
^^^^^^^^^
|
||||
|
||||
Add a node to a load balancer
|
||||
List the nodes in a load balancer
|
||||
|
||||
.. option:: --id <id>
|
||||
|
||||
The ID of the load balancer
|
||||
|
||||
.. option:: --node <ip:port>
|
||||
|
||||
The node address in ip:port format (can be used multiple times to add multiple nodes)
|
||||
|
||||
.. program:: libra_client node-modify
|
||||
|
||||
node-modify
|
||||
@@ -245,3 +287,29 @@ Get the status of a node in a load balancer
|
||||
.. option:: --nodeid <nodeid>
|
||||
|
||||
The ID of the node in the load balancer
|
||||
.. program:: libra_client protocols
|
||||
|
||||
protocols
|
||||
^^^^^^^^^
|
||||
|
||||
Gets a list of supported protocols
|
||||
|
||||
.. program:: libra_client status
|
||||
|
||||
status
|
||||
^^^^^^
|
||||
|
||||
Get the status of a single load balancer
|
||||
|
||||
.. option:: --id <id>
|
||||
|
||||
The ID of the load balancer
|
||||
|
||||
virtualips
|
||||
^^^^^^^^^^
|
||||
|
||||
Get a list of virtual IPs
|
||||
|
||||
.. option:: --id <id>
|
||||
|
||||
The ID of the load balancer
|
||||
|
@@ -136,6 +136,34 @@ class ClientOptions(object):
|
||||
help='new algorithm for the load balancer',
|
||||
choices=['LEAST_CONNECTIONS', 'ROUND_ROBIN'])
|
||||
|
||||
sp = subparsers.add_parser(
|
||||
'monitor-list',
|
||||
help='list health monitor information'
|
||||
)
|
||||
sp.add_argument('--id', required=True, help='load balancer ID')
|
||||
|
||||
sp = subparsers.add_parser(
|
||||
'monitor-delete',
|
||||
help='delete a health monitor'
|
||||
)
|
||||
sp.add_argument('--id', required=True, help='load balancer ID')
|
||||
|
||||
sp = subparsers.add_parser(
|
||||
'monitor-modify',
|
||||
help='modify a health monitor'
|
||||
)
|
||||
sp.add_argument('--id', required=True, help='load balancer ID')
|
||||
sp.add_argument('--type', choices=['CONNECT', 'HTTP'],
|
||||
default='CONNECT', help='health monitor type')
|
||||
sp.add_argument('--delay', type=int, default=30, metavar='SECONDS',
|
||||
help='time between health monitor calls')
|
||||
sp.add_argument('--timeout', type=int, default=30, metavar='SECONDS',
|
||||
help='time to wait before monitor times out')
|
||||
sp.add_argument('--attempts', type=int, default=2, metavar='COUNT',
|
||||
help='connection attempts before marking node as bad')
|
||||
sp.add_argument('--path',
|
||||
help='URI path for health check')
|
||||
|
||||
sp = subparsers.add_parser(
|
||||
'node-add', help='add node to a load balancer'
|
||||
)
|
||||
|
@@ -211,6 +211,29 @@ class LibraAPI(object):
|
||||
resp, body = self._post('/loadbalancers/{0}/logs'.format(args.id),
|
||||
body=data)
|
||||
|
||||
def monitor_delete_lb(self, args):
|
||||
resp, body = self._delete('/loadbalancers/{0}/healthmonitor'
|
||||
.format(args.id))
|
||||
|
||||
def monitor_list_lb(self, args):
|
||||
resp, body = self._get('/loadbalancers/{0}/healthmonitor'
|
||||
.format(args.id))
|
||||
column_names = ['Type', 'Delay', 'Timeout', 'Attempts', 'Path']
|
||||
columns = ['type', 'delay', 'timeout', 'attemptsBeforeDeactivation',
|
||||
'path']
|
||||
self._render_dict(column_names, columns, body)
|
||||
|
||||
def monitor_modify_lb(self, args):
|
||||
data = {}
|
||||
data['type'] = args.type
|
||||
data['delay'] = args.delay
|
||||
data['timeout'] = args.timeout
|
||||
data['attemptsBeforeDeactivation'] = args.attempts
|
||||
if args.type.upper() != "CONNECT":
|
||||
data['path'] = args.path
|
||||
resp, body = self._put('/loadbalancers/{0}/healthmonitor'
|
||||
.format(args.id), body=data)
|
||||
|
||||
def _render_list(self, column_names, columns, data):
|
||||
table = prettytable.PrettyTable(column_names)
|
||||
for item in data:
|
||||
|
Reference in New Issue
Block a user