Fabric config change only applies restart to the node that has a change

This commit is contained in:
Bilal Baqar
2015-11-21 14:07:15 -08:00
parent b9a6d93d6e
commit da05e48642
2 changed files with 26 additions and 0 deletions

View File

@@ -30,6 +30,7 @@ from pg_dir_utils import (
ensure_mtu,
add_lcm_key,
post_pg_license,
fabric_interface_changed
)
hooks = Hooks()
@@ -71,6 +72,15 @@ def config_changed():
if add_lcm_key():
log("PLUMgrid LCM Key added")
return 1
charm_config = config()
if charm_config.changed('fabric-interfaces'):
if not fabric_interface_changed():
log("Fabric interface already set")
return 1
if charm_config.changed('os-data-network'):
if charm_config['fabric-interfaces'] == 'MANAGEMENT':
log('Fabric running on managment network')
return 1
stop_pg()
configure_sources(update=True)
pkgs = determine_packages()

View File

@@ -198,6 +198,22 @@ def get_mgmt_interface():
return get_iface_from_addr(unit_get('private-address'))
def fabric_interface_changed():
'''
Returns true if interface for node changed.
'''
fabric_interface = get_fabric_interface()
try:
with open(PG_IFCS_CONF, 'r') as ifcs:
for line in ifcs:
if 'fabric_core' in line:
if line.split()[0] == fabric_interface:
return False
except IOError:
return True
return True
def get_fabric_interface():
'''
Returns the fabric interface.