Merge lp:~junaidali/charms/trusty/plumgrid-director/analyst_opsvm into lp:~plumgrid-team/charms/trusty/plumgrid-director/trunk

Proposed by Junaid Ali
Status: Needs review
Proposed branch: lp:~junaidali/charms/trusty/plumgrid-director/analyst_opsvm
Merge into: lp:~plumgrid-team/charms/trusty/plumgrid-director/trunk
Diff against target: 70 lines (+30/-2)
3 files modified
hooks/pg_dir_hooks.py (+3/-1)
hooks/pg_dir_utils.py (+25/-0)
unit_tests/test_pg_dir_hooks.py (+2/-1)
To merge this branch: bzr merge lp:~junaidali/charms/trusty/plumgrid-director/analyst_opsvm
Reviewer Review Type Date Requested Status
Bilal Baqar Approve
Javeria Khan Approve
Review via email: mp+301414@code.launchpad.net
To post a comment you must log in.
37. By Junaid Ali

Fix for sigmund-configure path [SOL-1144]

38. By Junaid Ali

checking the plumgrid service before
configuring OPSVM analyst

Revision history for this message
Javeria Khan (javeria-ak) :
review: Approve
Revision history for this message
Bilal Baqar (bbaqar) :
review: Approve
39. By Junaid Ali

Updated ns_enter as constant

Unmerged revisions

39. By Junaid Ali

Updated ns_enter as constant

38. By Junaid Ali

checking the plumgrid service before
configuring OPSVM analyst

37. By Junaid Ali

Fix for sigmund-configure path [SOL-1144]

36. By Junaid Ali

Changes:
   - Configure Analyst for OPSVM [SOL-1144]

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/pg_dir_hooks.py'
2--- hooks/pg_dir_hooks.py 2016-07-28 17:25:54 +0000
3+++ hooks/pg_dir_hooks.py 2016-08-05 17:43:28 +0000
4@@ -41,7 +41,8 @@
5 load_iptables,
6 restart_on_change,
7 director_cluster_ready,
8- configure_pg_sources
9+ configure_pg_sources,
10+ configure_analyst_opsvm
11 )
12
13 hooks = Hooks()
14@@ -159,6 +160,7 @@
15 '''
16 This hook is run when the charm is started.
17 '''
18+ configure_analyst_opsvm()
19 if config('plumgrid-license-key') is not None:
20 count = 0
21 while (count < 10):
22
23=== modified file 'hooks/pg_dir_utils.py'
24--- hooks/pg_dir_utils.py 2016-07-27 19:37:26 +0000
25+++ hooks/pg_dir_utils.py 2016-08-05 17:43:28 +0000
26@@ -103,6 +103,31 @@
27 log('Unable to update /etc/apt/sources.list')
28
29
30+def configure_analyst_opsvm():
31+ '''
32+ Configures Anaylyst for OPSVM
33+ '''
34+ if not service_running('plumgrid'):
35+ restart_pg()
36+ NS_ENTER = ('/opt/local/bin/nsenter -t $(ps ho pid --ppid '
37+ '$(cat /var/run/libvirt/lxc/plumgrid.pid)) -m -n -u -i -p ')
38+ sigmund_stop = NS_ENTER + '/usr/bin/service plumgrid-sigmund stop'
39+ sigmund_status = NS_ENTER \
40+ + '/usr/bin/service plumgrid-sigmund status'
41+ sigmund_autoboot = NS_ENTER \
42+ + '/usr/bin/sigmund-configure --ip {0} --start --autoboot' \
43+ .format(config('opsvm-ip'))
44+ try:
45+ status = subprocess.check_output(sigmund_status, shell=True)
46+ if 'start/running' in status:
47+ if subprocess.call(sigmund_stop, shell=True):
48+ log('plumgrid-sigmund couldn\'t be stopped!')
49+ return
50+ subprocess.check_call(sigmund_autoboot, shell=True)
51+ except:
52+ log('plumgrid-sigmund couldn\'t be started!')
53+
54+
55 def determine_packages():
56 '''
57 Returns list of packages required by PLUMgrid director as specified
58
59=== modified file 'unit_tests/test_pg_dir_hooks.py'
60--- unit_tests/test_pg_dir_hooks.py 2016-05-01 02:16:59 +0000
61+++ unit_tests/test_pg_dir_hooks.py 2016-08-05 17:43:28 +0000
62@@ -32,7 +32,8 @@
63 'post_pg_license',
64 'config',
65 'load_iptables',
66- 'status_set'
67+ 'status_set',
68+ 'configure_analyst_opsvm'
69 ]
70 NEUTRON_CONF_DIR = "/etc/neutron"
71

Subscribers

People subscribed via source and target branches