Merge lp:~gnuoy/charms/trusty/nova-compute/hugepage-sub-trigger into lp:~openstack-charmers-archive/charms/trusty/nova-compute/next

Proposed by Liam Young
Status: Merged
Merged at revision: 184
Proposed branch: lp:~gnuoy/charms/trusty/nova-compute/hugepage-sub-trigger
Merge into: lp:~openstack-charmers-archive/charms/trusty/nova-compute/next
Diff against target: 123 lines (+36/-15)
3 files modified
hooks/nova_compute_hooks.py (+10/-0)
hooks/nova_compute_utils.py (+17/-12)
unit_tests/test_nova_compute_hooks.py (+9/-3)
To merge this branch: bzr merge lp:~gnuoy/charms/trusty/nova-compute/hugepage-sub-trigger
Reviewer Review Type Date Requested Status
James Page Approve
Review via email: mp+278817@code.launchpad.net

Description of the change

This change sets the requests hugepage value down the relation with the neutron plugin subordinate charm. The reason for this is so that the subordinate can react to a change in that value and restart any services. This is a feature that was requested by cisco for the cisco-vpp charm

To post a comment you must log in.
Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #14477 nova-compute-next for gnuoy mp278817
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/14477/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #13496 nova-compute-next for gnuoy mp278817
    UNIT FAIL: unit-test failed

UNIT Results (max last 2 lines):
make: *** [test] Error 1
ERROR:root:Make target returned non-zero.

Full unit test output: http://paste.ubuntu.com/13526567/
Build: http://10.245.162.77:8080/job/charm_unit_test/13496/

185. By Liam Young

Fix unit test

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #8040 nova-compute-next for gnuoy mp278817
    AMULET FAIL: amulet-test failed

AMULET Results (max last 2 lines):
make: *** [functional_test] Error 1
ERROR:root:Make target returned non-zero.

Full amulet test output: http://paste.ubuntu.com/13527056/
Build: http://10.245.162.77:8080/job/charm_amulet_test/8040/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #14478 nova-compute-next for gnuoy mp278817
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/14478/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #13497 nova-compute-next for gnuoy mp278817
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/13497/

Revision history for this message
James Page (james-page) wrote :

Aside from the amulet test failure this looks OK to me; please remedy as required.

review: Approve
Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #8041 nova-compute-next for gnuoy mp278817
    AMULET FAIL: amulet-test failed

AMULET Results (max last 2 lines):
make: *** [functional_test] Error 1
ERROR:root:Make target returned non-zero.

Full amulet test output: http://paste.ubuntu.com/13528847/
Build: http://10.245.162.77:8080/job/charm_amulet_test/8041/

Revision history for this message
Liam Young (gnuoy) wrote :

Both amulet fails look unrelated to this branch. Both are deployments timeouts which look to me to be issues with the testing infrastructure.

Revision history for this message
Ryan Beisner (1chb1n) wrote :

Indeed, 1 instance/unit didn't come up in the amulet test.

2 pending 172.17.104.135 b78bcaf9-94ab-49b6-8e9d-0385e21ab05a wily arch=amd64 cpu-cores=1 mem=1536M root-disk=10240M availability-zone=nova

Rerunning...

Revision history for this message
James Page (james-page) :
review: Approve
Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #8065 nova-compute-next for gnuoy mp278817
    AMULET FAIL: amulet-test failed

AMULET Results (max last 2 lines):
make: *** [functional_test] Error 1
ERROR:root:Make target returned non-zero.

