summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunaid Ali <junaidali@plumgrid.com>2016-03-21 23:46:01 +0500
committerJunaid Ali <junaidali@plumgrid.com>2016-03-21 23:46:01 +0500
commitc21e4554ce563a9254577ea579e521a3b61ab1a4 (patch)
treecbc89f6d78cb4bf56340c50a1e73ff1c56ac2808
parent2e99af93876bcc669b15ee1f20a3118a3948705f (diff)
Updated restart_pg()
-rwxr-xr-xhooks/pg_gw_hooks.py6
-rw-r--r--hooks/pg_gw_utils.py21
2 files changed, 13 insertions, 14 deletions
diff --git a/hooks/pg_gw_hooks.py b/hooks/pg_gw_hooks.py
index 5e3b1cc..4ff5abc 100755
--- a/hooks/pg_gw_hooks.py
+++ b/hooks/pg_gw_hooks.py
@@ -85,11 +85,9 @@ def config_changed():
85 log("Fabric interface already set") 85 log("Fabric interface already set")
86 else: 86 else:
87 stop_pg() 87 stop_pg()
88 if charm_config.changed('os-data-network'):
89 if charm_config['fabric-interfaces'] == 'MANAGEMENT':
90 log('Fabric running on managment network')
91 if (charm_config.changed('install_sources') or 88 if (charm_config.changed('install_sources') or
92 charm_config.changed('plumgrid-build') or 89 charm_config.changed('plumgrid-build') or
90 charm_config.changed('install_keys') or
93 charm_config.changed('iovisor-build')): 91 charm_config.changed('iovisor-build')):
94 stop_pg() 92 stop_pg()
95 configure_sources(update=True) 93 configure_sources(update=True)
@@ -99,8 +97,6 @@ def config_changed():
99 remove_iovisor() 97 remove_iovisor()
100 load_iovisor() 98 load_iovisor()
101 CONFIGS.write_all() 99 CONFIGS.write_all()
102 # Restarting the plumgrid service only if it is
103 # already stopped by any config-parameters or node reboot
104 if not service_running('plumgrid'): 100 if not service_running('plumgrid'):
105 restart_pg() 101 restart_pg()
106 102
diff --git a/hooks/pg_gw_utils.py b/hooks/pg_gw_utils.py
index 9ca5bdb..1830f12 100644
--- a/hooks/pg_gw_utils.py
+++ b/hooks/pg_gw_utils.py
@@ -30,6 +30,7 @@ from charmhelpers.core.host import (
30 write_file, 30 write_file,
31 service_start, 31 service_start,
32 service_stop, 32 service_stop,
33 service_running
33) 34)
34from charmhelpers.fetch import ( 35from charmhelpers.fetch import (
35 apt_cache, 36 apt_cache,
@@ -141,16 +142,18 @@ def restart_pg():
141 Stops and Starts PLUMgrid service after flushing iptables. 142 Stops and Starts PLUMgrid service after flushing iptables.
142 ''' 143 '''
143 stop_pg() 144 stop_pg()
144 if not service_start('plumgrid'): 145 service_start('plumgrid')
145 if not service_start('libvirt-bin'): 146 time.sleep(3)
146 raise ValueError("libvirt-bin service couldn't be started") 147 if not service_running('plumgrid'):
148 if service_running('libvirt-bin'):
149 raise ValueError("plumgrid service couldn't be started")
147 else: 150 else:
148 # wait for 3 secs so that libvirt-bin can be completely up and 151 if service_start('libvirt-bin'):
149 # start the plumgrid service 152 time.sleep(3)
150 time.sleep(3) 153 if not service_running('plumgrid'):
151 if not service_start('plumgrid'): 154 raise ValueError("plumgrid service couldn't be started")
152 raise ValueError("plumgrid service couldn't be started") 155 else:
153 time.sleep(30) 156 raise ValueError("libvirt-bin service couldn't be started")
154 157
155 158
156def stop_pg(): 159def stop_pg():