Merge lp:~corey.bryant/charms/trusty/neutron-api/db-stamp into lp:~openstack-charmers-archive/charms/trusty/neutron-api/next

Proposed by Corey Bryant
Status: Merged
Merged at revision: 60
Proposed branch: lp:~corey.bryant/charms/trusty/neutron-api/db-stamp
Merge into: lp:~openstack-charmers-archive/charms/trusty/neutron-api/next
Diff against target: 125 lines (+49/-15)
3 files modified
hooks/neutron_api_hooks.py (+1/-1)
hooks/neutron_api_utils.py (+20/-2)
unit_tests/test_neutron_api_utils.py (+28/-12)
To merge this branch: bzr merge lp:~corey.bryant/charms/trusty/neutron-api/db-stamp
Reviewer Review Type Date Requested Status
Liam Young (community) Approve
Review via email: mp+238550@code.launchpad.net
To post a comment you must log in.
58. By Corey Bryant

Stamp neutron database before upgrade.

Revision history for this message
Ryan Beisner (1chb1n) wrote :

UOSCI bot says:
This MP triggered a test on the Ubuntu OSCI system. Here is a summary of results.

#456 neutron-api-next for corey.bryant mp238550
charm_unit_test

This build:
http://10.98.191.181:8080/job/charm_unit_test/456/

MP URL:
https://code.launchpad.net/~corey.bryant/charms/trusty/neutron-api/db-stamp/+merge/238550

Proposed branch:
lp:~corey.bryant/charms/trusty/neutron-api/db-stamp

Results summary:
    UNIT OK: believed to pass, but you should confirm results

UNIT Results (max last 25 lines) from
/var/lib/jenkins/workspace/charm_unit_test/unit-test.456:
Starting tests...
.......................................................
Name Stmts Miss Cover Missing
---------------------------------------------------------
hooks/neutron_api_context 80 6 93% 22, 34-36, 78, 110
hooks/neutron_api_hooks 190 16 92% 120-121, 179-180, 193, 258, 303, 322-333, 408-409
hooks/neutron_api_utils 105 8 92% 216, 249-261
---------------------------------------------------------
TOTAL 375 30 92%
----------------------------------------------------------------------
Ran 55 tests in 3.681s

OK

Ubuntu OSCI Jenkins is currently in development on a Canonical private network, but we plan to publish results to a public instance soon. Tests are triggered if the proposed branch rev changes, or if the MP is placed into "Needs review" status after being otherwise for >= 1hr. Human review of results is still recommended.
http://10.98.191.181:8080/

Revision history for this message
Ryan Beisner (1chb1n) wrote :

UOSCI bot says:
This MP triggered a test on the Ubuntu OSCI system. Here is a summary of results.

#650 neutron-api-next for corey.bryant mp238550
charm_lint_check

This build:
http://10.98.191.181:8080/job/charm_lint_check/650/

MP URL:
https://code.launchpad.net/~corey.bryant/charms/trusty/neutron-api/db-stamp/+merge/238550

Proposed branch:
lp:~corey.bryant/charms/trusty/neutron-api/db-stamp

Results summary:
    LINT OK: believed to pass, but you should confirm results

LINT Results (max last 25 lines) from
/var/lib/jenkins/workspace/charm_lint_check/make-lint.650:
I: config.yaml: option ssl_key has no default value
I: config.yaml: option os-admin-network has no default value
I: config.yaml: option nsx-controllers has no default value
I: config.yaml: option vip has no default value
I: config.yaml: option nsx-l3-uuid has no default value
I: config.yaml: option ssl_ca has no default value
I: config.yaml: option ssl_cert has no default value
I: config.yaml: option os-internal-network has no default value
I: config.yaml: option os-public-network has no default value
I: config.yaml: option nsx-tz-uuid has no default value

Ubuntu OSCI Jenkins is currently in development on a Canonical private network, but we plan to publish results to a public instance soon. Tests are triggered if the proposed branch rev changes, or if the MP is placed into "Needs review" status after being otherwise for >= 1hr. Human review of results is still recommended.
http://10.98.191.181:8080/

Revision history for this message
Ryan Beisner (1chb1n) wrote :

UOSCI bot says:
This MP triggered a test on the Ubuntu OSCI system. Here is a summary of results.

#229 neutron-api-next for corey.bryant mp238550
charm_amulet_test

This build:
http://10.98.191.181:8080/job/charm_amulet_test/229/

MP URL:
https://code.launchpad.net/~corey.bryant/charms/trusty/neutron-api/db-stamp/+merge/238550

Proposed branch:
lp:~corey.bryant/charms/trusty/neutron-api/db-stamp

Results summary:
    AMULET FAIL: amulet-test missing

AMULET Results not found.

Ubuntu OSCI Jenkins is currently in development on a Canonical private network, but we plan to publish results to a public instance soon. Tests are triggered if the proposed branch rev changes, or if the MP is placed into "Needs review" status after being otherwise for >= 1hr. Human review of results is still recommended.
http://10.98.191.181:8080/

Revision history for this message
Liam Young (gnuoy) wrote :

