Ensuring plumgrid services to restart on certain hooks, Updated restart_pg()

This commit is contained in:
Junaid Ali 2016-03-14 20:13:15 +05:00
parent c4868ea751
commit f8987ff8ca
2 changed files with 25 additions and 17 deletions

View File

@ -74,30 +74,31 @@ def config_changed():
This hook is run when a config parameter is changed. This hook is run when a config parameter is changed.
It also runs on node reboot. It also runs on node reboot.
''' '''
if add_lcm_key():
log("PLUMgrid LCM Key added")
return 1
charm_config = config() charm_config = config()
if charm_config.changed('lcm-ssh-key'):
if add_lcm_key():
log("PLUMgrid LCM Key added")
if charm_config.changed('fabric-interfaces'): if charm_config.changed('fabric-interfaces'):
if not fabric_interface_changed(): if not fabric_interface_changed():
log("Fabric interface already set") log("Fabric interface already set")
return 1 else:
restart_pg()
if charm_config.changed('os-data-network'): if charm_config.changed('os-data-network'):
if charm_config['fabric-interfaces'] == 'MANAGEMENT': if charm_config['fabric-interfaces'] == 'MANAGEMENT':
log('Fabric running on managment network') log('Fabric running on managment network')
return 1 if (charm_config.changed('install_sources') or
stop_pg() charm_config.changed('plumgrid-build') or
configure_sources(update=True) charm_config.changed('plumgrid-virtual-ip') or
pkgs = determine_packages() charm_config.changed('iovisor-build')):
for pkg in pkgs: stop_pg()
apt_install(pkg, options=['--force-yes'], fatal=True) configure_sources(update=True)
remove_iovisor() pkgs = determine_packages()
load_iovisor() for pkg in pkgs:
ensure_mtu() apt_install(pkg, options=['--force-yes'], fatal=True)
ensure_files() remove_iovisor()
add_lcm_key() load_iovisor()
restart_pg()
CONFIGS.write_all() CONFIGS.write_all()
restart_pg()
@hooks.hook('upgrade-charm') @hooks.hook('upgrade-charm')

View File

@ -141,7 +141,14 @@ def restart_pg():
Stops and Starts PLUMgrid service after flushing iptables. Stops and Starts PLUMgrid service after flushing iptables.
''' '''
stop_pg() stop_pg()
service_start('plumgrid') if not service_start('plumgrid'):
if not service_start('libvirt-bin'):
raise ValueError("libvirt-bin service couldn't be started")
else:
# wait for 3 secs so that libvirt-bin can be completely up and
# start the plumgrid service
time.sleep(3)
service_start('plumgrid')
time.sleep(30) time.sleep(30)