Merge lp:~james-page/charms/trusty/nova-cloud-controller/lp1531102-trunk into lp:~openstack-charmers-archive/charms/trusty/nova-cloud-controller/trunk
- Trusty Tahr (14.04)
- lp1531102-trunk
- Merge into trunk
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 172 | ||||
Proposed branch: | lp:~james-page/charms/trusty/nova-cloud-controller/lp1531102-trunk | ||||
Merge into: | lp:~openstack-charmers-archive/charms/trusty/nova-cloud-controller/trunk | ||||
Diff against target: |
670 lines (+292/-42) 9 files modified
hooks/charmhelpers/contrib/openstack/amulet/deployment.py (+100/-1) hooks/charmhelpers/contrib/openstack/amulet/utils.py (+25/-3) hooks/charmhelpers/contrib/openstack/context.py (+25/-9) hooks/charmhelpers/contrib/openstack/neutron.py (+14/-0) hooks/charmhelpers/contrib/openstack/utils.py (+22/-17) hooks/charmhelpers/core/host.py (+12/-1) hooks/charmhelpers/core/hugepage.py (+2/-0) tests/charmhelpers/contrib/openstack/amulet/deployment.py (+67/-8) tests/charmhelpers/contrib/openstack/amulet/utils.py (+25/-3) |
||||
To merge this branch: | bzr merge lp:~james-page/charms/trusty/nova-cloud-controller/lp1531102-trunk | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
OpenStack Charmers | Pending | ||
Review via email: mp+281867@code.launchpad.net |
Commit message
Resync helpers
Description of the change
Resync stable helpers to fixup issues with liberty point releases.
uosci-testing-bot (uosci-testing-bot) wrote : | # |
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #15639 nova-cloud-
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #8558 nova-cloud-
AMULET FAIL: amulet-test failed
AMULET Results (max last 2 lines):
Timeout occurred (2700s), printing juju status.
ERROR:root:Make target returned non-zero.
Full amulet test output: http://
Build: http://
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #8709 nova-cloud-
AMULET OK: passed
Build: http://
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #8710 nova-cloud-
AMULET OK: passed
Build: http://
Preview Diff
1 | === modified file 'hooks/charmhelpers/contrib/openstack/amulet/deployment.py' | |||
2 | --- hooks/charmhelpers/contrib/openstack/amulet/deployment.py 2015-10-22 13:22:39 +0000 | |||
3 | +++ hooks/charmhelpers/contrib/openstack/amulet/deployment.py 2016-01-07 14:24:40 +0000 | |||
4 | @@ -14,12 +14,18 @@ | |||
5 | 14 | # You should have received a copy of the GNU Lesser General Public License | 14 | # You should have received a copy of the GNU Lesser General Public License |
6 | 15 | # along with charm-helpers. If not, see <http://www.gnu.org/licenses/>. | 15 | # along with charm-helpers. If not, see <http://www.gnu.org/licenses/>. |
7 | 16 | 16 | ||
8 | 17 | import logging | ||
9 | 18 | import re | ||
10 | 19 | import sys | ||
11 | 17 | import six | 20 | import six |
12 | 18 | from collections import OrderedDict | 21 | from collections import OrderedDict |
13 | 19 | from charmhelpers.contrib.amulet.deployment import ( | 22 | from charmhelpers.contrib.amulet.deployment import ( |
14 | 20 | AmuletDeployment | 23 | AmuletDeployment |
15 | 21 | ) | 24 | ) |
16 | 22 | 25 | ||
17 | 26 | DEBUG = logging.DEBUG | ||
18 | 27 | ERROR = logging.ERROR | ||
19 | 28 | |||
20 | 23 | 29 | ||
21 | 24 | class OpenStackAmuletDeployment(AmuletDeployment): | 30 | class OpenStackAmuletDeployment(AmuletDeployment): |
22 | 25 | """OpenStack amulet deployment. | 31 | """OpenStack amulet deployment. |
23 | @@ -28,9 +34,12 @@ | |||
24 | 28 | that is specifically for use by OpenStack charms. | 34 | that is specifically for use by OpenStack charms. |
25 | 29 | """ | 35 | """ |
26 | 30 | 36 | ||
28 | 31 | def __init__(self, series=None, openstack=None, source=None, stable=True): | 37 | def __init__(self, series=None, openstack=None, source=None, |
29 | 38 | stable=True, log_level=DEBUG): | ||
30 | 32 | """Initialize the deployment environment.""" | 39 | """Initialize the deployment environment.""" |
31 | 33 | super(OpenStackAmuletDeployment, self).__init__(series) | 40 | super(OpenStackAmuletDeployment, self).__init__(series) |
32 | 41 | self.log = self.get_logger(level=log_level) | ||
33 | 42 | self.log.info('OpenStackAmuletDeployment: init') | ||
34 | 34 | self.openstack = openstack | 43 | self.openstack = openstack |
35 | 35 | self.source = source | 44 | self.source = source |
36 | 36 | self.stable = stable | 45 | self.stable = stable |
37 | @@ -38,6 +47,22 @@ | |||
38 | 38 | # out. | 47 | # out. |
39 | 39 | self.current_next = "trusty" | 48 | self.current_next = "trusty" |
40 | 40 | 49 | ||
41 | 50 | def get_logger(self, name="deployment-logger", level=logging.DEBUG): | ||
42 | 51 | """Get a logger object that will log to stdout.""" | ||
43 | 52 | log = logging | ||
44 | 53 | logger = log.getLogger(name) | ||
45 | 54 | fmt = log.Formatter("%(asctime)s %(funcName)s " | ||
46 | 55 | "%(levelname)s: %(message)s") | ||
47 | 56 | |||
48 | 57 | handler = log.StreamHandler(stream=sys.stdout) | ||
49 | 58 | handler.setLevel(level) | ||
50 | 59 | handler.setFormatter(fmt) | ||
51 | 60 | |||
52 | 61 | logger.addHandler(handler) | ||
53 | 62 | logger.setLevel(level) | ||
54 | 63 | |||
55 | 64 | return logger | ||
56 | 65 | |||
57 | 41 | def _determine_branch_locations(self, other_services): | 66 | def _determine_branch_locations(self, other_services): |
58 | 42 | """Determine the branch locations for the other services. | 67 | """Determine the branch locations for the other services. |
59 | 43 | 68 | ||
60 | @@ -45,6 +70,8 @@ | |||
61 | 45 | stable or next (dev) branch, and based on this, use the corresonding | 70 | stable or next (dev) branch, and based on this, use the corresonding |
62 | 46 | stable or next branches for the other_services.""" | 71 | stable or next branches for the other_services.""" |
63 | 47 | 72 | ||
64 | 73 | self.log.info('OpenStackAmuletDeployment: determine branch locations') | ||
65 | 74 | |||
66 | 48 | # Charms outside the lp:~openstack-charmers namespace | 75 | # Charms outside the lp:~openstack-charmers namespace |
67 | 49 | base_charms = ['mysql', 'mongodb', 'nrpe'] | 76 | base_charms = ['mysql', 'mongodb', 'nrpe'] |
68 | 50 | 77 | ||
69 | @@ -82,6 +109,8 @@ | |||
70 | 82 | 109 | ||
71 | 83 | def _add_services(self, this_service, other_services): | 110 | def _add_services(self, this_service, other_services): |
72 | 84 | """Add services to the deployment and set openstack-origin/source.""" | 111 | """Add services to the deployment and set openstack-origin/source.""" |
73 | 112 | self.log.info('OpenStackAmuletDeployment: adding services') | ||
74 | 113 | |||
75 | 85 | other_services = self._determine_branch_locations(other_services) | 114 | other_services = self._determine_branch_locations(other_services) |
76 | 86 | 115 | ||
77 | 87 | super(OpenStackAmuletDeployment, self)._add_services(this_service, | 116 | super(OpenStackAmuletDeployment, self)._add_services(this_service, |
78 | @@ -111,9 +140,79 @@ | |||
79 | 111 | 140 | ||
80 | 112 | def _configure_services(self, configs): | 141 | def _configure_services(self, configs): |
81 | 113 | """Configure all of the services.""" | 142 | """Configure all of the services.""" |
82 | 143 | self.log.info('OpenStackAmuletDeployment: configure services') | ||
83 | 114 | for service, config in six.iteritems(configs): | 144 | for service, config in six.iteritems(configs): |
84 | 115 | self.d.configure(service, config) | 145 | self.d.configure(service, config) |
85 | 116 | 146 | ||
86 | 147 | def _auto_wait_for_status(self, message=None, exclude_services=None, | ||
87 | 148 | include_only=None, timeout=1800): | ||
88 | 149 | """Wait for all units to have a specific extended status, except | ||
89 | 150 | for any defined as excluded. Unless specified via message, any | ||
90 | 151 | status containing any case of 'ready' will be considered a match. | ||
91 | 152 | |||
92 | 153 | Examples of message usage: | ||
93 | 154 | |||
94 | 155 | Wait for all unit status to CONTAIN any case of 'ready' or 'ok': | ||
95 | 156 | message = re.compile('.*ready.*|.*ok.*', re.IGNORECASE) | ||
96 | 157 | |||
97 | 158 | Wait for all units to reach this status (exact match): | ||
98 | 159 | message = re.compile('^Unit is ready and clustered$') | ||
99 | 160 | |||
100 | 161 | Wait for all units to reach any one of these (exact match): | ||
101 | 162 | message = re.compile('Unit is ready|OK|Ready') | ||
102 | 163 | |||
103 | 164 | Wait for at least one unit to reach this status (exact match): | ||
104 | 165 | message = {'ready'} | ||
105 | 166 | |||
106 | 167 | See Amulet's sentry.wait_for_messages() for message usage detail. | ||
107 | 168 | https://github.com/juju/amulet/blob/master/amulet/sentry.py | ||
108 | 169 | |||
109 | 170 | :param message: Expected status match | ||
110 | 171 | :param exclude_services: List of juju service names to ignore, | ||
111 | 172 | not to be used in conjuction with include_only. | ||
112 | 173 | :param include_only: List of juju service names to exclusively check, | ||
113 | 174 | not to be used in conjuction with exclude_services. | ||
114 | 175 | :param timeout: Maximum time in seconds to wait for status match | ||
115 | 176 | :returns: None. Raises if timeout is hit. | ||
116 | 177 | """ | ||
117 | 178 | self.log.info('Waiting for extended status on units...') | ||
118 | 179 | |||
119 | 180 | all_services = self.d.services.keys() | ||
120 | 181 | |||
121 | 182 | if exclude_services and include_only: | ||
122 | 183 | raise ValueError('exclude_services can not be used ' | ||
123 | 184 | 'with include_only') | ||
124 | 185 | |||
125 | 186 | if message: | ||
126 | 187 | if isinstance(message, re._pattern_type): | ||
127 | 188 | match = message.pattern | ||
128 | 189 | else: | ||
129 | 190 | match = message | ||
130 | 191 | |||
131 | 192 | self.log.debug('Custom extended status wait match: ' | ||
132 | 193 | '{}'.format(match)) | ||
133 | 194 | else: | ||
134 | 195 | self.log.debug('Default extended status wait match: contains ' | ||
135 | 196 | 'READY (case-insensitive)') | ||
136 | 197 | message = re.compile('.*ready.*', re.IGNORECASE) | ||
137 | 198 | |||
138 | 199 | if exclude_services: | ||
139 | 200 | self.log.debug('Excluding services from extended status match: ' | ||
140 | 201 | '{}'.format(exclude_services)) | ||
141 | 202 | else: | ||
142 | 203 | exclude_services = [] | ||
143 | 204 | |||
144 | 205 | if include_only: | ||
145 | 206 | services = include_only | ||
146 | 207 | else: | ||
147 | 208 | services = list(set(all_services) - set(exclude_services)) | ||
148 | 209 | |||
149 | 210 | self.log.debug('Waiting up to {}s for extended status on services: ' | ||
150 | 211 | '{}'.format(timeout, services)) | ||
151 | 212 | service_messages = {service: message for service in services} | ||
152 | 213 | self.d.sentry.wait_for_messages(service_messages, timeout=timeout) | ||
153 | 214 | self.log.info('OK') | ||
154 | 215 | |||
155 | 117 | def _get_openstack_release(self): | 216 | def _get_openstack_release(self): |
156 | 118 | """Get openstack release. | 217 | """Get openstack release. |
157 | 119 | 218 | ||
158 | 120 | 219 | ||
159 | === modified file 'hooks/charmhelpers/contrib/openstack/amulet/utils.py' | |||
160 | --- hooks/charmhelpers/contrib/openstack/amulet/utils.py 2015-10-22 13:22:39 +0000 | |||
161 | +++ hooks/charmhelpers/contrib/openstack/amulet/utils.py 2016-01-07 14:24:40 +0000 | |||
162 | @@ -18,6 +18,7 @@ | |||
163 | 18 | import json | 18 | import json |
164 | 19 | import logging | 19 | import logging |
165 | 20 | import os | 20 | import os |
166 | 21 | import re | ||
167 | 21 | import six | 22 | import six |
168 | 22 | import time | 23 | import time |
169 | 23 | import urllib | 24 | import urllib |
170 | @@ -604,7 +605,22 @@ | |||
171 | 604 | '{}'.format(sample_type, samples)) | 605 | '{}'.format(sample_type, samples)) |
172 | 605 | return None | 606 | return None |
173 | 606 | 607 | ||
175 | 607 | # rabbitmq/amqp specific helpers: | 608 | # rabbitmq/amqp specific helpers: |
176 | 609 | |||
177 | 610 | def rmq_wait_for_cluster(self, deployment, init_sleep=15, timeout=1200): | ||
178 | 611 | """Wait for rmq units extended status to show cluster readiness, | ||
179 | 612 | after an optional initial sleep period. Initial sleep is likely | ||
180 | 613 | necessary to be effective following a config change, as status | ||
181 | 614 | message may not instantly update to non-ready.""" | ||
182 | 615 | |||
183 | 616 | if init_sleep: | ||
184 | 617 | time.sleep(init_sleep) | ||
185 | 618 | |||
186 | 619 | message = re.compile('^Unit is ready and clustered$') | ||
187 | 620 | deployment._auto_wait_for_status(message=message, | ||
188 | 621 | timeout=timeout, | ||
189 | 622 | include_only=['rabbitmq-server']) | ||
190 | 623 | |||
191 | 608 | def add_rmq_test_user(self, sentry_units, | 624 | def add_rmq_test_user(self, sentry_units, |
192 | 609 | username="testuser1", password="changeme"): | 625 | username="testuser1", password="changeme"): |
193 | 610 | """Add a test user via the first rmq juju unit, check connection as | 626 | """Add a test user via the first rmq juju unit, check connection as |
194 | @@ -805,7 +821,10 @@ | |||
195 | 805 | if port: | 821 | if port: |
196 | 806 | config['ssl_port'] = port | 822 | config['ssl_port'] = port |
197 | 807 | 823 | ||
199 | 808 | deployment.configure('rabbitmq-server', config) | 824 | deployment.d.configure('rabbitmq-server', config) |
200 | 825 | |||
201 | 826 | # Wait for unit status | ||
202 | 827 | self.rmq_wait_for_cluster(deployment) | ||
203 | 809 | 828 | ||
204 | 810 | # Confirm | 829 | # Confirm |
205 | 811 | tries = 0 | 830 | tries = 0 |
206 | @@ -832,7 +851,10 @@ | |||
207 | 832 | 851 | ||
208 | 833 | # Disable RMQ SSL | 852 | # Disable RMQ SSL |
209 | 834 | config = {'ssl': 'off'} | 853 | config = {'ssl': 'off'} |
211 | 835 | deployment.configure('rabbitmq-server', config) | 854 | deployment.d.configure('rabbitmq-server', config) |
212 | 855 | |||
213 | 856 | # Wait for unit status | ||
214 | 857 | self.rmq_wait_for_cluster(deployment) | ||
215 | 836 | 858 | ||
216 | 837 | # Confirm | 859 | # Confirm |
217 | 838 | tries = 0 | 860 | tries = 0 |
218 | 839 | 861 | ||
219 | === modified file 'hooks/charmhelpers/contrib/openstack/context.py' | |||
220 | --- hooks/charmhelpers/contrib/openstack/context.py 2015-10-22 13:22:39 +0000 | |||
221 | +++ hooks/charmhelpers/contrib/openstack/context.py 2016-01-07 14:24:40 +0000 | |||
222 | @@ -952,6 +952,19 @@ | |||
223 | 952 | 'config': config} | 952 | 'config': config} |
224 | 953 | return ovs_ctxt | 953 | return ovs_ctxt |
225 | 954 | 954 | ||
226 | 955 | def midonet_ctxt(self): | ||
227 | 956 | driver = neutron_plugin_attribute(self.plugin, 'driver', | ||
228 | 957 | self.network_manager) | ||
229 | 958 | midonet_config = neutron_plugin_attribute(self.plugin, 'config', | ||
230 | 959 | self.network_manager) | ||
231 | 960 | mido_ctxt = {'core_plugin': driver, | ||
232 | 961 | 'neutron_plugin': 'midonet', | ||
233 | 962 | 'neutron_security_groups': self.neutron_security_groups, | ||
234 | 963 | 'local_ip': unit_private_ip(), | ||
235 | 964 | 'config': midonet_config} | ||
236 | 965 | |||
237 | 966 | return mido_ctxt | ||
238 | 967 | |||
239 | 955 | def __call__(self): | 968 | def __call__(self): |
240 | 956 | if self.network_manager not in ['quantum', 'neutron']: | 969 | if self.network_manager not in ['quantum', 'neutron']: |
241 | 957 | return {} | 970 | return {} |
242 | @@ -973,6 +986,8 @@ | |||
243 | 973 | ctxt.update(self.nuage_ctxt()) | 986 | ctxt.update(self.nuage_ctxt()) |
244 | 974 | elif self.plugin == 'plumgrid': | 987 | elif self.plugin == 'plumgrid': |
245 | 975 | ctxt.update(self.pg_ctxt()) | 988 | ctxt.update(self.pg_ctxt()) |
246 | 989 | elif self.plugin == 'midonet': | ||
247 | 990 | ctxt.update(self.midonet_ctxt()) | ||
248 | 976 | 991 | ||
249 | 977 | alchemy_flags = config('neutron-alchemy-flags') | 992 | alchemy_flags = config('neutron-alchemy-flags') |
250 | 978 | if alchemy_flags: | 993 | if alchemy_flags: |
251 | @@ -1105,7 +1120,7 @@ | |||
252 | 1105 | 1120 | ||
253 | 1106 | ctxt = { | 1121 | ctxt = { |
254 | 1107 | ... other context ... | 1122 | ... other context ... |
256 | 1108 | 'subordinate_config': { | 1123 | 'subordinate_configuration': { |
257 | 1109 | 'DEFAULT': { | 1124 | 'DEFAULT': { |
258 | 1110 | 'key1': 'value1', | 1125 | 'key1': 'value1', |
259 | 1111 | }, | 1126 | }, |
260 | @@ -1146,22 +1161,23 @@ | |||
261 | 1146 | try: | 1161 | try: |
262 | 1147 | sub_config = json.loads(sub_config) | 1162 | sub_config = json.loads(sub_config) |
263 | 1148 | except: | 1163 | except: |
266 | 1149 | log('Could not parse JSON from subordinate_config ' | 1164 | log('Could not parse JSON from ' |
267 | 1150 | 'setting from %s' % rid, level=ERROR) | 1165 | 'subordinate_configuration setting from %s' |
268 | 1166 | % rid, level=ERROR) | ||
269 | 1151 | continue | 1167 | continue |
270 | 1152 | 1168 | ||
271 | 1153 | for service in self.services: | 1169 | for service in self.services: |
272 | 1154 | if service not in sub_config: | 1170 | if service not in sub_config: |
276 | 1155 | log('Found subordinate_config on %s but it contained' | 1171 | log('Found subordinate_configuration on %s but it ' |
277 | 1156 | 'nothing for %s service' % (rid, service), | 1172 | 'contained nothing for %s service' |
278 | 1157 | level=INFO) | 1173 | % (rid, service), level=INFO) |
279 | 1158 | continue | 1174 | continue |
280 | 1159 | 1175 | ||
281 | 1160 | sub_config = sub_config[service] | 1176 | sub_config = sub_config[service] |
282 | 1161 | if self.config_file not in sub_config: | 1177 | if self.config_file not in sub_config: |
286 | 1162 | log('Found subordinate_config on %s but it contained' | 1178 | log('Found subordinate_configuration on %s but it ' |
287 | 1163 | 'nothing for %s' % (rid, self.config_file), | 1179 | 'contained nothing for %s' |
288 | 1164 | level=INFO) | 1180 | % (rid, self.config_file), level=INFO) |
289 | 1165 | continue | 1181 | continue |
290 | 1166 | 1182 | ||
291 | 1167 | sub_config = sub_config[self.config_file] | 1183 | sub_config = sub_config[self.config_file] |
292 | 1168 | 1184 | ||
293 | === modified file 'hooks/charmhelpers/contrib/openstack/neutron.py' | |||
294 | --- hooks/charmhelpers/contrib/openstack/neutron.py 2015-10-22 13:22:39 +0000 | |||
295 | +++ hooks/charmhelpers/contrib/openstack/neutron.py 2016-01-07 14:24:40 +0000 | |||
296 | @@ -209,6 +209,20 @@ | |||
297 | 209 | 'server_packages': ['neutron-server', | 209 | 'server_packages': ['neutron-server', |
298 | 210 | 'neutron-plugin-plumgrid'], | 210 | 'neutron-plugin-plumgrid'], |
299 | 211 | 'server_services': ['neutron-server'] | 211 | 'server_services': ['neutron-server'] |
300 | 212 | }, | ||
301 | 213 | 'midonet': { | ||
302 | 214 | 'config': '/etc/neutron/plugins/midonet/midonet.ini', | ||
303 | 215 | 'driver': 'midonet.neutron.plugin.MidonetPluginV2', | ||
304 | 216 | 'contexts': [ | ||
305 | 217 | context.SharedDBContext(user=config('neutron-database-user'), | ||
306 | 218 | database=config('neutron-database'), | ||
307 | 219 | relation_prefix='neutron', | ||
308 | 220 | ssl_dir=NEUTRON_CONF_DIR)], | ||
309 | 221 | 'services': [], | ||
310 | 222 | 'packages': [[headers_package()] + determine_dkms_package()], | ||
311 | 223 | 'server_packages': ['neutron-server', | ||
312 | 224 | 'python-neutron-plugin-midonet'], | ||
313 | 225 | 'server_services': ['neutron-server'] | ||
314 | 212 | } | 226 | } |
315 | 213 | } | 227 | } |
316 | 214 | if release >= 'icehouse': | 228 | if release >= 'icehouse': |
317 | 215 | 229 | ||
318 | === modified file 'hooks/charmhelpers/contrib/openstack/utils.py' | |||
319 | --- hooks/charmhelpers/contrib/openstack/utils.py 2015-10-22 13:22:39 +0000 | |||
320 | +++ hooks/charmhelpers/contrib/openstack/utils.py 2016-01-07 14:24:40 +0000 | |||
321 | @@ -121,36 +121,37 @@ | |||
322 | 121 | ('2.2.2', 'kilo'), | 121 | ('2.2.2', 'kilo'), |
323 | 122 | ('2.3.0', 'liberty'), | 122 | ('2.3.0', 'liberty'), |
324 | 123 | ('2.4.0', 'liberty'), | 123 | ('2.4.0', 'liberty'), |
325 | 124 | ('2.5.0', 'liberty'), | ||
326 | 124 | ]) | 125 | ]) |
327 | 125 | 126 | ||
328 | 126 | # >= Liberty version->codename mapping | 127 | # >= Liberty version->codename mapping |
329 | 127 | PACKAGE_CODENAMES = { | 128 | PACKAGE_CODENAMES = { |
330 | 128 | 'nova-common': OrderedDict([ | 129 | 'nova-common': OrderedDict([ |
332 | 129 | ('12.0.0', 'liberty'), | 130 | ('12.0', 'liberty'), |
333 | 130 | ]), | 131 | ]), |
334 | 131 | 'neutron-common': OrderedDict([ | 132 | 'neutron-common': OrderedDict([ |
336 | 132 | ('7.0.0', 'liberty'), | 133 | ('7.0', 'liberty'), |
337 | 133 | ]), | 134 | ]), |
338 | 134 | 'cinder-common': OrderedDict([ | 135 | 'cinder-common': OrderedDict([ |
340 | 135 | ('7.0.0', 'liberty'), | 136 | ('7.0', 'liberty'), |
341 | 136 | ]), | 137 | ]), |
342 | 137 | 'keystone': OrderedDict([ | 138 | 'keystone': OrderedDict([ |
344 | 138 | ('8.0.0', 'liberty'), | 139 | ('8.0', 'liberty'), |
345 | 139 | ]), | 140 | ]), |
346 | 140 | 'horizon-common': OrderedDict([ | 141 | 'horizon-common': OrderedDict([ |
348 | 141 | ('8.0.0', 'liberty'), | 142 | ('8.0', 'liberty'), |
349 | 142 | ]), | 143 | ]), |
350 | 143 | 'ceilometer-common': OrderedDict([ | 144 | 'ceilometer-common': OrderedDict([ |
352 | 144 | ('5.0.0', 'liberty'), | 145 | ('5.0', 'liberty'), |
353 | 145 | ]), | 146 | ]), |
354 | 146 | 'heat-common': OrderedDict([ | 147 | 'heat-common': OrderedDict([ |
356 | 147 | ('5.0.0', 'liberty'), | 148 | ('5.0', 'liberty'), |
357 | 148 | ]), | 149 | ]), |
358 | 149 | 'glance-common': OrderedDict([ | 150 | 'glance-common': OrderedDict([ |
360 | 150 | ('11.0.0', 'liberty'), | 151 | ('11.0', 'liberty'), |
361 | 151 | ]), | 152 | ]), |
362 | 152 | 'openstack-dashboard': OrderedDict([ | 153 | 'openstack-dashboard': OrderedDict([ |
364 | 153 | ('8.0.0', 'liberty'), | 154 | ('8.0', 'liberty'), |
365 | 154 | ]), | 155 | ]), |
366 | 155 | } | 156 | } |
367 | 156 | 157 | ||
368 | @@ -237,7 +238,14 @@ | |||
369 | 237 | error_out(e) | 238 | error_out(e) |
370 | 238 | 239 | ||
371 | 239 | vers = apt.upstream_version(pkg.current_ver.ver_str) | 240 | vers = apt.upstream_version(pkg.current_ver.ver_str) |
373 | 240 | match = re.match('^(\d+)\.(\d+)\.(\d+)', vers) | 241 | if 'swift' in pkg.name: |
374 | 242 | # Fully x.y.z match for swift versions | ||
375 | 243 | match = re.match('^(\d+)\.(\d+)\.(\d+)', vers) | ||
376 | 244 | else: | ||
377 | 245 | # x.y match only for 20XX.X | ||
378 | 246 | # and ignore patch level for other packages | ||
379 | 247 | match = re.match('^(\d+)\.(\d+)', vers) | ||
380 | 248 | |||
381 | 241 | if match: | 249 | if match: |
382 | 242 | vers = match.group(0) | 250 | vers = match.group(0) |
383 | 243 | 251 | ||
384 | @@ -249,13 +257,8 @@ | |||
385 | 249 | # < Liberty co-ordinated project versions | 257 | # < Liberty co-ordinated project versions |
386 | 250 | try: | 258 | try: |
387 | 251 | if 'swift' in pkg.name: | 259 | if 'swift' in pkg.name: |
393 | 252 | swift_vers = vers[:5] | 260 | return SWIFT_CODENAMES[vers] |
389 | 253 | if swift_vers not in SWIFT_CODENAMES: | ||
390 | 254 | # Deal with 1.10.0 upward | ||
391 | 255 | swift_vers = vers[:6] | ||
392 | 256 | return SWIFT_CODENAMES[swift_vers] | ||
394 | 257 | else: | 261 | else: |
395 | 258 | vers = vers[:6] | ||
396 | 259 | return OPENSTACK_CODENAMES[vers] | 262 | return OPENSTACK_CODENAMES[vers] |
397 | 260 | except KeyError: | 263 | except KeyError: |
398 | 261 | if not fatal: | 264 | if not fatal: |
399 | @@ -858,7 +861,9 @@ | |||
400 | 858 | if charm_state != 'active' and charm_state != 'unknown': | 861 | if charm_state != 'active' and charm_state != 'unknown': |
401 | 859 | state = workload_state_compare(state, charm_state) | 862 | state = workload_state_compare(state, charm_state) |
402 | 860 | if message: | 863 | if message: |
404 | 861 | message = "{} {}".format(message, charm_message) | 864 | charm_message = charm_message.replace("Incomplete relations: ", |
405 | 865 | "") | ||
406 | 866 | message = "{}, {}".format(message, charm_message) | ||
407 | 862 | else: | 867 | else: |
408 | 863 | message = charm_message | 868 | message = charm_message |
409 | 864 | 869 | ||
410 | 865 | 870 | ||
411 | === modified file 'hooks/charmhelpers/core/host.py' | |||
412 | --- hooks/charmhelpers/core/host.py 2015-10-22 13:22:39 +0000 | |||
413 | +++ hooks/charmhelpers/core/host.py 2016-01-07 14:24:40 +0000 | |||
414 | @@ -566,7 +566,14 @@ | |||
415 | 566 | os.chdir(cur) | 566 | os.chdir(cur) |
416 | 567 | 567 | ||
417 | 568 | 568 | ||
419 | 569 | def chownr(path, owner, group, follow_links=True): | 569 | def chownr(path, owner, group, follow_links=True, chowntopdir=False): |
420 | 570 | """ | ||
421 | 571 | Recursively change user and group ownership of files and directories | ||
422 | 572 | in given path. Doesn't chown path itself by default, only its children. | ||
423 | 573 | |||
424 | 574 | :param bool follow_links: Also Chown links if True | ||
425 | 575 | :param bool chowntopdir: Also chown path itself if True | ||
426 | 576 | """ | ||
427 | 570 | uid = pwd.getpwnam(owner).pw_uid | 577 | uid = pwd.getpwnam(owner).pw_uid |
428 | 571 | gid = grp.getgrnam(group).gr_gid | 578 | gid = grp.getgrnam(group).gr_gid |
429 | 572 | if follow_links: | 579 | if follow_links: |
430 | @@ -574,6 +581,10 @@ | |||
431 | 574 | else: | 581 | else: |
432 | 575 | chown = os.lchown | 582 | chown = os.lchown |
433 | 576 | 583 | ||
434 | 584 | if chowntopdir: | ||
435 | 585 | broken_symlink = os.path.lexists(path) and not os.path.exists(path) | ||
436 | 586 | if not broken_symlink: | ||
437 | 587 | chown(path, uid, gid) | ||
438 | 577 | for root, dirs, files in os.walk(path): | 588 | for root, dirs, files in os.walk(path): |
439 | 578 | for name in dirs + files: | 589 | for name in dirs + files: |
440 | 579 | full = os.path.join(root, name) | 590 | full = os.path.join(root, name) |
441 | 580 | 591 | ||
442 | === modified file 'hooks/charmhelpers/core/hugepage.py' | |||
443 | --- hooks/charmhelpers/core/hugepage.py 2015-10-22 13:22:39 +0000 | |||
444 | +++ hooks/charmhelpers/core/hugepage.py 2016-01-07 14:24:40 +0000 | |||
445 | @@ -46,6 +46,8 @@ | |||
446 | 46 | group_info = add_group(group) | 46 | group_info = add_group(group) |
447 | 47 | gid = group_info.gr_gid | 47 | gid = group_info.gr_gid |
448 | 48 | add_user_to_group(user, group) | 48 | add_user_to_group(user, group) |
449 | 49 | if max_map_count < 2 * nr_hugepages: | ||
450 | 50 | max_map_count = 2 * nr_hugepages | ||
451 | 49 | sysctl_settings = { | 51 | sysctl_settings = { |
452 | 50 | 'vm.nr_hugepages': nr_hugepages, | 52 | 'vm.nr_hugepages': nr_hugepages, |
453 | 51 | 'vm.max_map_count': max_map_count, | 53 | 'vm.max_map_count': max_map_count, |
454 | 52 | 54 | ||
455 | === modified file 'tests/charmhelpers/contrib/openstack/amulet/deployment.py' | |||
456 | --- tests/charmhelpers/contrib/openstack/amulet/deployment.py 2015-10-22 13:22:39 +0000 | |||
457 | +++ tests/charmhelpers/contrib/openstack/amulet/deployment.py 2016-01-07 14:24:40 +0000 | |||
458 | @@ -14,13 +14,18 @@ | |||
459 | 14 | # You should have received a copy of the GNU Lesser General Public License | 14 | # You should have received a copy of the GNU Lesser General Public License |
460 | 15 | # along with charm-helpers. If not, see <http://www.gnu.org/licenses/>. | 15 | # along with charm-helpers. If not, see <http://www.gnu.org/licenses/>. |
461 | 16 | 16 | ||
462 | 17 | import logging | ||
463 | 17 | import re | 18 | import re |
464 | 19 | import sys | ||
465 | 18 | import six | 20 | import six |
466 | 19 | from collections import OrderedDict | 21 | from collections import OrderedDict |
467 | 20 | from charmhelpers.contrib.amulet.deployment import ( | 22 | from charmhelpers.contrib.amulet.deployment import ( |
468 | 21 | AmuletDeployment | 23 | AmuletDeployment |
469 | 22 | ) | 24 | ) |
470 | 23 | 25 | ||
471 | 26 | DEBUG = logging.DEBUG | ||
472 | 27 | ERROR = logging.ERROR | ||
473 | 28 | |||
474 | 24 | 29 | ||
475 | 25 | class OpenStackAmuletDeployment(AmuletDeployment): | 30 | class OpenStackAmuletDeployment(AmuletDeployment): |
476 | 26 | """OpenStack amulet deployment. | 31 | """OpenStack amulet deployment. |
477 | @@ -29,9 +34,12 @@ | |||
478 | 29 | that is specifically for use by OpenStack charms. | 34 | that is specifically for use by OpenStack charms. |
479 | 30 | """ | 35 | """ |
480 | 31 | 36 | ||
482 | 32 | def __init__(self, series=None, openstack=None, source=None, stable=True): | 37 | def __init__(self, series=None, openstack=None, source=None, |
483 | 38 | stable=True, log_level=DEBUG): | ||
484 | 33 | """Initialize the deployment environment.""" | 39 | """Initialize the deployment environment.""" |
485 | 34 | super(OpenStackAmuletDeployment, self).__init__(series) | 40 | super(OpenStackAmuletDeployment, self).__init__(series) |
486 | 41 | self.log = self.get_logger(level=log_level) | ||
487 | 42 | self.log.info('OpenStackAmuletDeployment: init') | ||
488 | 35 | self.openstack = openstack | 43 | self.openstack = openstack |
489 | 36 | self.source = source | 44 | self.source = source |
490 | 37 | self.stable = stable | 45 | self.stable = stable |
491 | @@ -39,6 +47,22 @@ | |||
492 | 39 | # out. | 47 | # out. |
493 | 40 | self.current_next = "trusty" | 48 | self.current_next = "trusty" |
494 | 41 | 49 | ||
495 | 50 | def get_logger(self, name="deployment-logger", level=logging.DEBUG): | ||
496 | 51 | """Get a logger object that will log to stdout.""" | ||
497 | 52 | log = logging | ||
498 | 53 | logger = log.getLogger(name) | ||
499 | 54 | fmt = log.Formatter("%(asctime)s %(funcName)s " | ||
500 | 55 | "%(levelname)s: %(message)s") | ||
501 | 56 | |||
502 | 57 | handler = log.StreamHandler(stream=sys.stdout) | ||
503 | 58 | handler.setLevel(level) | ||
504 | 59 | handler.setFormatter(fmt) | ||
505 | 60 | |||
506 | 61 | logger.addHandler(handler) | ||
507 | 62 | logger.setLevel(level) | ||
508 | 63 | |||
509 | 64 | return logger | ||
510 | 65 | |||
511 | 42 | def _determine_branch_locations(self, other_services): | 66 | def _determine_branch_locations(self, other_services): |
512 | 43 | """Determine the branch locations for the other services. | 67 | """Determine the branch locations for the other services. |
513 | 44 | 68 | ||
514 | @@ -46,6 +70,8 @@ | |||
515 | 46 | stable or next (dev) branch, and based on this, use the corresonding | 70 | stable or next (dev) branch, and based on this, use the corresonding |
516 | 47 | stable or next branches for the other_services.""" | 71 | stable or next branches for the other_services.""" |
517 | 48 | 72 | ||
518 | 73 | self.log.info('OpenStackAmuletDeployment: determine branch locations') | ||
519 | 74 | |||
520 | 49 | # Charms outside the lp:~openstack-charmers namespace | 75 | # Charms outside the lp:~openstack-charmers namespace |
521 | 50 | base_charms = ['mysql', 'mongodb', 'nrpe'] | 76 | base_charms = ['mysql', 'mongodb', 'nrpe'] |
522 | 51 | 77 | ||
523 | @@ -83,6 +109,8 @@ | |||
524 | 83 | 109 | ||
525 | 84 | def _add_services(self, this_service, other_services): | 110 | def _add_services(self, this_service, other_services): |
526 | 85 | """Add services to the deployment and set openstack-origin/source.""" | 111 | """Add services to the deployment and set openstack-origin/source.""" |
527 | 112 | self.log.info('OpenStackAmuletDeployment: adding services') | ||
528 | 113 | |||
529 | 86 | other_services = self._determine_branch_locations(other_services) | 114 | other_services = self._determine_branch_locations(other_services) |
530 | 87 | 115 | ||
531 | 88 | super(OpenStackAmuletDeployment, self)._add_services(this_service, | 116 | super(OpenStackAmuletDeployment, self)._add_services(this_service, |
532 | @@ -112,11 +140,12 @@ | |||
533 | 112 | 140 | ||
534 | 113 | def _configure_services(self, configs): | 141 | def _configure_services(self, configs): |
535 | 114 | """Configure all of the services.""" | 142 | """Configure all of the services.""" |
536 | 143 | self.log.info('OpenStackAmuletDeployment: configure services') | ||
537 | 115 | for service, config in six.iteritems(configs): | 144 | for service, config in six.iteritems(configs): |
538 | 116 | self.d.configure(service, config) | 145 | self.d.configure(service, config) |
539 | 117 | 146 | ||
540 | 118 | def _auto_wait_for_status(self, message=None, exclude_services=None, | 147 | def _auto_wait_for_status(self, message=None, exclude_services=None, |
542 | 119 | timeout=1800): | 148 | include_only=None, timeout=1800): |
543 | 120 | """Wait for all units to have a specific extended status, except | 149 | """Wait for all units to have a specific extended status, except |
544 | 121 | for any defined as excluded. Unless specified via message, any | 150 | for any defined as excluded. Unless specified via message, any |
545 | 122 | status containing any case of 'ready' will be considered a match. | 151 | status containing any case of 'ready' will be considered a match. |
546 | @@ -127,7 +156,7 @@ | |||
547 | 127 | message = re.compile('.*ready.*|.*ok.*', re.IGNORECASE) | 156 | message = re.compile('.*ready.*|.*ok.*', re.IGNORECASE) |
548 | 128 | 157 | ||
549 | 129 | Wait for all units to reach this status (exact match): | 158 | Wait for all units to reach this status (exact match): |
551 | 130 | message = 'Unit is ready' | 159 | message = re.compile('^Unit is ready and clustered$') |
552 | 131 | 160 | ||
553 | 132 | Wait for all units to reach any one of these (exact match): | 161 | Wait for all units to reach any one of these (exact match): |
554 | 133 | message = re.compile('Unit is ready|OK|Ready') | 162 | message = re.compile('Unit is ready|OK|Ready') |
555 | @@ -139,20 +168,50 @@ | |||
556 | 139 | https://github.com/juju/amulet/blob/master/amulet/sentry.py | 168 | https://github.com/juju/amulet/blob/master/amulet/sentry.py |
557 | 140 | 169 | ||
558 | 141 | :param message: Expected status match | 170 | :param message: Expected status match |
560 | 142 | :param exclude_services: List of juju service names to ignore | 171 | :param exclude_services: List of juju service names to ignore, |
561 | 172 | not to be used in conjuction with include_only. | ||
562 | 173 | :param include_only: List of juju service names to exclusively check, | ||
563 | 174 | not to be used in conjuction with exclude_services. | ||
564 | 143 | :param timeout: Maximum time in seconds to wait for status match | 175 | :param timeout: Maximum time in seconds to wait for status match |
565 | 144 | :returns: None. Raises if timeout is hit. | 176 | :returns: None. Raises if timeout is hit. |
566 | 145 | """ | 177 | """ |
569 | 146 | 178 | self.log.info('Waiting for extended status on units...') | |
570 | 147 | if not message: | 179 | |
571 | 180 | all_services = self.d.services.keys() | ||
572 | 181 | |||
573 | 182 | if exclude_services and include_only: | ||
574 | 183 | raise ValueError('exclude_services can not be used ' | ||
575 | 184 | 'with include_only') | ||
576 | 185 | |||
577 | 186 | if message: | ||
578 | 187 | if isinstance(message, re._pattern_type): | ||
579 | 188 | match = message.pattern | ||
580 | 189 | else: | ||
581 | 190 | match = message | ||
582 | 191 | |||
583 | 192 | self.log.debug('Custom extended status wait match: ' | ||
584 | 193 | '{}'.format(match)) | ||
585 | 194 | else: | ||
586 | 195 | self.log.debug('Default extended status wait match: contains ' | ||
587 | 196 | 'READY (case-insensitive)') | ||
588 | 148 | message = re.compile('.*ready.*', re.IGNORECASE) | 197 | message = re.compile('.*ready.*', re.IGNORECASE) |
589 | 149 | 198 | ||
591 | 150 | if not exclude_services: | 199 | if exclude_services: |
592 | 200 | self.log.debug('Excluding services from extended status match: ' | ||
593 | 201 | '{}'.format(exclude_services)) | ||
594 | 202 | else: | ||
595 | 151 | exclude_services = [] | 203 | exclude_services = [] |
596 | 152 | 204 | ||
598 | 153 | services = list(set(self.d.services.keys()) - set(exclude_services)) | 205 | if include_only: |
599 | 206 | services = include_only | ||
600 | 207 | else: | ||
601 | 208 | services = list(set(all_services) - set(exclude_services)) | ||
602 | 209 | |||
603 | 210 | self.log.debug('Waiting up to {}s for extended status on services: ' | ||
604 | 211 | '{}'.format(timeout, services)) | ||
605 | 154 | service_messages = {service: message for service in services} | 212 | service_messages = {service: message for service in services} |
606 | 155 | self.d.sentry.wait_for_messages(service_messages, timeout=timeout) | 213 | self.d.sentry.wait_for_messages(service_messages, timeout=timeout) |
607 | 214 | self.log.info('OK') | ||
608 | 156 | 215 | ||
609 | 157 | def _get_openstack_release(self): | 216 | def _get_openstack_release(self): |
610 | 158 | """Get openstack release. | 217 | """Get openstack release. |
611 | 159 | 218 | ||
612 | === modified file 'tests/charmhelpers/contrib/openstack/amulet/utils.py' | |||
613 | --- tests/charmhelpers/contrib/openstack/amulet/utils.py 2015-10-22 13:22:39 +0000 | |||
614 | +++ tests/charmhelpers/contrib/openstack/amulet/utils.py 2016-01-07 14:24:40 +0000 | |||
615 | @@ -18,6 +18,7 @@ | |||
616 | 18 | import json | 18 | import json |
617 | 19 | import logging | 19 | import logging |
618 | 20 | import os | 20 | import os |
619 | 21 | import re | ||
620 | 21 | import six | 22 | import six |
621 | 22 | import time | 23 | import time |
622 | 23 | import urllib | 24 | import urllib |
623 | @@ -604,7 +605,22 @@ | |||
624 | 604 | '{}'.format(sample_type, samples)) | 605 | '{}'.format(sample_type, samples)) |
625 | 605 | return None | 606 | return None |
626 | 606 | 607 | ||
628 | 607 | # rabbitmq/amqp specific helpers: | 608 | # rabbitmq/amqp specific helpers: |
629 | 609 | |||
630 | 610 | def rmq_wait_for_cluster(self, deployment, init_sleep=15, timeout=1200): | ||
631 | 611 | """Wait for rmq units extended status to show cluster readiness, | ||
632 | 612 | after an optional initial sleep period. Initial sleep is likely | ||
633 | 613 | necessary to be effective following a config change, as status | ||
634 | 614 | message may not instantly update to non-ready.""" | ||
635 | 615 | |||
636 | 616 | if init_sleep: | ||
637 | 617 | time.sleep(init_sleep) | ||
638 | 618 | |||
639 | 619 | message = re.compile('^Unit is ready and clustered$') | ||
640 | 620 | deployment._auto_wait_for_status(message=message, | ||
641 | 621 | timeout=timeout, | ||
642 | 622 | include_only=['rabbitmq-server']) | ||
643 | 623 | |||
644 | 608 | def add_rmq_test_user(self, sentry_units, | 624 | def add_rmq_test_user(self, sentry_units, |
645 | 609 | username="testuser1", password="changeme"): | 625 | username="testuser1", password="changeme"): |
646 | 610 | """Add a test user via the first rmq juju unit, check connection as | 626 | """Add a test user via the first rmq juju unit, check connection as |
647 | @@ -805,7 +821,10 @@ | |||
648 | 805 | if port: | 821 | if port: |
649 | 806 | config['ssl_port'] = port | 822 | config['ssl_port'] = port |
650 | 807 | 823 | ||
652 | 808 | deployment.configure('rabbitmq-server', config) | 824 | deployment.d.configure('rabbitmq-server', config) |
653 | 825 | |||
654 | 826 | # Wait for unit status | ||
655 | 827 | self.rmq_wait_for_cluster(deployment) | ||
656 | 809 | 828 | ||
657 | 810 | # Confirm | 829 | # Confirm |
658 | 811 | tries = 0 | 830 | tries = 0 |
659 | @@ -832,7 +851,10 @@ | |||
660 | 832 | 851 | ||
661 | 833 | # Disable RMQ SSL | 852 | # Disable RMQ SSL |
662 | 834 | config = {'ssl': 'off'} | 853 | config = {'ssl': 'off'} |
664 | 835 | deployment.configure('rabbitmq-server', config) | 854 | deployment.d.configure('rabbitmq-server', config) |
665 | 855 | |||
666 | 856 | # Wait for unit status | ||
667 | 857 | self.rmq_wait_for_cluster(deployment) | ||
668 | 836 | 858 | ||
669 | 837 | # Confirm | 859 | # Confirm |
670 | 838 | tries = 0 | 860 | tries = 0 |
charm_lint_check #16735 nova-cloud- controller for james-page mp281867
LINT OK: passed
Build: http:// 10.245. 162.77: 8080/job/ charm_lint_ check/16735/