Approve

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/neutron_api_hooks.py'
2--- hooks/neutron_api_hooks.py 2014-10-14 16:12:41 +0000
3+++ hooks/neutron_api_hooks.py 2014-10-16 12:57:15 +0000
4@@ -165,7 +165,7 @@
5 if not relation_ids('neutron-api'):
6 log('Not running neutron database migration, no nova-cloud-controller'
7 'is present.')
8- elif os_release('nova-common') <= 'icehouse':
9+ elif os_release('neutron-server') <= 'icehouse':
10 log('Not running neutron database migration as migrations are handled'
11 'by the neutron-server process.')
12 else:
13
14=== modified file 'hooks/neutron_api_utils.py'
15--- hooks/neutron_api_utils.py 2014-10-07 12:29:50 +0000
16+++ hooks/neutron_api_utils.py 2014-10-16 12:57:15 +0000
17@@ -159,7 +159,7 @@
18
19
20 def register_configs(release=None):
21- release = release or os_release('nova-common')
22+ release = release or os_release('neutron-server')
23 configs = templating.OSConfigRenderer(templates_dir=TEMPLATES,
24 openstack_release=release)
25 for cfg, rscs in resource_map().iteritems():
26@@ -189,6 +189,7 @@
27
28 :param configs: The charms main OSConfigRenderer object.
29 """
30+ cur_os_rel = os_release('neutron-server')
31 new_src = config('openstack-origin')
32 new_os_rel = get_os_codename_install_source(new_src)
33
34@@ -210,11 +211,28 @@
35
36 # set CONFIGS to load templates from new release
37 configs.set_release(openstack_release=new_os_rel)
38+
39+ if cur_os_rel == 'icehouse':
40+ stamp_neutron_database('icehouse')
41 migrate_neutron_database()
42
43
44+def stamp_neutron_database(release):
45+ '''Stamp the database with the current release before upgrade.'''
46+ log('Stamping the neutron database with release %s.' % release)
47+ plugin = config('neutron-plugin')
48+ cmd = ['neutron-db-manage',
49+ '--config-file', NEUTRON_CONF,
50+ '--config-file', neutron_plugin_attribute(plugin,
51+ 'config',
52+ 'neutron'),
53+ 'stamp',
54+ release]
55+ subprocess.check_output(cmd)
56+
57+
58 def migrate_neutron_database():
59- '''Runs neutron-db-manage to init a new database or migrate existing'''
60+ '''Initializes a new database or upgrades an existing database.'''
61 log('Migrating the neutron database.')
62 plugin = config('neutron-plugin')
63 cmd = ['neutron-db-manage',
64
65=== modified file 'unit_tests/test_neutron_api_utils.py'
66--- unit_tests/test_neutron_api_utils.py 2014-09-30 09:17:06 +0000
67+++ unit_tests/test_neutron_api_utils.py 2014-10-16 12:57:15 +0000
68@@ -146,29 +146,45 @@
69 nutils.keystone_ca_cert_b64()
70 self.assertTrue(self.b64encode.called)
71
72- def test_do_openstack_upgrade(self):
73+ @patch.object(nutils, 'migrate_neutron_database')
74+ @patch.object(nutils, 'stamp_neutron_database')
75+ def test_do_openstack_upgrade(self, stamp_neutron_db, migrate_neutron_db):
76 self.config.side_effect = self.test_config.get
77- self.test_config.set('openstack-origin', 'cloud:precise-havana')
78- self.get_os_codename_install_source.return_value = 'havana'
79+ self.test_config.set('openstack-origin', 'cloud:trusty-juno')
80+ self.os_release.side_effect = 'icehouse'
81+ self.get_os_codename_install_source.return_value = 'juno'
82 configs = MagicMock()
83 nutils.do_openstack_upgrade(configs)
84- configs.set_release.assert_called_with(openstack_release='havana')
85+ self.os_release.assert_called_with('neutron-server')
86 self.log.assert_called()
87+ self.configure_installation_source.assert_called_with(
88+ 'cloud:trusty-juno'
89+ )
90 self.apt_update.assert_called_with(fatal=True)
91 dpkg_opts = [
92 '--option', 'Dpkg::Options::=--force-confnew',
93 '--option', 'Dpkg::Options::=--force-confdef',
94 ]
95+ self.apt_upgrade.assert_called_with(options=dpkg_opts,
96+ fatal=True,
97+ dist=True)
98 pkgs = nutils.BASE_PACKAGES
99 pkgs.sort()
100- self.apt_install.assert_called_with(
101- options=dpkg_opts,
102- packages=pkgs,
103- fatal=True
104- )
105- self.configure_installation_source.assert_called_with(
106- 'cloud:precise-havana'
107- )
108+ self.apt_install.assert_called_with(packages=pkgs,
109+ options=dpkg_opts,
110+ fatal=True)
111+ configs.set_release.assert_called_with(openstack_release='juno')
112+ stamp_neutron_db.assert_called()
113+ migrate_neutron_db.assert_called()
114+
115+ def test_stamp_neutron_database(self):
116+ nutils.stamp_neutron_database('icehouse')
117+ cmd = ['neutron-db-manage',
118+ '--config-file', '/etc/neutron/neutron.conf',
119+ '--config-file', '/etc/neutron/plugins/ml2/ml2_conf.ini',
120+ 'stamp',
121+ 'icehouse']
122+ self.subprocess.check_output.assert_called_with(cmd)
123
124 def test_migrate_neutron_database(self):
125 nutils.migrate_neutron_database()

Subscribers

People subscribed via source and target branches