Merge lp:~corey.bryant/charms/precise/nova-cloud-controller/step-migration into lp:~openstack-charmers/charms/precise/nova-cloud-controller/icehouse

Proposed by Corey Bryant
Status: Merged
Merged at revision: 102
Proposed branch: lp:~corey.bryant/charms/precise/nova-cloud-controller/step-migration
Merge into: lp:~openstack-charmers/charms/precise/nova-cloud-controller/icehouse
Diff against target: 60 lines (+38/-5)
1 file modified
hooks/nova_cc_utils.py (+38/-5)
To merge this branch: bzr merge lp:~corey.bryant/charms/precise/nova-cloud-controller/step-migration
Reviewer Review Type Date Requested Status
James Page Needs Fixing
Review via email: mp+214590@code.launchpad.net
To post a comment you must log in.
Revision history for this message
James Page (james-page) wrote :

Comments:

1) + return ''

return None would be nicer - passing empty strings always feels bad to me - to be explicit the check of the return value should be in this case:

  if step_src is not None:

2) Don't return in the stepped upgrade.

do_openstack_upgrade is currently returning on the interim step as well; not good :-).

review: Needs Fixing
Revision history for this message
Corey Bryant (corey.bryant) wrote :

> Comments:
>
> 1) + return ''
>
> return None would be nicer - passing empty strings always feels bad to me - to
> be explicit the check of the return value should be in this case:
>
> if step_src is not None:
>

Sounds good.

> 2) Don't return in the stepped upgrade.
>
> do_openstack_upgrade is currently returning on the interim step as well; not
> good :-).

Oops, yeah that's a mistake.

102. By Corey Bryant

Enable upgrade from grizzly to icehouse by stepping to havana

Revision history for this message
Corey Bryant (corey.bryant) wrote :

Fixes have been added in response to James' comments. Thanks for reviewing!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/nova_cc_utils.py'
2--- hooks/nova_cc_utils.py 2014-04-01 15:40:28 +0000
3+++ hooks/nova_cc_utils.py 2014-04-08 13:01:32 +0000
4@@ -307,11 +307,31 @@
5 _save_script_rc(**env_vars)
6
7
8-def do_openstack_upgrade():
9- # NOTE(jamespage) horrible hack to make utils forget a cached value
10- import charmhelpers.contrib.openstack.utils as utils
11- utils.os_rel = None
12- new_src = config('openstack-origin')
13+def get_step_upgrade_source(new_src):
14+ '''
15+ Determine if upgrade skips a release and, if so, return source
16+ of skipped release.
17+ '''
18+ sources = {
19+ #target_src: (cur_pocket, step_src)
20+ 'cloud:precise-icehouse':
21+ ('precise-updates/grizzly', 'cloud:precise-havana'),
22+ 'cloud:precise-icehouse/proposed':
23+ ('precise-proposed/grizzly', 'cloud:precise-havana/proposed')
24+ }
25+
26+ with open('/etc/apt/sources.list.d/cloud-archive.list', 'r') as f:
27+ line = f.readline()
28+ for target_src, (cur_pocket, step_src) in sources.items():
29+ if target_src != new_src:
30+ continue
31+ if cur_pocket in line:
32+ return step_src
33+
34+ return None
35+
36+
37+def _do_openstack_upgrade(new_src):
38 new_os_rel = get_os_codename_install_source(new_src)
39 log('Performing OpenStack upgrade to %s.' % (new_os_rel))
40
41@@ -336,6 +356,19 @@
42 return configs
43
44
45+def do_openstack_upgrade():
46+ # NOTE(jamespage) horrible hack to make utils forget a cached value
47+ import charmhelpers.contrib.openstack.utils as utils
48+ utils.os_rel = None
49+ new_src = config('openstack-origin')
50+
51+ step_src = get_step_upgrade_source(new_src)
52+ if step_src is not None:
53+ _do_openstack_upgrade(step_src)
54+
55+ return _do_openstack_upgrade(new_src)
56+
57+
58 def volume_service():
59 '''Specifies correct volume API for specific OS release'''
60 os_vers = os_release('nova-common')

Subscribers

People subscribed via source and target branches

to all changes: