Browse Source

Updated restart_pg()

tags/14.04-eol
Junaid Ali 3 years ago
parent
commit
c21e4554ce
2 changed files with 13 additions and 14 deletions
  1. 1
    5
      hooks/pg_gw_hooks.py
  2. 12
    9
      hooks/pg_gw_utils.py

+ 1
- 5
hooks/pg_gw_hooks.py View File

@@ -85,11 +85,9 @@ def config_changed():
85 85
             log("Fabric interface already set")
86 86
         else:
87 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 88
     if (charm_config.changed('install_sources') or
92 89
         charm_config.changed('plumgrid-build') or
90
+        charm_config.changed('install_keys') or
93 91
             charm_config.changed('iovisor-build')):
94 92
         stop_pg()
95 93
         configure_sources(update=True)
@@ -99,8 +97,6 @@ def config_changed():
99 97
             remove_iovisor()
100 98
             load_iovisor()
101 99
     CONFIGS.write_all()
102
-    # Restarting the plumgrid service only if it is
103
-    # already stopped by any config-parameters or node reboot
104 100
     if not service_running('plumgrid'):
105 101
         restart_pg()
106 102
 

+ 12
- 9
hooks/pg_gw_utils.py View File

@@ -30,6 +30,7 @@ from charmhelpers.core.host import (
30 30
     write_file,
31 31
     service_start,
32 32
     service_stop,
33
+    service_running
33 34
 )
34 35
 from charmhelpers.fetch import (
35 36
     apt_cache,
@@ -141,16 +142,18 @@ def restart_pg():
141 142
     Stops and Starts PLUMgrid service after flushing iptables.
142 143
     '''
143 144
     stop_pg()
144
-    if not service_start('plumgrid'):
145
-        if not service_start('libvirt-bin'):
146
-            raise ValueError("libvirt-bin service couldn't be started")
145
+    service_start('plumgrid')
146
+    time.sleep(3)
147
+    if not service_running('plumgrid'):
148
+        if service_running('libvirt-bin'):
149
+            raise ValueError("plumgrid service couldn't be started")
147 150
         else:
148
-            # wait for 3 secs so that libvirt-bin can be completely up and
149
-            # start the plumgrid service
150
-            time.sleep(3)
151
-            if not service_start('plumgrid'):
152
-                raise ValueError("plumgrid service couldn't be started")
153
-    time.sleep(30)
151
+            if service_start('libvirt-bin'):
152
+                time.sleep(3)
153
+                if not service_running('plumgrid'):
154
+                    raise ValueError("plumgrid service couldn't be started")
155
+            else:
156
+                raise ValueError("libvirt-bin service couldn't be started")
154 157
 
155 158
 
156 159
 def stop_pg():

Loading…
Cancel
Save