Merge lp:~bbaqar/charms/trusty/plumgrid-gateway/opsvm into lp:~plumgrid-team/charms/trusty/plumgrid-gateway/trunk
- Trusty Tahr (14.04)
- opsvm
- Merge into trunk
Proposed by
Bilal Baqar
Status: | Merged |
---|---|
Merged at revision: | 24 |
Proposed branch: | lp:~bbaqar/charms/trusty/plumgrid-gateway/opsvm |
Merge into: | lp:~plumgrid-team/charms/trusty/plumgrid-gateway/trunk |
Diff against target: |
355 lines (+81/-50) 8 files modified
hooks/pg_gw_context.py (+22/-14) hooks/pg_gw_hooks.py (+9/-15) hooks/pg_gw_utils.py (+30/-3) templates/kilo/00-pg.conf (+1/-0) templates/kilo/plumgrid.conf (+1/-1) unit_tests/test_pg_gw_context.py (+10/-7) unit_tests/test_pg_gw_hooks.py (+5/-9) unit_tests/test_pg_gw_utils.py (+3/-1) |
To merge this branch: | bzr merge lp:~bbaqar/charms/trusty/plumgrid-gateway/opsvm |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Junaid Ali | Approve | ||
Javeria Khan | Approve | ||
Review via email: mp+290180@code.launchpad.net |
Commit message
OPSVM Changes
Ticket: [SOL-830]
Description of the change
- Getting OPSVM IP from director relation
- Making OPSVM specific changes
- Cleaned code in various functions
- Added restart_on_change decorater function that restarts plumgrid service only when there has been any change in the configuration files
- Removed restart of plumgrid service when only two directors are available
- Fixed unit tests accordingly
To post a comment you must log in.
Revision history for this message
Junaid Ali (junaidali) wrote : | # |
Looks good to me.
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'hooks/pg_gw_context.py' | |||
2 | --- hooks/pg_gw_context.py 2016-03-12 21:55:39 +0000 | |||
3 | +++ hooks/pg_gw_context.py 2016-03-27 15:36:55 +0000 | |||
4 | @@ -16,16 +16,23 @@ | |||
5 | 16 | ) | 16 | ) |
6 | 17 | 17 | ||
7 | 18 | 18 | ||
9 | 19 | def _pg_dir_settings(): | 19 | def _pg_dir_context(): |
10 | 20 | ''' | 20 | ''' |
11 | 21 | Inspects relation with PLUMgrid director. | 21 | Inspects relation with PLUMgrid director. |
12 | 22 | ''' | 22 | ''' |
14 | 23 | director_ips = [] | 23 | ctxt = { |
15 | 24 | 'opsvm_ip': '127.0.0.1', | ||
16 | 25 | 'director_ips': [], | ||
17 | 26 | } | ||
18 | 24 | for rid in relation_ids('plumgrid'): | 27 | for rid in relation_ids('plumgrid'): |
19 | 25 | for unit in related_units(rid): | 28 | for unit in related_units(rid): |
20 | 26 | rdata = relation_get(rid=rid, unit=unit) | 29 | rdata = relation_get(rid=rid, unit=unit) |
23 | 27 | director_ips.append(str(get_host_ip(rdata['private-address']))) | 30 | ctxt['director_ips' |
24 | 28 | return director_ips | 31 | ].append(str(get_host_ip(rdata['private-address']))) |
25 | 32 | if "opsvm_ip" in rdata: | ||
26 | 33 | ctxt['opsvm_ip'] = \ | ||
27 | 34 | rdata['opsvm_ip'] | ||
28 | 35 | return ctxt | ||
29 | 29 | 36 | ||
30 | 30 | 37 | ||
31 | 31 | class PGGwContext(context.NeutronContext): | 38 | class PGGwContext(context.NeutronContext): |
32 | @@ -62,16 +69,16 @@ | |||
33 | 62 | if not pg_ctxt: | 69 | if not pg_ctxt: |
34 | 63 | return {} | 70 | return {} |
35 | 64 | 71 | ||
46 | 65 | pg_dir_ips = '' | 72 | pg_dir_context = _pg_dir_context() |
47 | 66 | pg_dir_settings = sorted(_pg_dir_settings()) | 73 | pg_dir_ips = sorted(pg_dir_context['director_ips']) |
48 | 67 | single_ip = True | 74 | dir_count = len(pg_dir_ips) |
49 | 68 | for ip in pg_dir_settings: | 75 | pg_ctxt['director_ips_string'] = (str(pg_dir_ips[0]) + ',' + |
50 | 69 | if single_ip: | 76 | str(pg_dir_ips[1]) + ',' + |
51 | 70 | pg_dir_ips = str(ip) | 77 | str(pg_dir_ips[2]) |
52 | 71 | single_ip = False | 78 | if dir_count == 3 else |
53 | 72 | else: | 79 | str(pg_dir_ips[0]) |
54 | 73 | pg_dir_ips = pg_dir_ips + ',' + str(ip) | 80 | if dir_count == 1 else |
55 | 74 | pg_ctxt['local_ip'] = pg_dir_ips | 81 | '') |
56 | 75 | unit_hostname = gethostname() | 82 | unit_hostname = gethostname() |
57 | 76 | pg_ctxt['pg_hostname'] = unit_hostname | 83 | pg_ctxt['pg_hostname'] = unit_hostname |
58 | 77 | pg_ctxt['pg_fqdn'] = getfqdn() | 84 | pg_ctxt['pg_fqdn'] = getfqdn() |
59 | @@ -85,5 +92,6 @@ | |||
60 | 85 | pg_ctxt['label'] = unit_hostname | 92 | pg_ctxt['label'] = unit_hostname |
61 | 86 | pg_ctxt['fabric_mode'] = 'host' | 93 | pg_ctxt['fabric_mode'] = 'host' |
62 | 87 | pg_ctxt['ext_interfaces'] = get_gw_interfaces() | 94 | pg_ctxt['ext_interfaces'] = get_gw_interfaces() |
63 | 95 | pg_ctxt['opsvm_ip'] = pg_dir_context['opsvm_ip'] | ||
64 | 88 | 96 | ||
65 | 89 | return pg_ctxt | 97 | return pg_ctxt |
66 | 90 | 98 | ||
67 | === modified file 'hooks/pg_gw_hooks.py' | |||
68 | --- hooks/pg_gw_hooks.py 2016-03-25 17:33:22 +0000 | |||
69 | +++ hooks/pg_gw_hooks.py 2016-03-27 15:36:55 +0000 | |||
70 | @@ -18,7 +18,6 @@ | |||
71 | 18 | 18 | ||
72 | 19 | from charmhelpers.fetch import ( | 19 | from charmhelpers.fetch import ( |
73 | 20 | apt_install, | 20 | apt_install, |
74 | 21 | apt_purge, | ||
75 | 22 | configure_sources, | 21 | configure_sources, |
76 | 23 | ) | 22 | ) |
77 | 24 | 23 | ||
78 | @@ -26,6 +25,7 @@ | |||
79 | 26 | register_configs, | 25 | register_configs, |
80 | 27 | ensure_files, | 26 | ensure_files, |
81 | 28 | restart_pg, | 27 | restart_pg, |
82 | 28 | restart_map, | ||
83 | 29 | stop_pg, | 29 | stop_pg, |
84 | 30 | determine_packages, | 30 | determine_packages, |
85 | 31 | load_iovisor, | 31 | load_iovisor, |
86 | @@ -34,6 +34,8 @@ | |||
87 | 34 | add_lcm_key, | 34 | add_lcm_key, |
88 | 35 | fabric_interface_changed, | 35 | fabric_interface_changed, |
89 | 36 | load_iptables, | 36 | load_iptables, |
90 | 37 | restart_on_change, | ||
91 | 38 | director_cluster_ready | ||
92 | 37 | ) | 39 | ) |
93 | 38 | 40 | ||
94 | 39 | hooks = Hooks() | 41 | hooks = Hooks() |
95 | @@ -56,18 +58,16 @@ | |||
96 | 56 | add_lcm_key() | 58 | add_lcm_key() |
97 | 57 | 59 | ||
98 | 58 | 60 | ||
99 | 59 | @hooks.hook('plumgrid-relation-joined') | ||
100 | 60 | @hooks.hook('plumgrid-relation-changed') | 61 | @hooks.hook('plumgrid-relation-changed') |
102 | 61 | def plumgrid_joined(): | 62 | @restart_on_change(restart_map()) |
103 | 63 | def plumgrid_changed(): | ||
104 | 62 | ''' | 64 | ''' |
105 | 63 | This hook is run when relation between plumgrid-gateway and | 65 | This hook is run when relation between plumgrid-gateway and |
106 | 64 | plumgrid-director is made. | 66 | plumgrid-director is made. |
107 | 65 | ''' | 67 | ''' |
113 | 66 | ensure_mtu() | 68 | if director_cluster_ready(): |
114 | 67 | ensure_files() | 69 | ensure_mtu() |
115 | 68 | add_lcm_key() | 70 | CONFIGS.write_all() |
111 | 69 | CONFIGS.write_all() | ||
112 | 70 | restart_pg() | ||
116 | 71 | 71 | ||
117 | 72 | 72 | ||
118 | 73 | @hooks.hook('config-changed') | 73 | @hooks.hook('config-changed') |
119 | @@ -105,12 +105,10 @@ | |||
120 | 105 | 105 | ||
121 | 106 | 106 | ||
122 | 107 | @hooks.hook('upgrade-charm') | 107 | @hooks.hook('upgrade-charm') |
123 | 108 | @restart_on_change(restart_map()) | ||
124 | 108 | def upgrade_charm(): | 109 | def upgrade_charm(): |
125 | 109 | load_iptables() | ||
126 | 110 | ensure_mtu() | 110 | ensure_mtu() |
127 | 111 | ensure_files() | ||
128 | 112 | CONFIGS.write_all() | 111 | CONFIGS.write_all() |
129 | 113 | restart_pg() | ||
130 | 114 | 112 | ||
131 | 115 | 113 | ||
132 | 116 | @hooks.hook('stop') | 114 | @hooks.hook('stop') |
133 | @@ -119,10 +117,6 @@ | |||
134 | 119 | This hook is run when the charm is destroyed. | 117 | This hook is run when the charm is destroyed. |
135 | 120 | ''' | 118 | ''' |
136 | 121 | stop_pg() | 119 | stop_pg() |
137 | 122 | remove_iovisor() | ||
138 | 123 | pkgs = determine_packages() | ||
139 | 124 | for pkg in pkgs: | ||
140 | 125 | apt_purge(pkg, fatal=False) | ||
141 | 126 | 120 | ||
142 | 127 | 121 | ||
143 | 128 | def main(): | 122 | def main(): |
144 | 129 | 123 | ||
145 | === modified file 'hooks/pg_gw_utils.py' | |||
146 | --- hooks/pg_gw_utils.py 2016-03-21 18:46:01 +0000 | |||
147 | +++ hooks/pg_gw_utils.py 2016-03-27 15:36:55 +0000 | |||
148 | @@ -12,7 +12,6 @@ | |||
149 | 12 | from copy import deepcopy | 12 | from copy import deepcopy |
150 | 13 | from charmhelpers.contrib.openstack.neutron import neutron_plugin_attribute | 13 | from charmhelpers.contrib.openstack.neutron import neutron_plugin_attribute |
151 | 14 | from charmhelpers.contrib.storage.linux.ceph import modprobe | 14 | from charmhelpers.contrib.storage.linux.ceph import modprobe |
152 | 15 | from charmhelpers.core.host import set_nic_mtu | ||
153 | 16 | from charmhelpers.contrib.openstack import templating | 15 | from charmhelpers.contrib.openstack import templating |
154 | 17 | from charmhelpers.core.hookenv import ( | 16 | from charmhelpers.core.hookenv import ( |
155 | 18 | log, | 17 | log, |
156 | @@ -30,7 +29,9 @@ | |||
157 | 30 | write_file, | 29 | write_file, |
158 | 31 | service_start, | 30 | service_start, |
159 | 32 | service_stop, | 31 | service_stop, |
161 | 33 | service_running | 32 | service_running, |
162 | 33 | path_hash, | ||
163 | 34 | set_nic_mtu | ||
164 | 34 | ) | 35 | ) |
165 | 35 | from charmhelpers.fetch import ( | 36 | from charmhelpers.fetch import ( |
166 | 36 | apt_cache, | 37 | apt_cache, |
167 | @@ -47,6 +48,7 @@ | |||
168 | 47 | PG_HN_CONF = '%s/conf/etc/hostname' % PG_LXC_DATA_PATH | 48 | PG_HN_CONF = '%s/conf/etc/hostname' % PG_LXC_DATA_PATH |
169 | 48 | PG_HS_CONF = '%s/conf/etc/hosts' % PG_LXC_DATA_PATH | 49 | PG_HS_CONF = '%s/conf/etc/hosts' % PG_LXC_DATA_PATH |
170 | 49 | PG_IFCS_CONF = '%s/conf/pg/ifcs.conf' % PG_LXC_DATA_PATH | 50 | PG_IFCS_CONF = '%s/conf/pg/ifcs.conf' % PG_LXC_DATA_PATH |
171 | 51 | OPS_CONF = '%s/conf/etc/00-pg.conf' % PG_LXC_DATA_PATH | ||
172 | 50 | AUTH_KEY_PATH = '%s/root/.ssh/authorized_keys' % PG_LXC_DATA_PATH | 52 | AUTH_KEY_PATH = '%s/root/.ssh/authorized_keys' % PG_LXC_DATA_PATH |
173 | 51 | IFC_LIST_GW = '/var/run/plumgrid/lxc/ifc_list_gateway' | 53 | IFC_LIST_GW = '/var/run/plumgrid/lxc/ifc_list_gateway' |
174 | 52 | SUDOERS_CONF = '/etc/sudoers.d/ifc_ctl_sudoers' | 54 | SUDOERS_CONF = '/etc/sudoers.d/ifc_ctl_sudoers' |
175 | @@ -64,6 +66,10 @@ | |||
176 | 64 | 'services': ['plumgrid'], | 66 | 'services': ['plumgrid'], |
177 | 65 | 'contexts': [pg_gw_context.PGGwContext()], | 67 | 'contexts': [pg_gw_context.PGGwContext()], |
178 | 66 | }), | 68 | }), |
179 | 69 | (OPS_CONF, { | ||
180 | 70 | 'services': ['plumgrid'], | ||
181 | 71 | 'contexts': [pg_gw_context.PGGwContext()], | ||
182 | 72 | }), | ||
183 | 67 | (PG_IFCS_CONF, { | 73 | (PG_IFCS_CONF, { |
184 | 68 | 'services': [], | 74 | 'services': [], |
185 | 69 | 'contexts': [pg_gw_context.PGGwContext()], | 75 | 'contexts': [pg_gw_context.PGGwContext()], |
186 | @@ -161,7 +167,7 @@ | |||
187 | 161 | Stops PLUMgrid service. | 167 | Stops PLUMgrid service. |
188 | 162 | ''' | 168 | ''' |
189 | 163 | service_stop('plumgrid') | 169 | service_stop('plumgrid') |
191 | 164 | time.sleep(30) | 170 | time.sleep(2) |
192 | 165 | 171 | ||
193 | 166 | 172 | ||
194 | 167 | def load_iovisor(): | 173 | def load_iovisor(): |
195 | @@ -380,3 +386,24 @@ | |||
196 | 380 | return None | 386 | return None |
197 | 381 | else: | 387 | else: |
198 | 382 | return None | 388 | return None |
199 | 389 | |||
200 | 390 | |||
201 | 391 | def director_cluster_ready(): | ||
202 | 392 | dirs_count = len(pg_gw_context._pg_dir_context()['director_ips']) | ||
203 | 393 | return True if dirs_count == 1 or dirs_count == 3 else False | ||
204 | 394 | |||
205 | 395 | |||
206 | 396 | def restart_on_change(restart_map): | ||
207 | 397 | """ | ||
208 | 398 | Restart services based on configuration files changing | ||
209 | 399 | """ | ||
210 | 400 | def wrap(f): | ||
211 | 401 | def wrapped_f(*args, **kwargs): | ||
212 | 402 | checksums = {path: path_hash(path) for path in restart_map} | ||
213 | 403 | f(*args, **kwargs) | ||
214 | 404 | for path in restart_map: | ||
215 | 405 | if path_hash(path) != checksums[path]: | ||
216 | 406 | restart_pg() | ||
217 | 407 | break | ||
218 | 408 | return wrapped_f | ||
219 | 409 | return wrap | ||
220 | 383 | 410 | ||
221 | === removed symlink 'hooks/plumgrid-relation-joined' | |||
222 | === target was u'pg_gw_hooks.py' | |||
223 | === added file 'templates/kilo/00-pg.conf' | |||
224 | --- templates/kilo/00-pg.conf 1970-01-01 00:00:00 +0000 | |||
225 | +++ templates/kilo/00-pg.conf 2016-03-27 15:36:55 +0000 | |||
226 | @@ -0,0 +1,1 @@ | |||
227 | 1 | $template ls_json,"{{'{'}}{{'%'}}timestamp:::date-rfc3339,jsonf:@timestamp%,%source:::jsonf:@source_host%,%msg:::json%}":syslogtag,isequal,"pg:" @{{ opsvm_ip }}:6000;ls_json | ||
228 | 0 | 2 | ||
229 | === modified file 'templates/kilo/plumgrid.conf' | |||
230 | --- templates/kilo/plumgrid.conf 2015-07-29 18:23:55 +0000 | |||
231 | +++ templates/kilo/plumgrid.conf 2016-03-27 15:36:55 +0000 | |||
232 | @@ -1,4 +1,4 @@ | |||
234 | 1 | plumgrid_ip={{ local_ip }} | 1 | plumgrid_ip={{ director_ips_string }} |
235 | 2 | plumgrid_port=8001 | 2 | plumgrid_port=8001 |
236 | 3 | mgmt_dev={{ interface }} | 3 | mgmt_dev={{ interface }} |
237 | 4 | label={{ label}} | 4 | label={{ label}} |
238 | 5 | 5 | ||
239 | === modified file 'unit_tests/test_pg_gw_context.py' | |||
240 | --- unit_tests/test_pg_gw_context.py 2016-03-12 21:55:39 +0000 | |||
241 | +++ unit_tests/test_pg_gw_context.py 2016-03-27 15:36:55 +0000 | |||
242 | @@ -35,14 +35,14 @@ | |||
243 | 35 | @patch.object(charmhelpers.contrib.openstack.context, | 35 | @patch.object(charmhelpers.contrib.openstack.context, |
244 | 36 | 'config_flags_parser') | 36 | 'config_flags_parser') |
245 | 37 | @patch.object(context.PGGwContext, '_save_flag_file') | 37 | @patch.object(context.PGGwContext, '_save_flag_file') |
247 | 38 | @patch.object(context, '_pg_dir_settings') | 38 | @patch.object(context, '_pg_dir_context') |
248 | 39 | @patch.object(charmhelpers.contrib.openstack.context, | 39 | @patch.object(charmhelpers.contrib.openstack.context, |
249 | 40 | 'neutron_plugin_attribute') | 40 | 'neutron_plugin_attribute') |
250 | 41 | @patch.object(utils, 'get_mgmt_interface') | 41 | @patch.object(utils, 'get_mgmt_interface') |
251 | 42 | @patch.object(utils, 'get_fabric_interface') | 42 | @patch.object(utils, 'get_fabric_interface') |
252 | 43 | @patch.object(utils, 'get_gw_interfaces') | 43 | @patch.object(utils, 'get_gw_interfaces') |
253 | 44 | def test_neutroncc_context_api_rel(self, _gw_int, _fabric_int, | 44 | def test_neutroncc_context_api_rel(self, _gw_int, _fabric_int, |
255 | 45 | _mgmt_int, _npa, _pg_dir_settings, | 45 | _mgmt_int, _npa, _pg_dir_context, |
256 | 46 | _save_flag_file, _config_flag, | 46 | _save_flag_file, _config_flag, |
257 | 47 | _unit_get, _unit_priv_ip, _config, | 47 | _unit_get, _unit_priv_ip, _config, |
258 | 48 | _is_clus, _https, _ens_pkgs): | 48 | _is_clus, _https, _ens_pkgs): |
259 | @@ -54,13 +54,14 @@ | |||
260 | 54 | 54 | ||
261 | 55 | self.maxDiff = None | 55 | self.maxDiff = None |
262 | 56 | _npa.side_effect = mock_npa | 56 | _npa.side_effect = mock_npa |
265 | 57 | _unit_get.return_value = '192.168.100.201' | 57 | _unit_get.return_value = '192.168.100.203' |
266 | 58 | _unit_priv_ip.return_value = '192.168.100.201' | 58 | _unit_priv_ip.return_value = '192.168.100.203' |
267 | 59 | self.gethostname.return_value = 'node0' | 59 | self.gethostname.return_value = 'node0' |
268 | 60 | self.getfqdn.return_value = 'node0' | 60 | self.getfqdn.return_value = 'node0' |
269 | 61 | _is_clus.return_value = False | 61 | _is_clus.return_value = False |
270 | 62 | _config_flag.return_value = False | 62 | _config_flag.return_value = False |
272 | 63 | _pg_dir_settings.return_value = {'pg_dir_ip': '192.168.100.201'} | 63 | _pg_dir_context.return_value = {'director_ips': ['192.168.100.201'], |
273 | 64 | 'opsvm_ip': '127.0.0.1'} | ||
274 | 64 | _mgmt_int.return_value = 'juju-br0' | 65 | _mgmt_int.return_value = 'juju-br0' |
275 | 65 | _fabric_int.return_value = 'juju-br0' | 66 | _fabric_int.return_value = 'juju-br0' |
276 | 66 | _gw_int.return_value = ['eth1'] | 67 | _gw_int.return_value = ['eth1'] |
277 | @@ -69,11 +70,12 @@ | |||
278 | 69 | 'ext_interfaces': ['eth1'], | 70 | 'ext_interfaces': ['eth1'], |
279 | 70 | 'config': 'neutron.randomconfig', | 71 | 'config': 'neutron.randomconfig', |
280 | 71 | 'core_plugin': 'neutron.randomdriver', | 72 | 'core_plugin': 'neutron.randomdriver', |
282 | 72 | 'local_ip': 'pg_dir_ip', | 73 | 'local_ip': '192.168.100.203', |
283 | 74 | 'director_ips_string': '192.168.100.201', | ||
284 | 73 | 'network_manager': 'neutron', | 75 | 'network_manager': 'neutron', |
285 | 74 | 'neutron_plugin': 'plumgrid', | 76 | 'neutron_plugin': 'plumgrid', |
286 | 75 | 'neutron_security_groups': None, | 77 | 'neutron_security_groups': None, |
288 | 76 | 'neutron_url': 'https://192.168.100.201:9696', | 78 | 'neutron_url': 'https://192.168.100.203:9696', |
289 | 77 | 'pg_hostname': 'node0', | 79 | 'pg_hostname': 'node0', |
290 | 78 | 'pg_fqdn': 'node0', | 80 | 'pg_fqdn': 'node0', |
291 | 79 | 'interface': 'juju-br0', | 81 | 'interface': 'juju-br0', |
292 | @@ -81,5 +83,6 @@ | |||
293 | 81 | 'label': 'node0', | 83 | 'label': 'node0', |
294 | 82 | 'fabric_mode': 'host', | 84 | 'fabric_mode': 'host', |
295 | 83 | 'neutron_alchemy_flags': False, | 85 | 'neutron_alchemy_flags': False, |
296 | 86 | 'opsvm_ip': '127.0.0.1', | ||
297 | 84 | } | 87 | } |
298 | 85 | self.assertEquals(expect, napi_ctxt()) | 88 | self.assertEquals(expect, napi_ctxt()) |
299 | 86 | 89 | ||
300 | === modified file 'unit_tests/test_pg_gw_hooks.py' | |||
301 | --- unit_tests/test_pg_gw_hooks.py 2016-03-24 13:12:00 +0000 | |||
302 | +++ unit_tests/test_pg_gw_hooks.py 2016-03-27 15:36:55 +0000 | |||
303 | @@ -30,7 +30,8 @@ | |||
304 | 30 | 'ensure_mtu', | 30 | 'ensure_mtu', |
305 | 31 | 'add_lcm_key', | 31 | 'add_lcm_key', |
306 | 32 | 'determine_packages', | 32 | 'determine_packages', |
308 | 33 | 'load_iptables' | 33 | 'load_iptables', |
309 | 34 | 'director_cluster_ready' | ||
310 | 34 | ] | 35 | ] |
311 | 35 | NEUTRON_CONF_DIR = "/etc/neutron" | 36 | NEUTRON_CONF_DIR = "/etc/neutron" |
312 | 36 | 37 | ||
313 | @@ -62,17 +63,12 @@ | |||
314 | 62 | self.ensure_files.assert_called_with() | 63 | self.ensure_files.assert_called_with() |
315 | 63 | self.add_lcm_key.assert_called_with() | 64 | self.add_lcm_key.assert_called_with() |
316 | 64 | 65 | ||
319 | 65 | def test_plumgrid_joined(self): | 66 | def test_plumgrid_changed(self): |
320 | 66 | self._call_hook('plumgrid-relation-joined') | 67 | self._call_hook('plumgrid-relation-changed') |
321 | 68 | self.director_cluster_ready.return_value = True | ||
322 | 67 | self.ensure_mtu.assert_called_with() | 69 | self.ensure_mtu.assert_called_with() |
323 | 68 | self.ensure_files.assert_called_with() | ||
324 | 69 | self.add_lcm_key.assert_called_with() | ||
325 | 70 | self.CONFIGS.write_all.assert_called_with() | 70 | self.CONFIGS.write_all.assert_called_with() |
326 | 71 | self.restart_pg.assert_called_with() | ||
327 | 72 | 71 | ||
328 | 73 | def test_stop(self): | 72 | def test_stop(self): |
329 | 74 | _pkgs = ['plumgrid-lxc', 'iovisor-dkms'] | ||
330 | 75 | self._call_hook('stop') | 73 | self._call_hook('stop') |
331 | 76 | self.stop_pg.assert_called_with() | 74 | self.stop_pg.assert_called_with() |
332 | 77 | self.remove_iovisor.assert_called_with() | ||
333 | 78 | self.determine_packages.return_value = _pkgs | ||
334 | 79 | 75 | ||
335 | === modified file 'unit_tests/test_pg_gw_utils.py' | |||
336 | --- unit_tests/test_pg_gw_utils.py 2015-08-24 16:24:20 +0000 | |||
337 | +++ unit_tests/test_pg_gw_utils.py 2016-03-27 15:36:55 +0000 | |||
338 | @@ -53,7 +53,8 @@ | |||
339 | 53 | confs = [nutils.PG_CONF, | 53 | confs = [nutils.PG_CONF, |
340 | 54 | nutils.PG_HN_CONF, | 54 | nutils.PG_HN_CONF, |
341 | 55 | nutils.PG_HS_CONF, | 55 | nutils.PG_HS_CONF, |
343 | 56 | nutils.PG_IFCS_CONF] | 56 | nutils.PG_IFCS_CONF, |
344 | 57 | nutils.OPS_CONF] | ||
345 | 57 | self.assertItemsEqual(_regconfs.configs, confs) | 58 | self.assertItemsEqual(_regconfs.configs, confs) |
346 | 58 | 59 | ||
347 | 59 | def test_resource_map(self): | 60 | def test_resource_map(self): |
348 | @@ -69,6 +70,7 @@ | |||
349 | 69 | (nutils.PG_CONF, ['plumgrid']), | 70 | (nutils.PG_CONF, ['plumgrid']), |
350 | 70 | (nutils.PG_HN_CONF, ['plumgrid']), | 71 | (nutils.PG_HN_CONF, ['plumgrid']), |
351 | 71 | (nutils.PG_HS_CONF, ['plumgrid']), | 72 | (nutils.PG_HS_CONF, ['plumgrid']), |
352 | 73 | (nutils.OPS_CONF, ['plumgrid']), | ||
353 | 72 | (nutils.PG_IFCS_CONF, []), | 74 | (nutils.PG_IFCS_CONF, []), |
354 | 73 | ]) | 75 | ]) |
355 | 74 | self.assertEqual(expect, _restart_map) | 76 | self.assertEqual(expect, _restart_map) |
Looks good functionally.