def ha_joined(relation_id=None): extra_settings = { 'delete_resources': ['cl_nova_haproxy'] } settings = generate_ha_relation_data( 'neutron', extra_settings=extra_settings) relation_set(relation_id=relation_id, **settings)
def ha_joined(relation_id=None): ha_console_settings = {} ha_console_settings['delete_resources'] = [ 'vip_consoleauth', 'res_nova_consoleauth' ] settings = ch_ha_utils.generate_ha_relation_data( 'nova', extra_settings=ha_console_settings) hookenv.relation_set(relation_id=relation_id, **settings)
def ha_joined(relation_id=None): ha_console_settings = {} ha_console_settings['delete_resources'] = [ 'vip_consoleauth', 'res_nova_consoleauth' ] settings = ch_ha_utils.generate_ha_relation_data( 'nova', extra_settings=ha_console_settings) hookenv.relation_set(relation_id=relation_id, **settings)
def test_generate_ha_relation_data_dns_ha(self, assert_charm_supports_dns_ha): self.get_hacluster_config.return_value = { 'vip': '10.5.100.1 ffff::1 ffaa::1' } self.conf = { 'os-admin-hostname': 'test.admin.maas', 'os-internal-hostname': 'test.internal.maas', 'os-public-hostname': 'test.public.maas', 'dns-ha': True, } self.resolve_address.return_value = '10.0.0.1' assert_charm_supports_dns_ha.return_value = True expected = { 'groups': { 'grp_testservice_hostnames': ('res_testservice_admin_hostname' ' res_testservice_int_hostname' ' res_testservice_public_hostname') }, 'resource_params': { 'res_testservice_admin_hostname': ('params fqdn="test.admin.maas"' ' ip_address="10.0.0.1"'), 'res_testservice_int_hostname': ('params fqdn="test.internal.maas"' ' ip_address="10.0.0.1"'), 'res_testservice_public_hostname': ('params fqdn="test.public.maas"' ' ip_address="10.0.0.1"'), 'res_testservice_haproxy': 'op monitor interval="5s"', }, 'resources': { 'res_testservice_admin_hostname': 'ocf:maas:dns', 'res_testservice_int_hostname': 'ocf:maas:dns', 'res_testservice_public_hostname': 'ocf:maas:dns', 'res_testservice_haproxy': 'lsb:haproxy', }, 'clones': { 'cl_testservice_haproxy': 'res_testservice_haproxy', }, 'init_services': { 'res_testservice_haproxy': 'haproxy' }, } expected = { 'json_{}'.format(k): json.dumps(v, **ha.JSON_ENCODE_OPTIONS) for k, v in expected.items() if v } self.assertEqual(ha.generate_ha_relation_data('testservice'), expected)
def test_generate_ha_relation_data(self): self.get_hacluster_config.return_value = { 'vip': '10.5.100.1 ffff::1 ffaa::1' } expected = { 'groups': { 'grp_testservice_vips': ('res_testservice_eth1_vip ' 'res_testservice_eth1_vip_ipv6addr ' 'res_testservice_eth2_vip') }, 'resource_params': { 'res_testservice_eth1_vip': ('params ip="10.5.100.1"' ' cidr_netmask="255.255.255.0"' ' nic="eth1"'), 'res_testservice_eth1_vip_ipv6addr': ('params ipv6addr="ffff::1"' ' cidr_netmask="64"' ' nic="eth1"'), 'res_testservice_eth2_vip': ('params ipv6addr="ffaa::1"' ' cidr_netmask="32"' ' nic="eth2"'), 'res_testservice_haproxy': 'op monitor interval="5s"', }, 'resources': { 'res_testservice_eth1_vip': 'ocf:heartbeat:IPaddr2', 'res_testservice_eth1_vip_ipv6addr': 'ocf:heartbeat:IPv6addr', 'res_testservice_eth2_vip': 'ocf:heartbeat:IPv6addr', 'res_testservice_haproxy': 'lsb:haproxy', }, 'clones': { 'cl_testservice_haproxy': 'res_testservice_haproxy', }, 'init_services': { 'res_testservice_haproxy': 'haproxy' }, } expected = { 'json_{}'.format(k): json.dumps(v, **ha.JSON_ENCODE_OPTIONS) for k, v in expected.items() if v } self.assertEqual(ha.generate_ha_relation_data('testservice'), expected)
def ha_joined(relation_id=None): ceil_ha_settings = { 'resources': { 'res_ceilometer_agent_central': 'lsb:ceilometer-agent-central'}, 'resource_params': { 'res_ceilometer_agent_central': 'op monitor interval="30s"'}, 'delete_resources': ['res_ceilometer_polling'], } haproxy_enabled = True cmp_codename = CompareOpenStackReleases( get_os_codename_install_source(config('openstack-origin'))) if cmp_codename >= 'ocata': haproxy_enabled = False ceil_ha_settings['delete_resources'].append('res_ceilometer_haproxy') settings = generate_ha_relation_data( 'ceilometer', haproxy_enabled=haproxy_enabled, extra_settings=ceil_ha_settings) relation_set(relation_id=relation_id, **settings)
def ha_joined(relation_id=None): ha_console_settings = {} if not hookenv.config('dns-ha'): if (hookenv.config('single-nova-consoleauth') and common.console_attributes('protocol')): ha_console_settings = { 'colocations': { 'vip_consoleauth': COLO_CONSOLEAUTH }, 'init_services': { 'res_nova_consoleauth': 'nova-consoleauth' }, 'resources': { 'res_nova_consoleauth': AGENT_CONSOLEAUTH }, 'resource_params': { 'res_nova_consoleauth': AGENT_CA_PARAMS } } settings = ch_ha_utils.generate_ha_relation_data( 'nova', extra_settings=ha_console_settings) hookenv.relation_set(relation_id=relation_id, **settings)
def test_generate_ha_relation_data(self): self.get_hacluster_config.return_value = { 'vip': '10.5.100.1 ffff::1 ffaa::1' } extra_settings = { 'colocations': { 'vip_cauth': 'inf: res_nova_cauth grp_nova_vips' }, 'init_services': { 'res_nova_cauth': 'nova-cauth' }, 'delete_resources': ['res_ceilometer_polling'], 'groups': { 'grp_testservice_wombles': 'res_testservice_orinoco' }, } expected = { 'colocations': { 'vip_cauth': 'inf: res_nova_cauth grp_nova_vips' }, 'groups': { 'grp_testservice_vips': ('res_testservice_242d562_vip ' 'res_testservice_856d56f_vip ' 'res_testservice_f563c5d_vip'), 'grp_testservice_wombles': 'res_testservice_orinoco' }, 'resource_params': { 'res_testservice_242d562_vip': ('params ip="10.5.100.1" op monitor ' 'timeout="20s" interval="10s" depth="0"'), 'res_testservice_856d56f_vip': ('params ipv6addr="ffff::1" op monitor ' 'timeout="20s" interval="10s" depth="0"'), 'res_testservice_f563c5d_vip': ('params ipv6addr="ffaa::1" op monitor ' 'timeout="20s" interval="10s" depth="0"'), 'res_testservice_haproxy': ('meta migration-threshold="INFINITY" failure-timeout="5s" ' 'op monitor interval="5s"'), }, 'resources': { 'res_testservice_242d562_vip': 'ocf:heartbeat:IPaddr2', 'res_testservice_856d56f_vip': 'ocf:heartbeat:IPv6addr', 'res_testservice_f563c5d_vip': 'ocf:heartbeat:IPv6addr', 'res_testservice_haproxy': 'lsb:haproxy', }, 'clones': { 'cl_testservice_haproxy': 'res_testservice_haproxy', }, 'init_services': { 'res_testservice_haproxy': 'haproxy', 'res_nova_cauth': 'nova-cauth' }, 'delete_resources': [ "res_ceilometer_polling", "res_testservice_eth1_vip", "res_testservice_eth1_vip_ipv6addr", "res_testservice_eth2_vip" ], } expected = { 'json_{}'.format(k): json.dumps(v, **ha.JSON_ENCODE_OPTIONS) for k, v in expected.items() if v } self.assertEqual( ha.generate_ha_relation_data('testservice', extra_settings=extra_settings), expected)
def ha_relation_joined(relation_id=None): settings = generate_ha_relation_data('cephrg') relation_set(relation_id=relation_id, **settings)
def ha_joined(relation_id=None): settings = generate_ha_relation_data('heat') relation_set(relation_id=relation_id, **settings)
def ha_joined(relation_id=None): settings = generate_ha_relation_data('hpy') log("ha_joined: generated ha relation data is {}".format(settings)) relation_set(relation_id=relation_id, **settings)