Full amulet test output: http://paste.ubuntu.com/13600756/
Build: http://10.245.162.77:8080/job/charm_amulet_test/8065/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/nova_compute_hooks.py'
2--- hooks/nova_compute_hooks.py 2015-11-16 14:39:46 +0000
3+++ hooks/nova_compute_hooks.py 2015-11-27 14:39:23 +0000
4@@ -70,6 +70,7 @@
5 install_hugepages,
6 REQUIRED_INTERFACES,
7 check_optional_relations,
8+ get_hugepage_number,
9 )
10
11 from charmhelpers.contrib.network.ip import (
12@@ -149,6 +150,9 @@
13 for rid in relation_ids('zeromq-configuration'):
14 zeromq_configuration_relation_joined(rid)
15
16+ for rid in relation_ids('neutron-plugin'):
17+ neutron_plugin_joined(rid)
18+
19 if is_relation_made("nrpe-external-master"):
20 update_nrpe_config()
21
22@@ -377,6 +381,12 @@
23 nrpe_setup.write()
24
25
26+@hooks.hook('neutron-plugin-relation-joined')
27+def neutron_plugin_joined(relid=None):
28+ relation_set(relation_id=relid,
29+ hugepage_number=get_hugepage_number())
30+
31+
32 @hooks.hook('neutron-plugin-relation-changed')
33 @restart_on_change(restart_map())
34 def neutron_plugin_changed():
35
36=== modified file 'hooks/nova_compute_utils.py'
37--- hooks/nova_compute_utils.py 2015-10-30 05:49:18 +0000
38+++ hooks/nova_compute_utils.py 2015-11-27 14:39:23 +0000
39@@ -802,27 +802,32 @@
40 apt_install(LATE_GIT_PACKAGES, fatal=True)
41
42
43+def get_hugepage_number():
44+ # TODO: defaults to 2M - this should probably be configurable
45+ # and support multiple pool sizes - e.g. 2M and 1G.
46+ hugepage_size = 2048
47+ hugepage_config = config('hugepages')
48+ if hugepage_config.endswith('%'):
49+ import psutil
50+ mem = psutil.virtual_memory()
51+ hugepage_config_pct = hugepage_config.strip('%')
52+ hugepage_multiplier = float(hugepage_config_pct) / 100
53+ hugepages = int((mem.total * hugepage_multiplier) / hugepage_size)
54+ else:
55+ hugepages = int(hugepage_config)
56+ return hugepages
57+
58+
59 def install_hugepages():
60 """ Configure hugepages """
61 hugepage_config = config('hugepages')
62 if hugepage_config:
63- # TODO: defaults to 2M - this should probably be configurable
64- # and support multiple pool sizes - e.g. 2M and 1G.
65- hugepage_size = 2048
66- if hugepage_config.endswith('%'):
67- import psutil
68- mem = psutil.virtual_memory()
69- hugepage_config_pct = hugepage_config.strip('%')
70- hugepage_multiplier = float(hugepage_config_pct) / 100
71- hugepages = int((mem.total * hugepage_multiplier) / hugepage_size)
72- else:
73- hugepages = int(hugepage_config)
74 mnt_point = '/run/hugepages/kvm'
75 hugepage_support(
76 'nova',
77 mnt_point=mnt_point,
78 group='root',
79- nr_hugepages=hugepages,
80+ nr_hugepages=get_hugepage_number(),
81 mount=False,
82 set_shmmax=True,
83 )
84
85=== modified file 'unit_tests/test_nova_compute_hooks.py'
86--- unit_tests/test_nova_compute_hooks.py 2015-10-06 16:58:22 +0000
87+++ unit_tests/test_nova_compute_hooks.py 2015-11-27 14:39:23 +0000
88@@ -124,8 +124,10 @@
89 hooks.config_changed()
90 self.assertFalse(self.do_openstack_upgrade.called)
91
92+ @patch.object(hooks, 'neutron_plugin_joined')
93 @patch.object(hooks, 'compute_joined')
94- def test_config_changed_with_migration(self, compute_joined):
95+ def test_config_changed_with_migration(self, compute_joined,
96+ neutron_plugin_joined):
97 self.git_install_requested.return_value = False
98 self.migration_enabled.return_value = True
99 _zmq_joined = self.patch('zeromq_configuration_relation_joined')
100@@ -143,8 +145,10 @@
101 self.assertTrue(self.initialize_ssh_keys.called)
102 self.assertTrue(_zmq_joined.called)
103
104+ @patch.object(hooks, 'neutron_plugin_joined')
105 @patch.object(hooks, 'compute_joined')
106- def test_config_changed_with_resize(self, compute_joined):
107+ def test_config_changed_with_resize(self, compute_joined,
108+ neutron_plugin_joined):
109 self.git_install_requested.return_value = False
110 self.test_config.set('enable-resize', True)
111 _zmq_joined = self.patch('zeromq_configuration_relation_joined')
112@@ -162,8 +166,10 @@
113 self.enable_shell.assert_called_with(user='nova')
114 self.assertTrue(_zmq_joined.called)
115
116+ @patch.object(hooks, 'neutron_plugin_joined')
117 @patch.object(hooks, 'compute_joined')
118- def test_config_changed_without_resize(self, compute_joined):
119+ def test_config_changed_without_resize(self, compute_joined,
120+ neutron_plugin_joined):
121 self.git_install_requested.return_value = False
122 self.test_config.set('enable-resize', False)
123 _zmq_joined = self.patch('zeromq_configuration_relation_joined')

Subscribers

People subscribed via source and target branches