[james-page,r=gnuoy] Add fallback configuration options for vip cidr and iface for non-standard deployments
This commit is contained in:
commit
c972c6216b
12
config.yaml
12
config.yaml
@ -138,6 +138,18 @@ options:
|
||||
.
|
||||
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.
|
||||
ha-bindiface:
|
||||
type: string
|
||||
default: eth0
|
||||
|
@ -294,7 +294,11 @@ def ha_joined():
|
||||
res_ks_vip = 'ocf:heartbeat:IPaddr2'
|
||||
vip_params = 'ip'
|
||||
|
||||
iface = get_iface_for_address(vip)
|
||||
iface = (get_iface_for_address(vip) or
|
||||
config('vip_iface'))
|
||||
netmask = (get_netmask_for_address(vip) or
|
||||
config('vip_cidr'))
|
||||
|
||||
if iface is not None:
|
||||
vip_key = 'res_ks_{}_vip'.format(iface)
|
||||
resources[vip_key] = res_ks_vip
|
||||
@ -303,7 +307,7 @@ def ha_joined():
|
||||
' nic="{iface}"'.format(ip=vip_params,
|
||||
vip=vip,
|
||||
iface=iface,
|
||||
netmask=get_netmask_for_address(vip))
|
||||
netmask=netmask)
|
||||
)
|
||||
vip_group.append(vip_key)
|
||||
|
||||
|
@ -385,6 +385,31 @@ class KeystoneRelationTests(CharmTestCase):
|
||||
}
|
||||
self.relation_set.assert_called_with(**args)
|
||||
|
||||
def test_ha_joined_no_bound_ip(self):
|
||||
self.get_hacluster_config.return_value = {
|
||||
'vip': '10.10.10.10',
|
||||
'ha-bindiface': 'em0',
|
||||
'ha-mcastport': '8080'
|
||||
}
|
||||
self.test_config.set('vip_iface', 'eth120')
|
||||
self.test_config.set('vip_cidr', '21')
|
||||
self.get_iface_for_address.return_value = None
|
||||
self.get_netmask_for_address.return_value = None
|
||||
hooks.ha_joined()
|
||||
args = {
|
||||
'corosync_bindiface': 'em0',
|
||||
'corosync_mcastport': '8080',
|
||||
'init_services': {'res_ks_haproxy': 'haproxy'},
|
||||
'resources': {'res_ks_eth120_vip': 'ocf:heartbeat:IPaddr2',
|
||||
'res_ks_haproxy': 'lsb:haproxy'},
|
||||
'resource_params': {
|
||||
'res_ks_eth120_vip': 'params ip="10.10.10.10"'
|
||||
' cidr_netmask="21" nic="eth120"',
|
||||
'res_ks_haproxy': 'op monitor interval="5s"'},
|
||||
'clones': {'cl_ks_haproxy': 'res_ks_haproxy'}
|
||||
}
|
||||
self.relation_set.assert_called_with(**args)
|
||||
|
||||
def test_ha_joined_with_ipv6(self):
|
||||
self.test_config.set('prefer-ipv6', True)
|
||||
self.get_hacluster_config.return_value = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user