Add ha interface

This commit is contained in:
Liam Young 2016-04-25 11:52:14 -05:00
parent c8b72613ca
commit 23eb7e6fb2
7 changed files with 43 additions and 4 deletions

2
.gitignore vendored
View File

@ -2,3 +2,5 @@ build
layers
.tox
interfaces
builds
deps

View File

@ -1,8 +1,9 @@
#!/usr/bin/make
LAYER_PATH := layers
INTERFACE_PATH := interfaces
clean:
rm -Rf build
generate: clean
LAYER_PATH=$(LAYER_PATH) tox -e generate
LAYER_PATH=$(LAYER_PATH) INTERFACE_PATH=$(INTERFACE_PATH) tox -e generate

View File

@ -23,3 +23,23 @@ options:
default: 'email@example.com'
type: string
description: Email address of the person responsible for the domain.
vip:
type: string
default:
description: |
Virtual IP(s) to use to front API services in HA configuration.
If multiple networks are being used, a VIP should be provided for each
network, separated by spaces.
vip_iface:
type: string
default: eth0
description: |
Default network interface to use for HA vip when it cannot be
automatically determined.
vip_cidr:
type: int
default: 24
description: |
Default CIDR netmask to use for HA vip when it cannot be automatically
determined.

View File

@ -1 +1 @@
includes: ['layer:openstack-api', 'interface:bind-rndc']
includes: ['layer:openstack-api', 'interface:bind-rndc', 'interface:hacluster']

View File

@ -21,3 +21,6 @@ provides:
requires:
dns-backend:
interface: bind-rndc
ha:
interface: hacluster
scope: container

View File

@ -1,10 +1,14 @@
from charmhelpers.core.hookenv import unit_private_ip
from charmhelpers.core.hookenv import unit_private_ip, config
from charms.reactive import (
hook,
when,
)
from charm.openstack.designate import DesignateCharmFactory
import ipaddress
from relations.hacluster.common import CRM
from relations.hacluster.common import ResourceDescriptor
from charm.openstack.charm import VirtualIP
@hook('install')
def install_packages():
@ -51,3 +55,12 @@ def render_stuff(amqp_interface, identity_interface, db_interface,
charm.db_sync()
charm.create_domains()
charm.render_full_config()
@when('ha.connected')
def cluster_connected(hacluster):
user_config = config()
resources = CRM()
resources.add(VirtualIP(user_config['vip']))
hacluster.bind_on(iface=user_config['vip_iface'], mcastport=4440)
hacluster.manage_resources(resources)

View File

@ -18,7 +18,7 @@ deps =
[testenv:generate]
basepython = python2.7
commands =
charm generate --log-level DEBUG -o {toxinidir}/build charm
charm build --log-level DEBUG -o {toxinidir}/build charm
[testenv:venv]
commands = {posargs}