summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorplumgrid <Junaid Ali>2016-08-07 14:46:12 -0400
committerplumgrid <Junaid Ali>2016-08-07 14:46:12 -0400
commit77a25e2225013a622677499a7f019bdf91f15da3 (patch)
tree4c62e0a55954250b7989f0a4020e1f32e70acb23
parent2f0a6900c981f942e933dbafc4ff1445b27bb12c (diff)
Configuring analyst for OPSVM
Ticket: [SOL-1144] Signed-off-by: Junaid Ali <junaidali@plumgrid.com>
-rwxr-xr-xhooks/pg_gw_hooks.py4
-rw-r--r--hooks/pg_gw_utils.py26
-rw-r--r--unit_tests/test_pg_gw_hooks.py3
3 files changed, 31 insertions, 2 deletions
diff --git a/hooks/pg_gw_hooks.py b/hooks/pg_gw_hooks.py
index 5818cea..5e74500 100755
--- a/hooks/pg_gw_hooks.py
+++ b/hooks/pg_gw_hooks.py
@@ -35,7 +35,8 @@ from pg_gw_utils import (
35 restart_on_change, 35 restart_on_change,
36 restart_on_stop, 36 restart_on_stop,
37 director_cluster_ready, 37 director_cluster_ready,
38 configure_pg_sources 38 configure_pg_sources,
39 configure_analyst_opsvm
39) 40)
40 41
41hooks = Hooks() 42hooks = Hooks()
@@ -69,6 +70,7 @@ def plumgrid_changed():
69 ''' 70 '''
70 if director_cluster_ready(): 71 if director_cluster_ready():
71 ensure_mtu() 72 ensure_mtu()
73 configure_analyst_opsvm()
72 CONFIGS.write_all() 74 CONFIGS.write_all()
73 75
74 76
diff --git a/hooks/pg_gw_utils.py b/hooks/pg_gw_utils.py
index ebd5899..ad62133 100644
--- a/hooks/pg_gw_utils.py
+++ b/hooks/pg_gw_utils.py
@@ -93,6 +93,32 @@ def configure_pg_sources():
93 log('Unable to update /etc/apt/sources.list') 93 log('Unable to update /etc/apt/sources.list')
94 94
95 95
96def configure_analyst_opsvm():
97 '''
98 Configures Anaylyst for OPSVM
99 '''
100 opsvm_ip = pg_gw_context._pg_dir_context()['opsvm_ip']
101 if not service_running('plumgrid'):
102 restart_pg()
103 NS_ENTER = ('/opt/local/bin/nsenter -t $(ps ho pid --ppid $(cat '
104 '/var/run/libvirt/lxc/plumgrid.pid)) -m -n -u -i -p ')
105 sigmund_stop = NS_ENTER + '/usr/bin/service plumgrid-sigmund stop'
106 sigmund_status = NS_ENTER \
107 + '/usr/bin/service plumgrid-sigmund status'
108 sigmund_autoboot = NS_ENTER \
109 + '/usr/bin/sigmund-configure --ip {0} --start --autoboot' \
110 .format(opsvm_ip)
111 try:
112 status = subprocess.check_output(sigmund_status, shell=True)
113 if 'start/running' in status:
114 if subprocess.call(sigmund_stop, shell=True):
115 log('plumgrid-sigmund couldn\'t be stopped!')
116 return
117 subprocess.check_call(sigmund_autoboot, shell=True)
118 except:
119 log('plumgrid-sigmund couldn\'t be started!')
120
121
96def determine_packages(): 122def determine_packages():
97 ''' 123 '''
98 Returns list of packages required by PLUMgrid Gateway as specified 124 Returns list of packages required by PLUMgrid Gateway as specified
diff --git a/unit_tests/test_pg_gw_hooks.py b/unit_tests/test_pg_gw_hooks.py
index 194d0c0..101ea49 100644
--- a/unit_tests/test_pg_gw_hooks.py
+++ b/unit_tests/test_pg_gw_hooks.py
@@ -30,7 +30,8 @@ TO_PATCH = [
30 'determine_packages', 30 'determine_packages',
31 'load_iptables', 31 'load_iptables',
32 'director_cluster_ready', 32 'director_cluster_ready',
33 'status_set' 33 'status_set',
34 'configure_analyst_opsvm'
34] 35]
35NEUTRON_CONF_DIR = "/etc/neutron" 36NEUTRON_CONF_DIR = "/etc/neutron"
36 37