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
This commit is contained in:
Peter Hamilton 2014-02-11 08:36:41 -05:00 committed by Avishay Traeger
parent 7914e46b03
commit 6fd8d8e12e
7 changed files with 13 additions and 12 deletions

View File

@ -467,13 +467,13 @@ class FakeHTTPClient(base_client.HTTPClient):
def get_types_1_encryption(self, **kw):
return (200, {}, {'id': 1, 'volume_type_id': 1, 'provider': 'test',
'cipher': 'test', 'key_size': 1,
'control_location': 'front'})
'control_location': 'front-end'})
def get_types_2_encryption(self, **kw):
return (200, {}, {})
def post_types_2_encryption(self, body, **kw):
return (200, {}, {'encryption': {}})
return (200, {}, {'encryption': body})
def put_types_1_encryption_1(self, body, **kw):
return (200, {}, {})

View File

@ -273,7 +273,7 @@ class ShellTest(utils.TestCase):
"""
expected = {'encryption': {'cipher': None, 'key_size': None,
'provider': 'TestProvider',
'control_location': None}}
'control_location': 'front-end'}}
self.run_command('encryption-type-create 2 TestProvider')
self.assert_called('POST', '/types/2/encryption', body=expected)
self.assert_called_anytime('GET', '/types/2')

View File

@ -478,13 +478,13 @@ class FakeHTTPClient(base_client.HTTPClient):
def get_types_1_encryption(self, **kw):
return (200, {}, {'id': 1, 'volume_type_id': 1, 'provider': 'test',
'cipher': 'test', 'key_size': 1,
'control_location': 'front'})
'control_location': 'front-end'})
def get_types_2_encryption(self, **kw):
return (200, {}, {})
def post_types_2_encryption(self, body, **kw):
return (200, {}, {'encryption': {}})
return (200, {}, {'encryption': body})
def put_types_1_encryption_1(self, body, **kw):
return (200, {}, {})

View File

@ -251,7 +251,7 @@ class ShellTest(utils.TestCase):
"""
expected = {'encryption': {'cipher': None, 'key_size': None,
'provider': 'TestProvider',
'control_location': None}}
'control_location': 'front-end'}}
self.run_command('encryption-type-create 2 TestProvider')
self.assert_called('POST', '/types/2/encryption', body=expected)
self.assert_called_anytime('GET', '/types/2')

View File

@ -1132,10 +1132,10 @@ def do_encryption_type_show(cs, args):
choices=['front-end', 'back-end'],
type=str,
required=False,
default=None,
default='front-end',
help="Notional service where encryption is performed (e.g., "
"front-end=Nova). Values: 'front-end', 'back-end' "
"(Optional, Default=None)")
"front-end=Nova) Values: 'front-end', 'back-end' "
"(Default='front-end')")
@utils.service_type('volume')
def do_encryption_type_create(cs, args):
"""Create a new encryption type for a volume type (Admin Only)."""

View File

@ -1240,10 +1240,10 @@ def do_encryption_type_show(cs, args):
choices=['front-end', 'back-end'],
type=str,
required=False,
default=None,
default='front-end',
help="Notional service where encryption is performed (e.g., "
"front-end=Nova). Values: 'front-end', 'back-end' "
"(Optional, Default=None)")
"front-end=Nova) Values: 'front-end', 'back-end' "
"(Default='front-end')")
@utils.service_type('volumev2')
def do_encryption_type_create(cs, args):
"""Create a new encryption type for a volume type (Admin Only)."""

View File

@ -33,6 +33,7 @@ Release Notes
MASTER
------
.. _1255905: http://bugs.launchpad.net/python-cinderclient/+bug/1255905
.. _1267168: http://bugs.launchpad.net/python-cinderclient/+bug/1267168
1.0.8
-----