Merge lp:~corey.bryant/charms/trusty/keystone/action-managed-upgrade into lp:~openstack-charmers-archive/charms/trusty/keystone/next

Proposed by Corey Bryant
Status: Merged
Merged at revision: 187
Proposed branch: lp:~corey.bryant/charms/trusty/keystone/action-managed-upgrade
Merge into: lp:~openstack-charmers-archive/charms/trusty/keystone/next
Diff against target: 188 lines (+139/-2)
6 files modified
actions.yaml (+4/-0)
actions/openstack_upgrade.py (+37/-0)
config.yaml (+10/-1)
hooks/keystone_hooks.py (+1/-1)
unit_tests/test_actions_openstack_upgrade.py (+56/-0)
unit_tests/test_keystone_hooks.py (+31/-0)
To merge this branch: bzr merge lp:~corey.bryant/charms/trusty/keystone/action-managed-upgrade
Reviewer Review Type Date Requested Status
David Ames (community) Approve
James Page Needs Resubmitting
Billy Olsen Needs Fixing
Review via email: mp+271143@code.launchpad.net
To post a comment you must log in.
Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #10050 keystone-next for corey.bryant mp271143
    LINT OK: passed

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

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

charm_unit_test #9217 keystone-next for corey.bryant mp271143
    UNIT OK: passed

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

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

charm_amulet_test #6437 keystone-next for corey.bryant mp271143
    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/12418280/
Build: http://10.245.162.77:8080/job/charm_amulet_test/6437/

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

charm_unit_test #9224 keystone-next for corey.bryant mp271143
    UNIT OK: passed

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

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

charm_lint_check #10060 keystone-next for corey.bryant mp271143
    LINT OK: passed

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

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

charm_amulet_test #6447 keystone-next for corey.bryant mp271143
    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/12420117/
Build: http://10.245.162.77:8080/job/charm_amulet_test/6447/

Revision history for this message
Billy Olsen (billy-olsen) wrote :

When I ran the upgrade action, I required a subsequent config-changed manual hook run in order to get the upgrade to work properly. The initial run of the openstack-ugprade action did upgrade all of the necessary packages, however the template rendering engine rendered kilo, then rendered icehouse templates (from which I was ugprading from). Digging into this a bit, I suspect its due to the way that the charmhelpers.contrib.openstack.utils.get_os_codename_package works. Since this is determined as part of register_configs(), which happens prior to the upgrade, the package versions are kept at the icehouse level which causes the icehouse templates to be rendered. I noticed this because I experienced bug https://bugs.launchpad.net/charms/+source/keystone/+bug/1417211 upon upgrade, then realized that this is due to rendering the icehouse template as can be seen at http://paste.ubuntu.com/12517976/.

review: Needs Fixing
Revision history for this message
Billy Olsen (billy-olsen) wrote :

Hmm, I see the same configs setting is on other MPs for the action ugprade as well, however they do *NOT* experience the kilo/icehouse/kilo issue. I think this warrants further investigation as to what specifically the root cause of this is.

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

charm_lint_check #10468 keystone-next for corey.bryant mp271143
    LINT OK: passed

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

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

charm_unit_test #9659 keystone-next for corey.bryant mp271143
    UNIT OK: passed

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

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

charm_amulet_test #6611 keystone-next for corey.bryant mp271143
    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/12526596/
Build: http://10.245.162.77:8080/job/charm_amulet_test/6611/

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

charm_lint_check #10696 keystone-next for corey.bryant mp271143
    LINT OK: passed

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

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

charm_unit_test #9877 keystone-next for corey.bryant mp271143
    UNIT OK: passed

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

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

charm_amulet_test #6740 keystone-next for corey.bryant mp271143
    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/12545931/
Build: http://10.245.162.77:8080/job/charm_amulet_test/6740/

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

charm_amulet_test #6745 keystone-next for corey.bryant mp271143
    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/12546291/
Build: http://10.245.162.77:8080/job/charm_amulet_test/6745/

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

charm_amulet_test #6753 keystone-next for corey.bryant mp271143
    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/12547504/
Build: http://10.245.162.77:8080/job/charm_amulet_test/6753/

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

Note that in my latest commit to this mp I reverted charm-helper changes to service_pause() and service_resume() which was causing amulet tests to fail. ack is looking into fixing those tests, but for now we should be ok merging this mp without those updates.

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

charm_lint_check #10775 keystone-next for corey.bryant mp271143
    LINT OK: passed

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

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

