Skip to content

Commit 6fd8d8e

Browse files
PeterHamiltonavishay-traeger
authored andcommitted
Require ctrl_location for encryption-type-create
This bug fix addresses bug #1267168, adding a default value to the optional control_location parameter for the encryption-type-create command. Prior to this fix, any invocation of encryption-type-create that omitted the control_location parameter would fail. The failure arose from the expectations of the cinder volume encryption type API extension, which expects to always receive a value for the control_location on encryption type creation. control_location indicates which service will conduct the volume encryption for the encryption-type under consideration; valid options are 'front-end' (i.e., nova) and 'back-end' (i.e., cinder). The new default value is 'front-end' and is used whenever control_location is omitted from encryption-type-create invocation. For prior discussion and information, see the abandoned patch below: https://review.openstack.org/#/c/58303/ blueprint encrypt-cinder-volumes https://blueprints.launchpad.net/nova/+spec/encrypt-cinder-volumes Change-Id: I8db80929adbf5a3d818b9d3a8115067ae8e7d9e2 Closes-Bug: #1267168 DocImpact
1 parent 7914e46 commit 6fd8d8e

File tree

7 files changed

+13
-12
lines changed

7 files changed

+13
-12
lines changed

cinderclient/tests/v1/fakes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,13 +467,13 @@ def delete_types_1(self, **kw):
467467
def get_types_1_encryption(self, **kw):
468468
return (200, {}, {'id': 1, 'volume_type_id': 1, 'provider': 'test',
469469
'cipher': 'test', 'key_size': 1,
470-
'control_location': 'front'})
470+
'control_location': 'front-end'})
471471

472472
def get_types_2_encryption(self, **kw):
473473
return (200, {}, {})
474474

475475
def post_types_2_encryption(self, body, **kw):
476-
return (200, {}, {'encryption': {}})
476+
return (200, {}, {'encryption': body})
477477

478478
def put_types_1_encryption_1(self, body, **kw):
479479
return (200, {}, {})

cinderclient/tests/v1/test_shell.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ def test_encryption_type_create(self):
273273
"""
274274
expected = {'encryption': {'cipher': None, 'key_size': None,
275275
'provider': 'TestProvider',
276-
'control_location': None}}
276+
'control_location': 'front-end'}}
277277
self.run_command('encryption-type-create 2 TestProvider')
278278
self.assert_called('POST', '/types/2/encryption', body=expected)
279279
self.assert_called_anytime('GET', '/types/2')

cinderclient/tests/v2/fakes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,13 +478,13 @@ def delete_types_1(self, **kw):
478478
def get_types_1_encryption(self, **kw):
479479
return (200, {}, {'id': 1, 'volume_type_id': 1, 'provider': 'test',
480480
'cipher': 'test', 'key_size': 1,
481-
'control_location': 'front'})
481+
'control_location': 'front-end'})
482482

483483
def get_types_2_encryption(self, **kw):
484484
return (200, {}, {})
485485

486486
def post_types_2_encryption(self, body, **kw):
487-
return (200, {}, {'encryption': {}})
487+
return (200, {}, {'encryption': body})
488488

489489
def put_types_1_encryption_1(self, body, **kw):
490490
return (200, {}, {})

cinderclient/tests/v2/test_shell.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ def test_encryption_type_create(self):
251251
"""
252252
expected = {'encryption': {'cipher': None, 'key_size': None,
253253
'provider': 'TestProvider',
254-
'control_location': None}}
254+
'control_location': 'front-end'}}
255255
self.run_command('encryption-type-create 2 TestProvider')
256256
self.assert_called('POST', '/types/2/encryption', body=expected)
257257
self.assert_called_anytime('GET', '/types/2')

cinderclient/v1/shell.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,10 +1132,10 @@ def do_encryption_type_show(cs, args):
11321132
choices=['front-end', 'back-end'],
11331133
type=str,
11341134
required=False,
1135-
default=None,
1135+
default='front-end',
11361136
help="Notional service where encryption is performed (e.g., "
1137-
"front-end=Nova). Values: 'front-end', 'back-end' "
1138-
"(Optional, Default=None)")
1137+
"front-end=Nova) Values: 'front-end', 'back-end' "
1138+
"(Default='front-end')")
11391139
@utils.service_type('volume')
11401140
def do_encryption_type_create(cs, args):
11411141
"""Create a new encryption type for a volume type (Admin Only)."""

cinderclient/v2/shell.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,10 +1240,10 @@ def do_encryption_type_show(cs, args):
12401240
choices=['front-end', 'back-end'],
12411241
type=str,
12421242
required=False,
1243-
default=None,
1243+
default='front-end',
12441244
help="Notional service where encryption is performed (e.g., "
1245-
"front-end=Nova). Values: 'front-end', 'back-end' "
1246-
"(Optional, Default=None)")
1245+
"front-end=Nova) Values: 'front-end', 'back-end' "
1246+
"(Default='front-end')")
12471247
@utils.service_type('volumev2')
12481248
def do_encryption_type_create(cs, args):
12491249
"""Create a new encryption type for a volume type (Admin Only)."""

doc/source/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Release Notes
3333
MASTER
3434
------
3535
.. _1255905: http://bugs.launchpad.net/python-cinderclient/+bug/1255905
36+
.. _1267168: http://bugs.launchpad.net/python-cinderclient/+bug/1267168
3637

3738
1.0.8
3839
-----

0 commit comments

Comments
 (0)