Updated restart_pg()

This commit is contained in:
Junaid Ali 2016-03-21 23:46:01 +05:00
parent 2e99af9387
commit c21e4554ce
2 changed files with 13 additions and 14 deletions

View File

@ -85,11 +85,9 @@ def config_changed():
log("Fabric interface already set")
else:
stop_pg()
if charm_config.changed('os-data-network'):
if charm_config['fabric-interfaces'] == 'MANAGEMENT':
log('Fabric running on managment network')
if (charm_config.changed('install_sources') or
charm_config.changed('plumgrid-build') or
charm_config.changed('install_keys') or
charm_config.changed('iovisor-build')):
stop_pg()
configure_sources(update=True)
@ -99,8 +97,6 @@ def config_changed():
remove_iovisor()
load_iovisor()
CONFIGS.write_all()
# Restarting the plumgrid service only if it is
# already stopped by any config-parameters or node reboot
if not service_running('plumgrid'):
restart_pg()

View File

@ -30,6 +30,7 @@ from charmhelpers.core.host import (
write_file,
service_start,
service_stop,
service_running
)
from charmhelpers.fetch import (
apt_cache,
@ -141,16 +142,18 @@ def restart_pg():
Stops and Starts PLUMgrid service after flushing iptables.
'''
stop_pg()
if not service_start('plumgrid'):
if not service_start('libvirt-bin'):
raise ValueError("libvirt-bin service couldn't be started")
service_start('plumgrid')
time.sleep(3)
if not service_running('plumgrid'):
if service_running('libvirt-bin'):
raise ValueError("plumgrid 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)
if not service_start('plumgrid'):
raise ValueError("plumgrid service couldn't be started")
time.sleep(30)
if service_start('libvirt-bin'):
time.sleep(3)
if not service_running('plumgrid'):
raise ValueError("plumgrid service couldn't be started")
else:
raise ValueError("libvirt-bin service couldn't be started")
def stop_pg():