summaryrefslogtreecommitdiff
path: root/hooks/pg_gw_utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'hooks/pg_gw_utils.py')
-rw-r--r--hooks/pg_gw_utils.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/hooks/pg_gw_utils.py b/hooks/pg_gw_utils.py
index ad62133..d9b9894 100644
--- a/hooks/pg_gw_utils.py
+++ b/hooks/pg_gw_utils.py
@@ -21,6 +21,8 @@ from charmhelpers.core.hookenv import (
21) 21)
22from charmhelpers.contrib.network.ip import ( 22from charmhelpers.contrib.network.ip import (
23 get_iface_from_addr, 23 get_iface_from_addr,
24 get_host_ip,
25 get_iface_addr,
24 get_bridges, 26 get_bridges,
25 get_bridge_nics, 27 get_bridge_nics,
26) 28)
@@ -97,9 +99,9 @@ def configure_analyst_opsvm():
97 ''' 99 '''
98 Configures Anaylyst for OPSVM 100 Configures Anaylyst for OPSVM
99 ''' 101 '''
100 opsvm_ip = pg_gw_context._pg_dir_context()['opsvm_ip']
101 if not service_running('plumgrid'): 102 if not service_running('plumgrid'):
102 restart_pg() 103 restart_pg()
104 opsvm_ip = pg_gw_context._pg_dir_context()['opsvm_ip']
103 NS_ENTER = ('/opt/local/bin/nsenter -t $(ps ho pid --ppid $(cat ' 105 NS_ENTER = ('/opt/local/bin/nsenter -t $(ps ho pid --ppid $(cat '
104 '/var/run/libvirt/lxc/plumgrid.pid)) -m -n -u -i -p ') 106 '/var/run/libvirt/lxc/plumgrid.pid)) -m -n -u -i -p ')
105 sigmund_stop = NS_ENTER + '/usr/bin/service plumgrid-sigmund stop' 107 sigmund_stop = NS_ENTER + '/usr/bin/service plumgrid-sigmund stop'
@@ -115,6 +117,7 @@ def configure_analyst_opsvm():
115 log('plumgrid-sigmund couldn\'t be stopped!') 117 log('plumgrid-sigmund couldn\'t be stopped!')
116 return 118 return
117 subprocess.check_call(sigmund_autoboot, shell=True) 119 subprocess.check_call(sigmund_autoboot, shell=True)
120 status = subprocess.check_output(sigmund_status, shell=True)
118 except: 121 except:
119 log('plumgrid-sigmund couldn\'t be started!') 122 log('plumgrid-sigmund couldn\'t be started!')
120 123
@@ -249,7 +252,13 @@ def get_mgmt_interface():
249 ''' 252 '''
250 mgmt_interface = config('mgmt-interface') 253 mgmt_interface = config('mgmt-interface')
251 if not mgmt_interface: 254 if not mgmt_interface:
252 return get_iface_from_addr(unit_get('private-address')) 255 try:
256 return get_iface_from_addr(unit_get('private-address'))
257 except:
258 for bridge_interface in get_bridges():
259 if (get_host_ip(unit_get('private-address'))
260 in get_iface_addr(bridge_interface)):
261 return bridge_interface
253 elif interface_exists(mgmt_interface): 262 elif interface_exists(mgmt_interface):
254 return mgmt_interface 263 return mgmt_interface
255 else: 264 else: