diff options
-rwxr-xr-x | hooks/pg_gw_hooks.py | 4 | ||||
-rw-r--r-- | hooks/pg_gw_utils.py | 26 | ||||
-rw-r--r-- | unit_tests/test_pg_gw_hooks.py | 3 |
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 | ||
41 | hooks = Hooks() | 42 | hooks = 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 | ||
96 | def 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 | |||
96 | def determine_packages(): | 122 | def 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 | ] |
35 | NEUTRON_CONF_DIR = "/etc/neutron" | 36 | NEUTRON_CONF_DIR = "/etc/neutron" |
36 | 37 | ||