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
=== modified file 'actions.yaml'
--- actions.yaml 2015-08-28 06:58:11 +0000
+++ actions.yaml 2015-10-07 16:21:02 +0000
@@ -11,3 +11,7 @@
11 Resume keystone services.11 Resume keystone services.
12 If the keystone deployment is clustered using the hacluster charm, the12 If the keystone deployment is clustered using the hacluster charm, the
13 corresponding hacluster unit on the node must be resumed as well.13 corresponding hacluster unit on the node must be resumed as well.
14openstack-upgrade:
15 description: |
16 Perform openstack upgrades. Config option action-managed-upgrade must be
17 set to True.
1418
=== added file 'actions/openstack_upgrade.py'
--- actions/openstack_upgrade.py 1970-01-01 00:00:00 +0000
+++ actions/openstack_upgrade.py 2015-10-07 16:21:02 +0000
@@ -0,0 +1,37 @@
1#!/usr/bin/python
2import sys
3
4sys.path.append('hooks/')
5
6from charmhelpers.contrib.openstack.utils import (
7 do_action_openstack_upgrade,
8)
9
10from keystone_hooks import (
11 config_changed,
12 CONFIGS,
13)
14
15from keystone_utils import (
16 do_openstack_upgrade,
17)
18
19
20def openstack_upgrade():
21 """Perform action-managed OpenStack upgrade.
22
23 Upgrades packages to the configured openstack-origin version and sets
24 the corresponding action status as a result.
25
26 If the charm was installed from source we cannot upgrade it.
27 For backwards compatibility a config flag (action-managed-upgrade) must
28 be set for this code to run, otherwise a full service level upgrade will
29 fire on config-changed."""
30
31 if (do_action_openstack_upgrade('keystone',
32 do_openstack_upgrade,
33 CONFIGS)):
34 config_changed()
35
36if __name__ == '__main__':
37 openstack_upgrade()
038
=== modified file 'config.yaml'
--- config.yaml 2015-07-17 01:29:31 +0000
+++ config.yaml 2015-10-07 16:21:02 +0000
@@ -298,4 +298,13 @@
298 description: |298 description: |
299 A comma-separated list of nagios servicegroups.299 A comma-separated list of nagios servicegroups.
300 If left empty, the nagios_context will be used as the servicegroup300 If left empty, the nagios_context will be used as the servicegroup
301301 action-managed-upgrade:
302 type: boolean
303 default: False
304 description: |
305 If True enables openstack upgrades for this charm via juju actions.
306 You will still need to set openstack-origin to the new repository but
307 instead of an upgrade running automatically across all units, it will
308 wait for you to execute the openstack-upgrade action for this charm on
309 each unit. If False it will revert to existing behavior of upgrading
310 all units on config change.
302311
=== modified file 'hooks/keystone_hooks.py'
--- hooks/keystone_hooks.py 2015-09-30 07:01:00 +0000
+++ hooks/keystone_hooks.py 2015-10-07 16:21:02 +0000
@@ -153,7 +153,7 @@
153 if config_value_changed('openstack-origin-git'):153 if config_value_changed('openstack-origin-git'):
154 status_set('maintenance', 'Running Git install')154 status_set('maintenance', 'Running Git install')
155 git_install(config('openstack-origin-git'))155 git_install(config('openstack-origin-git'))
156 else:156 elif not config('action-managed-upgrade'):
157 if openstack_upgrade_available('keystone'):157 if openstack_upgrade_available('keystone'):
158 status_set('maintenance', 'Running openstack upgrade')158 status_set('maintenance', 'Running openstack upgrade')
159 do_openstack_upgrade(configs=CONFIGS)159 do_openstack_upgrade(configs=CONFIGS)
160160
=== added file 'unit_tests/test_actions_openstack_upgrade.py'
--- unit_tests/test_actions_openstack_upgrade.py 1970-01-01 00:00:00 +0000
+++ unit_tests/test_actions_openstack_upgrade.py 2015-10-07 16:21:02 +0000
@@ -0,0 +1,56 @@
1from mock import patch
2import os
3
4os.environ['JUJU_UNIT_NAME'] = 'keystone'
5
6with patch('keystone_utils.register_configs') as register_configs:
7 import openstack_upgrade
8 import keystone_hooks as hooks
9
10from test_utils import (
11 CharmTestCase
12)
13
14TO_PATCH = [
15 'config_changed',
16 'do_openstack_upgrade',
17]
18
19
20class TestCinderUpgradeActions(CharmTestCase):
21
22 def setUp(self):
23 super(TestCinderUpgradeActions, self).setUp(openstack_upgrade,
24 TO_PATCH)
25
26 @patch.object(hooks, 'register_configs')
27 @patch('charmhelpers.contrib.openstack.utils.config')
28 @patch('charmhelpers.contrib.openstack.utils.action_set')
29 @patch('charmhelpers.contrib.openstack.utils.git_install_requested')
30 @patch('charmhelpers.contrib.openstack.utils.openstack_upgrade_available')
31 def test_openstack_upgrade_true(self, upgrade_avail, git_requested,
32 action_set, config, reg_configs):
33 git_requested.return_value = False
34 upgrade_avail.return_value = True
35 config.return_value = True
36
37 openstack_upgrade.openstack_upgrade()
38
39 self.assertTrue(self.do_openstack_upgrade.called)
40 self.assertTrue(self.config_changed.called)
41
42 @patch.object(hooks, 'register_configs')
43 @patch('charmhelpers.contrib.openstack.utils.config')
44 @patch('charmhelpers.contrib.openstack.utils.action_set')
45 @patch('charmhelpers.contrib.openstack.utils.git_install_requested')
46 @patch('charmhelpers.contrib.openstack.utils.openstack_upgrade_available')
47 def test_openstack_upgrade_false(self, upgrade_avail, git_requested,
48 action_set, config, reg_configs):
49 git_requested.return_value = False
50 upgrade_avail.return_value = True
51 config.return_value = False
52
53 openstack_upgrade.openstack_upgrade()
54
55 self.assertFalse(self.do_openstack_upgrade.called)
56 self.assertFalse(self.config_changed.called)
057
=== modified file 'unit_tests/test_keystone_hooks.py'
--- unit_tests/test_keystone_hooks.py 2015-09-30 14:48:53 +0000
+++ unit_tests/test_keystone_hooks.py 2015-10-07 16:21:02 +0000
@@ -540,6 +540,37 @@
540 self.assertFalse(self.openstack_upgrade_available.called)540 self.assertFalse(self.openstack_upgrade_available.called)
541 self.assertFalse(self.do_openstack_upgrade.called)541 self.assertFalse(self.do_openstack_upgrade.called)
542542
543 @patch.object(hooks, 'git_install_requested')
544 @patch.object(hooks, 'config_value_changed')
545 @patch.object(hooks, 'ensure_ssl_dir')
546 @patch.object(hooks, 'configure_https')
547 @patch.object(hooks, 'is_pki_enabled')
548 @patch.object(hooks, 'is_ssl_cert_master')
549 @patch.object(hooks, 'peer_units')
550 @patch.object(unison, 'get_homedir')
551 @patch.object(unison, 'ensure_user')
552 @patch('keystone_utils.ensure_ssl_cert_master')
553 def test_config_changed_with_openstack_upgrade_action(self,
554 ensure_ssl_cert,
555 ensure_user,
556 get_home,
557 peer_units, is_ssl,
558 is_pki, config_https,
559 ensure_ssl_dir,
560 config_value_changed,
561 git_requested):
562 ensure_ssl_cert.return_value = False
563 is_pki.return_value = False
564 peer_units.return_value = []
565
566 git_requested.return_value = False
567 self.openstack_upgrade_available.return_value = True
568 self.test_config.set('action-managed-upgrade', True)
569
570 hooks.config_changed()
571
572 self.assertFalse(self.do_openstack_upgrade.called)
573
543 @patch('keystone_utils.log')574 @patch('keystone_utils.log')
544 @patch('keystone_utils.ensure_ssl_cert_master')575 @patch('keystone_utils.ensure_ssl_cert_master')
545 @patch.object(hooks, 'hashlib')576 @patch.object(hooks, 'hashlib')

Subscribers

People subscribed via source and target branches