Remove debug logging and make neutron-security-groups a boolean
This commit is contained in:
parent
7224215473
commit
3b446c1cf7
|
@ -40,12 +40,10 @@ options:
|
|||
type: string
|
||||
description: OpenStack Region
|
||||
neutron-security-groups:
|
||||
type: string
|
||||
default: "no"
|
||||
type: boolean
|
||||
default: False
|
||||
description: |
|
||||
Use quantum for security group management.
|
||||
.
|
||||
Only supported for >= grizzly.
|
||||
neutron-external-network:
|
||||
type: string
|
||||
default: ext_net
|
||||
|
|
|
@ -28,19 +28,13 @@ class HAIncompleteConfig(Exception):
|
|||
|
||||
|
||||
def is_clustered():
|
||||
log('** LY ** In is_clustered')
|
||||
if relation_ids('ha'):
|
||||
log('** LY ** In is_clustered len(relation_ids(ha)):' + str(len(relation_ids('ha'))))
|
||||
else:
|
||||
log('** LY ** relation_ids(ha) is false')
|
||||
for r_id in (relation_ids('ha') or []):
|
||||
log('** LY ** r_id: ' + str(r_id))
|
||||
for unit in (relation_list(r_id) or []):
|
||||
log('** LY ** unit: ' + str(unit))
|
||||
clustered = relation_get('clustered',
|
||||
rid=r_id,
|
||||
unit=unit)
|
||||
log('** LY ** clustered: ' + str(clustered))
|
||||
if clustered:
|
||||
return True
|
||||
return False
|
||||
|
@ -64,27 +58,19 @@ def is_leader(resource):
|
|||
|
||||
def peer_units():
|
||||
peers = []
|
||||
log('** LY ** In peer_units')
|
||||
for r_id in (relation_ids('cluster') or []):
|
||||
log('** LY ** In peer_units r_id:' + str(r_id))
|
||||
for unit in (relation_list(r_id) or []):
|
||||
log('** LY ** In peer_units unit:' + str(unit))
|
||||
peers.append(unit)
|
||||
return peers
|
||||
|
||||
|
||||
def oldest_peer(peers):
|
||||
log('** LY ** In oldest_peer')
|
||||
local_unit_no = int(os.getenv('JUJU_UNIT_NAME').split('/')[1])
|
||||
log('** LY ** In oldest_peer local_unit_no:' + str(local_unit_no))
|
||||
for peer in peers:
|
||||
remote_unit_no = int(peer.split('/')[1])
|
||||
log('** LY ** In oldest_peer remote_unit_no:' + str(remote_unit_no))
|
||||
if remote_unit_no < local_unit_no:
|
||||
log('** LY ** In oldest_peer %s < %s:' % (str(remote_unit_no), str(local_unit_no)))
|
||||
return False
|
||||
else:
|
||||
log('** LY ** In oldest_peer %s >= %s:' % (str(remote_unit_no), str(local_unit_no)))
|
||||
return True
|
||||
|
||||
|
||||
|
@ -190,14 +176,11 @@ def canonical_url(configs, vip_setting='vip'):
|
|||
:vip_setting: str: Setting in charm config that specifies
|
||||
VIP address.
|
||||
'''
|
||||
log('** LY ** In canonical_url')
|
||||
scheme = 'http'
|
||||
if 'https' in configs.complete_contexts():
|
||||
scheme = 'https'
|
||||
if is_clustered():
|
||||
log('** LY ** is_clustered is true, returning vip')
|
||||
addr = config_get(vip_setting)
|
||||
else:
|
||||
log('** LY ** is_clustered is false, returning private-address')
|
||||
addr = unit_get('private-address')
|
||||
return '%s://%s' % (scheme, addr)
|
||||
|
|
|
@ -45,8 +45,7 @@ class NeutronCCContext(context.NeutronContext):
|
|||
|
||||
@property
|
||||
def neutron_security_groups(self):
|
||||
sec_groups = config('neutron-security-groups')
|
||||
return sec_groups.lower() == 'yes'
|
||||
return config('neutron-security-groups')
|
||||
|
||||
|
||||
def __call__(self):
|
||||
|
|
|
@ -208,21 +208,20 @@ def _get_keystone_info():
|
|||
|
||||
@hooks.hook('neutron-api-relation-joined')
|
||||
def neutron_api_relation_joined(rid=None):
|
||||
log('** LY ** neutron_api_relation_joined')
|
||||
manager = network_manager()
|
||||
base_url = canonical_url(CONFIGS)
|
||||
log('** LY ** neutron_api_relation_joined base_url:' + base_url)
|
||||
neutron_url = '%s:%s' % (base_url, api_port('neutron-server'))
|
||||
log('** LY ** neutron_api_relation_joined neutron_url:' + neutron_url)
|
||||
relation_data = {
|
||||
'network_manager': manager,
|
||||
'default_floating_pool': config('neutron-external-network'),
|
||||
'external_network': config('neutron-external-network'),
|
||||
manager + '_plugin': config('neutron-plugin'),
|
||||
manager + '_url': neutron_url,
|
||||
manager + '_security_groups': config('neutron-security-groups')
|
||||
}
|
||||
log('** LY ** neutron_api_relation_joined neutron_url (from relation_data):' + relation_data['neutron_url'])
|
||||
if config('neutron-security-groups'):
|
||||
relation_data[manager + '_security_groups'] = "yes"
|
||||
else:
|
||||
relation_data[manager + '_security_groups'] = "no"
|
||||
keystone_info = _get_keystone_info()
|
||||
if is_relation_made('identity-service') and keystone_info:
|
||||
relation_data.update({
|
||||
|
@ -251,7 +250,6 @@ def cluster_changed():
|
|||
|
||||
@hooks.hook('ha-relation-joined')
|
||||
def ha_joined():
|
||||
log('** LY ** IN HA JOINED')
|
||||
config = get_hacluster_config()
|
||||
resources = {
|
||||
'res_neutron_vip': 'ocf:heartbeat:IPaddr2',
|
||||
|
@ -269,8 +267,6 @@ def ha_joined():
|
|||
clones = {
|
||||
'cl_nova_haproxy': 'res_neutron_haproxy'
|
||||
}
|
||||
log('** LY ** HA JOINED ha-bindiface: '+ str(config['ha-bindiface']))
|
||||
log('** LY ** HA JOINED ha-mcastport: '+ str(config['ha-mcastport']))
|
||||
relation_set(init_services=init_services,
|
||||
corosync_bindiface=config['ha-bindiface'],
|
||||
corosync_mcastport=config['ha-mcastport'],
|
||||
|
|
Loading…
Reference in New Issue