Merge lp:~james-page/charms/trusty/neutron-api/lp-1469621-stable into lp:~openstack-charmers-archive/charms/trusty/neutron-api/trunk

Proposed by James Page
Status: Rejected
Rejected by: James Page
Proposed branch: lp:~james-page/charms/trusty/neutron-api/lp-1469621-stable
Merge into: lp:~openstack-charmers-archive/charms/trusty/neutron-api/trunk
Diff against target: 95 lines (+45/-1)
2 files modified
hooks/neutron_api_utils.py (+2/-1)
unit_tests/test_neutron_api_utils.py (+43/-0)
To merge this branch: bzr merge lp:~james-page/charms/trusty/neutron-api/lp-1469621-stable
Reviewer Review Type Date Requested Status
Liam Young Pending
Review via email: mp+263793@code.launchpad.net

This proposal supersedes a proposal from 2015-07-03.

Description of the change

Ensure that only the leader upgrades the database.

To post a comment you must log in.
Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #5732 neutron-api for james-page mp263793
    LINT OK: passed

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

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

charm_unit_test #5364 neutron-api for james-page mp263793
    UNIT OK: passed

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

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

charm_amulet_test #4930 neutron-api for james-page mp263793
    AMULET OK: passed

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

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

charm_lint_check #7753 neutron-api for james-page mp263793
    LINT OK: passed

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

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

charm_unit_test #7187 neutron-api for james-page mp263793
    UNIT OK: passed

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

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

charm_lint_check #12360 neutron-api for james-page mp263793
    LINT FAIL: lint-test failed
    LINT FAIL: charm-proof failed

LINT Results (max last 2 lines):
make: *** [lint] Error 100
ERROR:root:Make target returned non-zero.

Full lint test output: http://paste.ubuntu.com/12895669/
Build: http://10.245.162.77:8080/job/charm_lint_check/12360/

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

charm_unit_test #11465 neutron-api for james-page mp263793
    UNIT OK: passed

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

Unmerged revisions

115. By James Page

Backport fix for lp:1469621 to stable branch

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/neutron_api_utils.py'
2--- hooks/neutron_api_utils.py 2015-04-23 08:50:42 +0000
3+++ hooks/neutron_api_utils.py 2015-07-03 15:18:40 +0000
4@@ -42,6 +42,7 @@
5 )
6
7 from charmhelpers.core.templating import render
8+from charmhelpers.contrib.hahelpers.cluster import is_elected_leader
9
10 import neutron_api_context
11
12@@ -282,7 +283,7 @@
13 # set CONFIGS to load templates from new release
14 configs.set_release(openstack_release=new_os_rel)
15 # Before kilo it's nova-cloud-controllers job
16- if new_os_rel >= 'kilo':
17+ if is_elected_leader(CLUSTER_RES) and new_os_rel >= 'kilo':
18 stamp_neutron_database(cur_os_rel)
19 migrate_neutron_database()
20
21
22=== modified file 'unit_tests/test_neutron_api_utils.py'
23--- unit_tests/test_neutron_api_utils.py 2015-04-23 07:35:40 +0000
24+++ unit_tests/test_neutron_api_utils.py 2015-07-03 15:18:40 +0000
25@@ -32,6 +32,7 @@
26 'neutron_plugin_attribute',
27 'os_release',
28 'subprocess',
29+ 'is_elected_leader',
30 ]
31
32 openstack_origin_git = \
33@@ -189,6 +190,7 @@
34 def test_do_openstack_upgrade_juno(self, git_requested,
35 stamp_neutron_db, migrate_neutron_db):
36 git_requested.return_value = False
37+ self.is_elected_leader.return_value = True
38 self.config.side_effect = self.test_config.get
39 self.test_config.set('openstack-origin', 'cloud:trusty-juno')
40 self.os_release.return_value = 'icehouse'
41@@ -226,6 +228,7 @@
42 stamp_neutron_db, migrate_neutron_db,
43 gsrc):
44 git_requested.return_value = False
45+ self.is_elected_leader.return_value = True
46 self.os_release.return_value = 'juno'
47 self.config.side_effect = self.test_config.get
48 self.test_config.set('openstack-origin', 'cloud:trusty-kilo')
49@@ -255,6 +258,46 @@
50 stamp_neutron_db.assert_called_with('juno')
51 migrate_neutron_db.assert_called_with()
52
53+ @patch.object(charmhelpers.contrib.openstack.utils,
54+ 'get_os_codename_install_source')
55+ @patch.object(nutils, 'migrate_neutron_database')
56+ @patch.object(nutils, 'stamp_neutron_database')
57+ @patch.object(nutils, 'git_install_requested')
58+ def test_do_openstack_upgrade_kilo_notleader(self, git_requested,
59+ stamp_neutron_db,
60+ migrate_neutron_db,
61+ gsrc):
62+ git_requested.return_value = False
63+ self.is_elected_leader.return_value = False
64+ self.os_release.return_value = 'juno'
65+ self.config.side_effect = self.test_config.get
66+ self.test_config.set('openstack-origin', 'cloud:trusty-kilo')
67+ gsrc.return_value = 'kilo'
68+ self.get_os_codename_install_source.return_value = 'kilo'
69+ configs = MagicMock()
70+ nutils.do_openstack_upgrade(configs)
71+ self.os_release.assert_called_with('neutron-server')
72+ self.log.assert_called()
73+ self.configure_installation_source.assert_called_with(
74+ 'cloud:trusty-kilo'
75+ )
76+ self.apt_update.assert_called_with(fatal=True)
77+ dpkg_opts = [
78+ '--option', 'Dpkg::Options::=--force-confnew',
79+ '--option', 'Dpkg::Options::=--force-confdef',
80+ ]
81+ self.apt_upgrade.assert_called_with(options=dpkg_opts,
82+ fatal=True,
83+ dist=True)
84+ pkgs = nutils.determine_packages()
85+ pkgs.sort()
86+ self.apt_install.assert_called_with(packages=pkgs,
87+ options=dpkg_opts,
88+ fatal=True)
89+ configs.set_release.assert_called_with(openstack_release='kilo')
90+ self.assertFalse(stamp_neutron_db.called)
91+ self.assertFalse(migrate_neutron_db.called)
92+
93 @patch.object(ncontext, 'IdentityServiceContext')
94 @patch('neutronclient.v2_0.client.Client')
95 def test_get_neutron_client(self, nclient, IdentityServiceContext):

Subscribers

People subscribed via source and target branches