Fix debugging and Galera support

Fix debugging for newer python-novaclient versions

Also add support for the Galera protocol option

Change-Id: I84f65d659e9699f26566745b18d868280dc15918
This commit is contained in:
Andrew Hutchings
2013-09-26 14:55:25 +01:00
parent cf7e39953c
commit 9915ff82e0
3 changed files with 9 additions and 2 deletions

View File

@@ -95,7 +95,9 @@ Create a load balancer
.. option:: --protocol <protocol>
The protocol type for the load balancer (HTTP or TCP)
The protocol type for the load balancer (HTTP, TCP or GALERA).
The Galera option adds support for deadlock avoidance in Galera clusters,
see `Serveral Nine's Blog <http://www.severalnines.com/blog/avoiding-deadlocks-galera-set-haproxy-single-node-writes-and-multi-node-reads>`_ on this.
.. option:: --node <ip:port>

View File

@@ -90,7 +90,7 @@ class ClientOptions(object):
help='port for the load balancer, 80 is default')
sp.add_argument('--protocol',
help='protocol for the load balancer, HTTP is default',
choices=['HTTP', 'TCP'])
choices=['HTTP', 'TCP', 'GALERA'])
sp.add_argument('--algorithm',
help='algorithm for the load balancer,'
' ROUND_ROBIN is default',

View File

@@ -15,6 +15,7 @@
import prettytable
import novaclient
import socket
import logging
from novaclient import client
@@ -59,6 +60,10 @@ novaclient.exceptions.from_response = from_response
class LibraAPI(object):
def __init__(self, args):
if args.debug:
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
self.nova = client.HTTPClient(
args.os_username,
args.os_password,