charm_unit_test #9952 keystone-next for corey.bryant mp271143
    UNIT OK: passed

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

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

charm_amulet_test #6780 keystone-next for corey.bryant mp271143
    AMULET OK: passed

Build: http://10.245.162.77:8080/job/charm_amulet_test/6780/

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

In response to Billy's find above, we've moved all of the action-managed upgrade code to import CONFIGS instead of calling register_configs() (see commit #185 below). Having 2 calls to register_configs() was causing issues.

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

charm_lint_check #11539 keystone-next for corey.bryant mp271143
    LINT OK: passed

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

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

charm_unit_test #10731 keystone-next for corey.bryant mp271143
    UNIT OK: passed

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

Revision history for this message
David Ames (thedac) wrote :

Missing the openstack-upgrade symlink.
Still approved. I'll add the symlink at merge time.

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

charm_amulet_test #7242 keystone-next for corey.bryant mp271143
    AMULET OK: passed

Build: http://10.245.162.77:8080/job/charm_amulet_test/7242/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'actions.yaml'
2--- actions.yaml 2015-08-28 06:58:11 +0000
3+++ actions.yaml 2015-10-07 16:21:02 +0000
4@@ -11,3 +11,7 @@
5 Resume keystone services.
6 If the keystone deployment is clustered using the hacluster charm, the
7 corresponding hacluster unit on the node must be resumed as well.
8+openstack-upgrade:
9+ description: |
10+ Perform openstack upgrades. Config option action-managed-upgrade must be
11+ set to True.
12
13=== added file 'actions/openstack_upgrade.py'
14--- actions/openstack_upgrade.py 1970-01-01 00:00:00 +0000
15+++ actions/openstack_upgrade.py 2015-10-07 16:21:02 +0000
16@@ -0,0 +1,37 @@
17+#!/usr/bin/python
18+import sys
19+
20+sys.path.append('hooks/')
21+
22+from charmhelpers.contrib.openstack.utils import (
23+ do_action_openstack_upgrade,
24+)
25+
26+from keystone_hooks import (
27+ config_changed,
28+ CONFIGS,
29+)
30+
31+from keystone_utils import (
32+ do_openstack_upgrade,
33+)
34+
35+
36+def openstack_upgrade():
37+ """Perform action-managed OpenStack upgrade.
38+
39+ Upgrades packages to the configured openstack-origin version and sets
40+ the corresponding action status as a result.
41+
42+ If the charm was installed from source we cannot upgrade it.
43+ For backwards compatibility a config flag (action-managed-upgrade) must
44+ be set for this code to run, otherwise a full service level upgrade will
45+ fire on config-changed."""
46+
47+ if (do_action_openstack_upgrade('keystone',
48+ do_openstack_upgrade,
49+ CONFIGS)):
50+ config_changed()
51+
52+if __name__ == '__main__':
53+ openstack_upgrade()
54
55=== modified file 'config.yaml'
56--- config.yaml 2015-07-17 01:29:31 +0000
57+++ config.yaml 2015-10-07 16:21:02 +0000
58@@ -298,4 +298,13 @@
59 description: |
60 A comma-separated list of nagios servicegroups.
61 If left empty, the nagios_context will be used as the servicegroup
62-
63+ action-managed-upgrade:
64+ type: boolean
65+ default: False
66+ description: |
67+ If True enables openstack upgrades for this charm via juju actions.
68+ You will still need to set openstack-origin to the new repository but
69+ instead of an upgrade running automatically across all units, it will
70+ wait for you to execute the openstack-upgrade action for this charm on
71+ each unit. If False it will revert to existing behavior of upgrading
72+ all units on config change.
73
74=== modified file 'hooks/keystone_hooks.py'
75--- hooks/keystone_hooks.py 2015-09-30 07:01:00 +0000
76+++ hooks/keystone_hooks.py 2015-10-07 16:21:02 +0000
77@@ -153,7 +153,7 @@
78 if config_value_changed('openstack-origin-git'):
79 status_set('maintenance', 'Running Git install')
80 git_install(config('openstack-origin-git'))
81- else:
82+ elif not config('action-managed-upgrade'):
83 if openstack_upgrade_available('keystone'):
84 status_set('maintenance', 'Running openstack upgrade')
85 do_openstack_upgrade(configs=CONFIGS)
86
87=== added file 'unit_tests/test_actions_openstack_upgrade.py'
88--- unit_tests/test_actions_openstack_upgrade.py 1970-01-01 00:00:00 +0000
89+++ unit_tests/test_actions_openstack_upgrade.py 2015-10-07 16:21:02 +0000
90@@ -0,0 +1,56 @@
91+from mock import patch
92+import os
93+
94+os.environ['JUJU_UNIT_NAME'] = 'keystone'
95+
96+with patch('keystone_utils.register_configs') as register_configs:
97+ import openstack_upgrade
98+ import keystone_hooks as hooks
99+
100+from test_utils import (
101+ CharmTestCase
102+)
103+
104+TO_PATCH = [
105+ 'config_changed',
106+ 'do_openstack_upgrade',
107+]
108+
109+
110+class TestCinderUpgradeActions(CharmTestCase):
111+
112+ def setUp(self):
113+ super(TestCinderUpgradeActions, self).setUp(openstack_upgrade,
114+ TO_PATCH)
115+
116+ @patch.object(hooks, 'register_configs')
117+ @patch('charmhelpers.contrib.openstack.utils.config')
118+ @patch('charmhelpers.contrib.openstack.utils.action_set')
119+ @patch('charmhelpers.contrib.openstack.utils.git_install_requested')
120+ @patch('charmhelpers.contrib.openstack.utils.openstack_upgrade_available')
121+ def test_openstack_upgrade_true(self, upgrade_avail, git_requested,
122+ action_set, config, reg_configs):
123+ git_requested.return_value = False
124+ upgrade_avail.return_value = True
125+ config.return_value = True
126+
127+ openstack_upgrade.openstack_upgrade()
128+
129+ self.assertTrue(self.do_openstack_upgrade.called)
130+ self.assertTrue(self.config_changed.called)
131+
132+ @patch.object(hooks, 'register_configs')
133+ @patch('charmhelpers.contrib.openstack.utils.config')
134+ @patch('charmhelpers.contrib.openstack.utils.action_set')
135+ @patch('charmhelpers.contrib.openstack.utils.git_install_requested')
136+ @patch('charmhelpers.contrib.openstack.utils.openstack_upgrade_available')
137+ def test_openstack_upgrade_false(self, upgrade_avail, git_requested,
138+ action_set, config, reg_configs):
139+ git_requested.return_value = False
140+ upgrade_avail.return_value = True
141+ config.return_value = False
142+
143+ openstack_upgrade.openstack_upgrade()
144+
145+ self.assertFalse(self.do_openstack_upgrade.called)
146+ self.assertFalse(self.config_changed.called)
147
148=== modified file 'unit_tests/test_keystone_hooks.py'
149--- unit_tests/test_keystone_hooks.py 2015-09-30 14:48:53 +0000
150+++ unit_tests/test_keystone_hooks.py 2015-10-07 16:21:02 +0000
151@@ -540,6 +540,37 @@
152 self.assertFalse(self.openstack_upgrade_available.called)
153 self.assertFalse(self.do_openstack_upgrade.called)
154
155+ @patch.object(hooks, 'git_install_requested')
156+ @patch.object(hooks, 'config_value_changed')
157+ @patch.object(hooks, 'ensure_ssl_dir')
158+ @patch.object(hooks, 'configure_https')
159+ @patch.object(hooks, 'is_pki_enabled')
160+ @patch.object(hooks, 'is_ssl_cert_master')
161+ @patch.object(hooks, 'peer_units')
162+ @patch.object(unison, 'get_homedir')
163+ @patch.object(unison, 'ensure_user')
164+ @patch('keystone_utils.ensure_ssl_cert_master')
165+ def test_config_changed_with_openstack_upgrade_action(self,
166+ ensure_ssl_cert,
167+ ensure_user,
168+ get_home,
169+ peer_units, is_ssl,
170+ is_pki, config_https,
171+ ensure_ssl_dir,
172+ config_value_changed,
173+ git_requested):
174+ ensure_ssl_cert.return_value = False
175+ is_pki.return_value = False
176+ peer_units.return_value = []
177+
178+ git_requested.return_value = False
179+ self.openstack_upgrade_available.return_value = True
180+ self.test_config.set('action-managed-upgrade', True)
181+
182+ hooks.config_changed()
183+
184+ self.assertFalse(self.do_openstack_upgrade.called)
185+
186 @patch('keystone_utils.log')
187 @patch('keystone_utils.ensure_ssl_cert_master')
188 @patch.object(hooks, 'hashlib')

Subscribers

People subscribed via source and target branches