Merge ~freyes/ubuntu/+source/heat:stable/xena into ~ubuntu-openstack-dev/ubuntu/+source/heat:stable/xena
- Git
- lp:~freyes/ubuntu/+source/heat
- stable/xena
- Merge into stable/xena
Proposed by
Felipe Reyes
Status: | Merged | ||||
---|---|---|---|---|---|
Merge reported by: | Corey Bryant | ||||
Merged at revision: | 45af92db98c1334c7bcaad1dda8d0486aa5a1deb | ||||
Proposed branch: | ~freyes/ubuntu/+source/heat:stable/xena | ||||
Merge into: | ~ubuntu-openstack-dev/ubuntu/+source/heat:stable/xena | ||||
Diff against target: |
378 lines (+134/-33) 12 files modified
AUTHORS (+1/-0) ChangeLog (+9/-0) PKG-INFO (+1/-1) debian/changelog (+6/-2) devstack/lib/heat (+10/-1) heat/engine/resources/openstack/heat/resource_group.py (+12/-6) heat/engine/resources/openstack/nova/server_group.py (+25/-18) heat/tests/openstack/nova/test_server_group.py (+13/-3) heat_integrationtests/functional/test_resource_group.py (+54/-0) openstack_heat.egg-info/PKG-INFO (+1/-1) openstack_heat.egg-info/pbr.json (+1/-1) tox.ini (+1/-0) |
||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Corey Bryant | Pending | ||
Review via email: mp+416206@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | diff --git a/AUTHORS b/AUTHORS |
2 | index 4f34a6b..f8705d9 100644 |
3 | --- a/AUTHORS |
4 | +++ b/AUTHORS |
5 | @@ -49,6 +49,7 @@ Atsushi Sasaki <atsaki01@gmail.com> |
6 | Attila Fazekas <afazekas@redhat.com> |
7 | AvnishPal <avnish.pal@nectechnologies.in> |
8 | BK Box <bk@theboxes.org> |
9 | +Balazs Gibizer <balazs.gibizer@est.tech> |
10 | Bartosz Górski <bartosz.gorski@ntti3.com> |
11 | Ben Nemec <bnemec@redhat.com> |
12 | Ben Nemec <openstack@nemebean.com> |
13 | diff --git a/ChangeLog b/ChangeLog |
14 | index 3720f19..a35becd 100644 |
15 | --- a/ChangeLog |
16 | +++ b/ChangeLog |
17 | @@ -1,6 +1,15 @@ |
18 | CHANGES |
19 | ======= |
20 | |
21 | +17.0.1 |
22 | +------ |
23 | + |
24 | +* Provide install\_command to pip install with upper-constraints |
25 | +* Fix timeout calc of nested resource groups |
26 | +* Reproduce bug story/2009237 |
27 | +* Fallback to upstream for Fedora image |
28 | +* Fix ServerGroup create |
29 | + |
30 | 17.0.0 |
31 | ------ |
32 | |
33 | diff --git a/PKG-INFO b/PKG-INFO |
34 | index 7ef1230..315b8c6 100644 |
35 | --- a/PKG-INFO |
36 | +++ b/PKG-INFO |
37 | @@ -1,6 +1,6 @@ |
38 | Metadata-Version: 1.2 |
39 | Name: openstack-heat |
40 | -Version: 17.0.0 |
41 | +Version: 17.0.1 |
42 | Summary: OpenStack Orchestration |
43 | Home-page: https://docs.openstack.org/heat/latest/ |
44 | Author: OpenStack |
45 | diff --git a/debian/changelog b/debian/changelog |
46 | index 41503e0..f83520d 100644 |
47 | --- a/debian/changelog |
48 | +++ b/debian/changelog |
49 | @@ -1,8 +1,12 @@ |
50 | -heat (1:17.0.0-0ubuntu1.1) UNRELEASED; urgency=medium |
51 | +heat (1:17.0.1-0ubuntu1) UNRELEASED; urgency=medium |
52 | |
53 | + [ Corey Bryant ] |
54 | * d/gbp.conf: Create stable/xena branch. |
55 | |
56 | - -- Corey Bryant <corey.bryant@canonical.com> Fri, 15 Oct 2021 14:53:00 -0400 |
57 | + [ Felipe Reyes ] |
58 | + * New stable point release for OpenStack Xena (LP: #1962582). |
59 | + |
60 | + -- Felipe Reyes <felipe.reyes@canonical.com> Tue, 01 Mar 2022 14:51:07 +0000 |
61 | |
62 | heat (1:17.0.0-0ubuntu1) impish; urgency=medium |
63 | |
64 | diff --git a/devstack/lib/heat b/devstack/lib/heat |
65 | index 5993d7d..5f5f172 100644 |
66 | --- a/devstack/lib/heat |
67 | +++ b/devstack/lib/heat |
68 | @@ -471,10 +471,19 @@ function configure_tempest_for_heat { |
69 | source $TOP_DIR/openrc admin admin |
70 | iniset $TEMPEST_CONFIG heat_plugin admin_username $OS_USERNAME |
71 | iniset $TEMPEST_CONFIG heat_plugin admin_password $OS_PASSWORD |
72 | + |
73 | + # NOTE(ianw) OpenDev infra only keeps the latest two Fedora's |
74 | + # around; prefer the mirror but allow fallback |
75 | if [[ -e /etc/ci/mirror_info.sh ]]; then |
76 | source /etc/ci/mirror_info.sh |
77 | fi |
78 | - export HEAT_TEST_FEDORA_IMAGE=${NODEPOOL_FEDORA_MIRROR:-https://download.fedoraproject.org/pub/fedora/linux}/releases/33/Cloud/x86_64/images/Fedora-Cloud-Base-33-1.2.x86_64.qcow2 |
79 | + HEAT_TEST_FEDORA_IMAGE_UPSTREAM=https://download.fedoraproject.org/pub/fedora/linux |
80 | + HEAT_TEST_FEDORA_IMAGE_PATH=releases/33/Cloud/x86_64/images/Fedora-Cloud-Base-33-1.2.x86_64.qcow2 |
81 | + if curl --output /dev/null --silent --head --fail "${NODEPOOL_FEDORA_MIRROR}/${HEAT_TEST_FEDORA_IMAGE_PATH}"; then |
82 | + export HEAT_TEST_FEDORA_IMAGE="${NODEPOOL_FEDORA_MIRROR}/${HEAT_TEST_FEDORA_IMAGE_PATH}" |
83 | + else |
84 | + export HEAT_TEST_FEDORA_IMAGE="${HEAT_TEST_FEDORA_IMAGE_UPSTREAM}/${HEAT_TEST_FEDORA_IMAGE_PATH}" |
85 | + fi |
86 | TOKEN=$(openstack token issue -c id -f value) |
87 | local image_exists=$( openstack image list | grep "Fedora-Cloud-Base-33-1.2.x86_64" ) |
88 | if [[ -z $image_exists ]]; then |
89 | diff --git a/heat/engine/resources/openstack/heat/resource_group.py b/heat/engine/resources/openstack/heat/resource_group.py |
90 | index 48ef05a..1bdc0c3 100644 |
91 | --- a/heat/engine/resources/openstack/heat/resource_group.py |
92 | +++ b/heat/engine/resources/openstack/heat/resource_group.py |
93 | @@ -15,6 +15,7 @@ import collections |
94 | import copy |
95 | import functools |
96 | import itertools |
97 | +import math |
98 | |
99 | from oslo_log import log as logging |
100 | |
101 | @@ -433,18 +434,18 @@ class ResourceGroup(stack_resource.StackResource): |
102 | return False |
103 | return True |
104 | |
105 | - def _run_to_completion(self, template, timeout): |
106 | + def _run_to_completion(self, template, timeout_mins): |
107 | updater = self.update_with_template(template, {}, |
108 | - timeout) |
109 | + timeout_mins) |
110 | |
111 | while not super(ResourceGroup, |
112 | self).check_update_complete(updater): |
113 | yield |
114 | |
115 | - def _run_update(self, total_capacity, max_updates, timeout): |
116 | + def _run_update(self, total_capacity, max_updates, timeout_mins): |
117 | template = self._assemble_for_rolling_update(total_capacity, |
118 | max_updates) |
119 | - return self._run_to_completion(template, timeout) |
120 | + return self._run_to_completion(template, timeout_mins) |
121 | |
122 | def check_update_complete(self, checkers): |
123 | for checker in checkers: |
124 | @@ -776,13 +777,18 @@ class ResourceGroup(stack_resource.StackResource): |
125 | |
126 | batches = list(self._get_batches(self.get_size(), curr_cap, batch_size, |
127 | min_in_service)) |
128 | - update_timeout = self._update_timeout(len(batches), pause_sec) |
129 | + update_timeout_secs = self._update_timeout(len(batches), pause_sec) |
130 | + |
131 | + # NOTE(gibi) update_timeout is in seconds but the _run_update |
132 | + # eventually calls StackResource.update_with_template that takes |
133 | + # timeout in minutes so we need to convert here. |
134 | + update_timeout_mins = math.ceil(update_timeout_secs / 60) |
135 | |
136 | def tasks(): |
137 | for index, (curr_cap, max_upd) in enumerate(batches): |
138 | yield scheduler.TaskRunner(self._run_update, |
139 | curr_cap, max_upd, |
140 | - update_timeout) |
141 | + update_timeout_mins) |
142 | |
143 | if index < (len(batches) - 1) and pause_sec > 0: |
144 | yield scheduler.TaskRunner(pause_between_batch, pause_sec) |
145 | diff --git a/heat/engine/resources/openstack/nova/server_group.py b/heat/engine/resources/openstack/nova/server_group.py |
146 | index afc417b..b4eb956 100644 |
147 | --- a/heat/engine/resources/openstack/nova/server_group.py |
148 | +++ b/heat/engine/resources/openstack/nova/server_group.py |
149 | @@ -35,11 +35,13 @@ class ServerGroup(resource.Resource): |
150 | entity = 'server_groups' |
151 | |
152 | PROPERTIES = ( |
153 | - NAME, POLICIES, RULE |
154 | + NAME, POLICIES, RULES |
155 | ) = ( |
156 | - 'name', 'policies', 'rule' |
157 | + 'name', 'policies', 'rules' |
158 | ) |
159 | |
160 | + _RULES = (MAX_SERVER_PER_HOST) = ('max_server_per_host') |
161 | + |
162 | properties_schema = { |
163 | NAME: properties.Schema( |
164 | properties.Schema.STRING, |
165 | @@ -47,7 +49,7 @@ class ServerGroup(resource.Resource): |
166 | ), |
167 | POLICIES: properties.Schema( |
168 | properties.Schema.LIST, |
169 | - _('A list of string policies to apply. ' |
170 | + _('A list of exactly one policy to apply. ' |
171 | 'Defaults to anti-affinity.'), |
172 | default=['anti-affinity'], |
173 | constraints=[ |
174 | @@ -59,11 +61,17 @@ class ServerGroup(resource.Resource): |
175 | properties.Schema.STRING, |
176 | ), |
177 | ), |
178 | - RULE: properties.Schema( |
179 | + RULES: properties.Schema( |
180 | properties.Schema.MAP, |
181 | - _('A rule for the policy. Currently, only the ' |
182 | - '"max_server_per_host" rule is supported for the ' |
183 | - '"anti-affinity" policy.'), |
184 | + _('Rules for a policy.'), |
185 | + schema={ |
186 | + MAX_SERVER_PER_HOST: properties.Schema( |
187 | + properties.Schema.NUMBER, |
188 | + _('Maximum servers in a group on a given host. ' |
189 | + 'Rule for anti-affinity policy.') |
190 | + ) |
191 | + }, |
192 | + support_status=support.SupportStatus(version='17.0.0'), |
193 | ), |
194 | } |
195 | |
196 | @@ -77,26 +85,25 @@ class ServerGroup(resource.Resource): |
197 | msg = _('Required microversion for soft policies not supported.') |
198 | raise exception.StackValidationFailed(message=msg) |
199 | |
200 | - if self.properties[self.RULE]: |
201 | + if self.properties[self.RULES]: |
202 | is_supported = self.client_plugin().is_version_supported( |
203 | MICROVERSION_RULE) |
204 | if not is_supported: |
205 | - msg = _('Required microversion for rule not supported.') |
206 | + msg = _('Required microversion for rules not supported.') |
207 | raise exception.StackValidationFailed(message=msg) |
208 | |
209 | def handle_create(self): |
210 | name = self.physical_resource_name() |
211 | policies = self.properties[self.POLICIES] |
212 | - if self.properties[self.RULE] and 'soft-affinity' in policies: |
213 | - rule = self.properties[self.RULE] |
214 | - client = self.client() |
215 | - server_group = client.server_groups.create(name=name, |
216 | - policies=policies, |
217 | - rule=rule) |
218 | + rules = self.properties[self.RULES] |
219 | + rules_supported = self.client_plugin().is_version_supported( |
220 | + MICROVERSION_RULE) |
221 | + if rules_supported: |
222 | + server_group = self.client().server_groups.create( |
223 | + name=name, policy=policies[0], rules=rules) |
224 | else: |
225 | - client = self.client() |
226 | - server_group = client.server_groups.create(name=name, |
227 | - policies=policies) |
228 | + server_group = self.client().server_groups.create( |
229 | + name=name, policies=policies) |
230 | self.resource_id_set(server_group.id) |
231 | |
232 | def physical_resource_name(self): |
233 | diff --git a/heat/tests/openstack/nova/test_server_group.py b/heat/tests/openstack/nova/test_server_group.py |
234 | index 0a1e682..c2dfda4 100644 |
235 | --- a/heat/tests/openstack/nova/test_server_group.py |
236 | +++ b/heat/tests/openstack/nova/test_server_group.py |
237 | @@ -26,7 +26,9 @@ sg_template = { |
238 | "type": "OS::Nova::ServerGroup", |
239 | "properties": { |
240 | "name": "test", |
241 | - "policies": ["anti-affinity"] |
242 | + "policies": ["anti-affinity"], |
243 | + "rules": { |
244 | + "max_server_per_host": 8} |
245 | } |
246 | } |
247 | } |
248 | @@ -50,6 +52,12 @@ class NovaServerGroupTest(common.HeatTestCase): |
249 | # create mock clients and objects |
250 | nova = mock.MagicMock() |
251 | self.sg.client = mock.MagicMock(return_value=nova) |
252 | + mock_plugin = mock.MagicMock() |
253 | + self.patchobject(mock_plugin, |
254 | + 'is_version_supported', |
255 | + return_value=True) |
256 | + self.patchobject(self.sg, 'client_plugin', |
257 | + return_value=mock_plugin) |
258 | self.sg_mgr = nova.server_groups |
259 | |
260 | def _create_sg(self, name): |
261 | @@ -68,7 +76,7 @@ class NovaServerGroupTest(common.HeatTestCase): |
262 | name = 'test' |
263 | n = name |
264 | |
265 | - def fake_create(name, policies): |
266 | + def fake_create(name, policy, rules): |
267 | self.assertGreater(len(name), 1) |
268 | return FakeGroup(n) |
269 | self.sg_mgr.create = fake_create |
270 | @@ -81,7 +89,9 @@ class NovaServerGroupTest(common.HeatTestCase): |
271 | self._create_sg('test') |
272 | expected_args = () |
273 | expected_kwargs = {'name': 'test', |
274 | - 'policies': ["anti-affinity"], |
275 | + 'policy': "anti-affinity", |
276 | + 'rules': { |
277 | + 'max_server_per_host': 8} |
278 | } |
279 | self.sg_mgr.create.assert_called_once_with(*expected_args, |
280 | **expected_kwargs) |
281 | diff --git a/heat_integrationtests/functional/test_resource_group.py b/heat_integrationtests/functional/test_resource_group.py |
282 | index ebce70d..07be7f2 100644 |
283 | --- a/heat_integrationtests/functional/test_resource_group.py |
284 | +++ b/heat_integrationtests/functional/test_resource_group.py |
285 | @@ -129,6 +129,60 @@ resources: |
286 | outputs.append(validate_output(stack, 'random2', 30)) |
287 | self.assertEqual(outputs, self._stack_output(stack, 'all_values')) |
288 | |
289 | + def test_create_nested_groups_with_timeout(self): |
290 | + parent_template = ''' |
291 | +heat_template_version: rocky |
292 | +resources: |
293 | + parent_group: |
294 | + type: OS::Heat::ResourceGroup |
295 | + update_policy: |
296 | + batch_create: { max_batch_size: 1, pause_time: 1 } |
297 | + properties: |
298 | + count: 2 |
299 | + resource_def: |
300 | + type: child.yaml |
301 | +''' |
302 | + child_template = ''' |
303 | +heat_template_version: rocky |
304 | +resources: |
305 | + child_group: |
306 | + type: OS::Heat::ResourceGroup |
307 | + update_policy: |
308 | + batch_create: { max_batch_size: 1, pause_time: 1 } |
309 | + properties: |
310 | + count: 2 |
311 | + resource_def: |
312 | + type: value.yaml |
313 | +''' |
314 | + value_template = ''' |
315 | +heat_template_version: rocky |
316 | +resources: |
317 | + value: |
318 | + type: OS::Heat::Value |
319 | + properties: |
320 | + type: string |
321 | + value: 'test' |
322 | +''' |
323 | + files = { |
324 | + 'child.yaml': child_template, |
325 | + 'value.yaml': value_template, |
326 | + } |
327 | + stack_identifier = self.stack_create( |
328 | + template=parent_template, |
329 | + files=files, |
330 | + timeout=10, # in minutes |
331 | + ) |
332 | + |
333 | + resources = self.client.resources.list( |
334 | + stack_identifier, nested_depth=2, with_detail=True) |
335 | + timeouts = set() |
336 | + for res in resources: |
337 | + if res.resource_type == "OS::Heat::ResourceGroup": |
338 | + nested_stack = self.client.stacks.get(res.physical_resource_id) |
339 | + timeouts.add(nested_stack.timeout_mins) |
340 | + |
341 | + self.assertEqual({10}, timeouts) |
342 | + |
343 | def test_update_increase_decrease_count(self): |
344 | # create stack with resource group count 2 |
345 | env = {'resource_registry': |
346 | diff --git a/openstack_heat.egg-info/PKG-INFO b/openstack_heat.egg-info/PKG-INFO |
347 | index 7ef1230..315b8c6 100644 |
348 | --- a/openstack_heat.egg-info/PKG-INFO |
349 | +++ b/openstack_heat.egg-info/PKG-INFO |
350 | @@ -1,6 +1,6 @@ |
351 | Metadata-Version: 1.2 |
352 | Name: openstack-heat |
353 | -Version: 17.0.0 |
354 | +Version: 17.0.1 |
355 | Summary: OpenStack Orchestration |
356 | Home-page: https://docs.openstack.org/heat/latest/ |
357 | Author: OpenStack |
358 | diff --git a/openstack_heat.egg-info/pbr.json b/openstack_heat.egg-info/pbr.json |
359 | index 4773ead..9aeecc8 100644 |
360 | --- a/openstack_heat.egg-info/pbr.json |
361 | +++ b/openstack_heat.egg-info/pbr.json |
362 | @@ -1 +1 @@ |
363 | -{"git_version": "4cf0ff641", "is_release": true} |
364 | \ No newline at end of file |
365 | +{"git_version": "ef36cb304", "is_release": true} |
366 | \ No newline at end of file |
367 | diff --git a/tox.ini b/tox.ini |
368 | index 5e76541..eb87eff 100644 |
369 | --- a/tox.ini |
370 | +++ b/tox.ini |
371 | @@ -9,6 +9,7 @@ basepython = python3 |
372 | setenv = VIRTUAL_ENV={envdir} |
373 | PYTHONWARNINGS=default::DeprecationWarning |
374 | OS_TEST_PATH=heat/tests |
375 | +install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/xena} {opts} {packages} |
376 | usedevelop = True |
377 | deps = -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/xena} |
378 | -r{toxinidir}/requirements.txt |