622
632
'neutron-api charm.'
625
def test_ha_relation_joined_no_bound_ip(self):
626
self.get_hacluster_config.return_value = {
627
'ha-bindiface': 'em0',
628
'ha-mcastport': '8080',
629
'vip': '10.10.10.10',
631
self.test_config.set('vip_iface', 'eth120')
632
self.test_config.set('vip_cidr', '21')
633
self.get_iface_for_address.return_value = None
634
self.get_netmask_for_address.return_value = None
637
'corosync_bindiface': 'em0',
638
'corosync_mcastport': '8080',
639
'init_services': {'res_nova_haproxy': 'haproxy'},
640
'resources': {'res_nova_eth120_vip': 'ocf:heartbeat:IPaddr2',
641
'res_nova_haproxy': 'lsb:haproxy'},
643
'res_nova_eth120_vip': 'params ip="10.10.10.10"'
644
' cidr_netmask="21" nic="eth120"',
645
'res_nova_haproxy': 'op monitor interval="5s"'},
646
'clones': {'cl_nova_haproxy': 'res_nova_haproxy'}
648
self.relation_set.assert_has_calls([
649
call(groups={'grp_nova_vips': 'res_nova_eth120_vip'}),
635
@patch('nova_cc_utils.config')
636
def test_ha_relation_joined_no_bound_ip(self, config):
637
self.get_hacluster_config.return_value = {
638
'ha-bindiface': 'em0',
639
'ha-mcastport': '8080',
640
'vip': '10.10.10.10',
642
self.test_config.set('vip_iface', 'eth120')
643
self.test_config.set('vip_cidr', '21')
644
config.return_value = None
645
self.get_iface_for_address.return_value = None
646
self.get_netmask_for_address.return_value = None
649
'corosync_bindiface': 'em0',
650
'corosync_mcastport': '8080',
651
'init_services': {'res_nova_haproxy': 'haproxy'},
652
'resources': {'res_nova_eth120_vip': 'ocf:heartbeat:IPaddr2',
653
'res_nova_haproxy': 'lsb:haproxy'},
655
'res_nova_eth120_vip': 'params ip="10.10.10.10"'
656
' cidr_netmask="21" nic="eth120"',
657
'res_nova_haproxy': 'op monitor interval="5s"'},
659
'clones': {'cl_nova_haproxy': 'res_nova_haproxy'}
661
self.relation_set.assert_has_calls([
662
call(groups={'grp_nova_vips': 'res_nova_eth120_vip'}),
666
@patch('nova_cc_utils.config')
667
def test_ha_relation_multi_consoleauth(self, config):
668
self.get_hacluster_config.return_value = {
669
'ha-bindiface': 'em0',
670
'ha-mcastport': '8080',
671
'vip': '10.10.10.10',
673
self.test_config.set('vip_iface', 'eth120')
674
self.test_config.set('vip_cidr', '21')
675
self.test_config.set('single-nova-consoleauth', False)
676
config.return_value = 'novnc'
677
self.get_iface_for_address.return_value = None
678
self.get_netmask_for_address.return_value = None
681
'corosync_bindiface': 'em0',
682
'corosync_mcastport': '8080',
683
'init_services': {'res_nova_haproxy': 'haproxy'},
684
'resources': {'res_nova_eth120_vip': 'ocf:heartbeat:IPaddr2',
685
'res_nova_haproxy': 'lsb:haproxy'},
687
'res_nova_eth120_vip': 'params ip="10.10.10.10"'
688
' cidr_netmask="21" nic="eth120"',
689
'res_nova_haproxy': 'op monitor interval="5s"'},
691
'clones': {'cl_nova_haproxy': 'res_nova_haproxy'}
693
self.relation_set.assert_has_calls([
694
call(groups={'grp_nova_vips': 'res_nova_eth120_vip'}),
698
@patch('nova_cc_utils.config')
699
def test_ha_relation_single_consoleauth(self, config):
700
self.get_hacluster_config.return_value = {
701
'ha-bindiface': 'em0',
702
'ha-mcastport': '8080',
703
'vip': '10.10.10.10',
705
self.test_config.set('vip_iface', 'eth120')
706
self.test_config.set('vip_cidr', '21')
707
config.return_value = 'novnc'
708
self.get_iface_for_address.return_value = None
709
self.get_netmask_for_address.return_value = None
712
'corosync_bindiface': 'em0',
713
'corosync_mcastport': '8080',
714
'init_services': {'res_nova_haproxy': 'haproxy',
715
'res_nova_consoleauth': 'nova-consoleauth'},
716
'resources': {'res_nova_eth120_vip': 'ocf:heartbeat:IPaddr2',
717
'res_nova_haproxy': 'lsb:haproxy',
718
'res_nova_consoleauth':
719
'ocf:openstack:nova-consoleauth'},
721
'res_nova_eth120_vip': 'params ip="10.10.10.10"'
722
' cidr_netmask="21" nic="eth120"',
723
'res_nova_haproxy': 'op monitor interval="5s"',
724
'res_nova_consoleauth': 'op monitor interval="5s"'},
726
'vip_consoleauth': 'inf: res_nova_consoleauth grp_nova_vips'
728
'clones': {'cl_nova_haproxy': 'res_nova_haproxy'}
730
self.relation_set.assert_has_calls([
731
call(groups={'grp_nova_vips': 'res_nova_eth120_vip'}),
735
@patch('nova_cc_hooks.configure_https')
736
@patch('nova_cc_utils.config')
737
def test_config_changed_single_consoleauth(self, config, *args):
738
config.return_value = 'novnc'
739
rids = {'ha': ['ha:1']}
742
return rids.get(r, [])
744
self.relation_ids.side_effect = f
745
hooks.config_changed()
747
'delete_resources': [],
748
'init_services': {'res_nova_consoleauth': 'nova-consoleauth'},
749
'resources': {'res_nova_consoleauth':
750
'ocf:openstack:nova-consoleauth'},
752
'res_nova_consoleauth': 'op monitor interval="5s"'},
754
'vip_consoleauth': 'inf: res_nova_consoleauth grp_nova_vips'
757
self.relation_set.assert_has_calls([
758
call(v, **args) for v in rids['ha']