Merge lp:~hopem/charms/trusty/cinder/default-to-glance-v2-api into lp:~openstack-charmers-archive/charms/trusty/cinder/next

Proposed by Edward Hope-Morley
Status: Rejected
Rejected by: James Page
Proposed branch: lp:~hopem/charms/trusty/cinder/default-to-glance-v2-api
Merge into: lp:~openstack-charmers-archive/charms/trusty/cinder/next
Diff against target: 94 lines (+34/-14)
3 files modified
config.yaml (+1/-1)
hooks/cinder_contexts.py (+10/-2)
unit_tests/test_cinder_contexts.py (+23/-11)
To merge this branch: bzr merge lp:~hopem/charms/trusty/cinder/default-to-glance-v2-api
Reviewer Review Type Date Requested Status
OpenStack Charmers Pending
Review via email: mp+284752@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 #18508 cinder-next for hopem mp284752
    LINT OK: passed

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

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

charm_unit_test #17244 cinder-next for hopem mp284752
    UNIT OK: passed

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

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

charm_amulet_test #9154 cinder-next for hopem mp284752
    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/14859709/
Build: http://10.245.162.77:8080/job/charm_amulet_test/9154/

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

charm_lint_check #120 cinder-next for hopem mp284752
    LINT OK: passed

Build: http://10.245.162.36:8080/job/charm_lint_check/120/

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

charm_unit_test #129 cinder-next for hopem mp284752
    UNIT OK: passed

Build: http://10.245.162.36:8080/job/charm_unit_test/129/

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

charm_amulet_test #17 cinder-next for hopem mp284752
    AMULET OK: passed

Build: http://10.245.162.36:8080/job/charm_amulet_test/17/

Revision history for this message
James Page (james-page) wrote :

If icehouse supports glance v2, lets just default it in the template to v2 and drop the config option and related code please.

Revision history for this message
James Page (james-page) wrote :

Please re-target to git/gerrit

Unmerged revisions

56. By Edward Hope-Morley

Use v2 glance api by default

Cinder requires the v2 glance api to perform operations like COW
cloning images so lets use it by default.

Closes-Bug: 1262125

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'config.yaml'
2--- config.yaml 2015-12-03 22:58:37 +0000
3+++ config.yaml 2016-02-02 16:07:24 +0000
4@@ -143,7 +143,7 @@
5 type: string
6 description: OpenStack Region
7 glance-api-version:
8- default: 1
9+ default: 2
10 type: int
11 description: |
12 Newer storage drivers may require the v2 Glance API to perform certain
13
14=== modified file 'hooks/cinder_contexts.py'
15--- hooks/cinder_contexts.py 2015-09-30 11:07:30 +0000
16+++ hooks/cinder_contexts.py 2016-02-02 16:07:24 +0000
17@@ -5,6 +5,7 @@
18 related_units,
19 relation_get,
20 log,
21+ INFO,
22 WARNING,
23 )
24
25@@ -15,7 +16,8 @@
26 )
27
28 from charmhelpers.contrib.openstack.utils import (
29- get_os_codename_install_source
30+ get_os_codename_install_source,
31+ os_release,
32 )
33
34 from charmhelpers.contrib.hahelpers.cluster import (
35@@ -30,7 +32,13 @@
36 def __call__(self):
37 if not relation_ids('image-service'):
38 return {}
39- return {'glance_api_version': config('glance-api-version')}
40+
41+ g_api_version = config('glance-api-version')
42+ if g_api_version > 1 and os_release('cinder-common') == "essex":
43+ log("Setting Glance API version to 1", level=INFO)
44+ g_api_version = 1
45+
46+ return {'glance_api_version': g_api_version}
47
48
49 class CephContext(OSContextGenerator):
50
51=== modified file 'unit_tests/test_cinder_contexts.py'
52--- unit_tests/test_cinder_contexts.py 2015-09-11 10:36:23 +0000
53+++ unit_tests/test_cinder_contexts.py 2016-02-02 16:07:24 +0000
54@@ -31,17 +31,29 @@
55 self.relation_ids.return_value = []
56 self.assertEquals(contexts.ImageServiceContext()(), {})
57
58- def test_glance_related(self):
59- self.relation_ids.return_value = ['image-service:0']
60- self.config.return_value = '1'
61- self.assertEquals(contexts.ImageServiceContext()(),
62- {'glance_api_version': '1'})
63-
64- def test_glance_related_api_v2(self):
65- self.relation_ids.return_value = ['image-service:0']
66- self.config.return_value = '2'
67- self.assertEquals(contexts.ImageServiceContext()(),
68- {'glance_api_version': '2'})
69+ @patch.object(contexts, 'os_release')
70+ def test_glance_related(self, mock_os_release):
71+ mock_os_release.return_value = "liberty"
72+ self.relation_ids.return_value = ['image-service:0']
73+ self.config.return_value = 1
74+ self.assertEquals(contexts.ImageServiceContext()(),
75+ {'glance_api_version': 1})
76+
77+ @patch.object(contexts, 'os_release')
78+ def test_glance_related_api_v2(self, mock_os_release):
79+ mock_os_release.return_value = "liberty"
80+ self.relation_ids.return_value = ['image-service:0']
81+ self.config.return_value = 2
82+ self.assertEquals(contexts.ImageServiceContext()(),
83+ {'glance_api_version': 2})
84+
85+ @patch.object(contexts, 'os_release')
86+ def test_glance_related_api_v2_unsupported(self, mock_os_release):
87+ mock_os_release.return_value = "essex"
88+ self.relation_ids.return_value = ['image-service:0']
89+ self.config.return_value = 2
90+ self.assertEquals(contexts.ImageServiceContext()(),
91+ {'glance_api_version': 1})
92
93 def test_ceph_not_related(self):
94 self.relation_ids.return_value = []

Subscribers

People subscribed via source and target branches