From 6fd8d8e12e7788e7f5b85bc3b8ef2f6ee2eb7714 Mon Sep 17 00:00:00 2001 From: Peter Hamilton Date: Tue, 11 Feb 2014 08:36:41 -0500 Subject: [PATCH] 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 --- cinderclient/tests/v1/fakes.py | 4 ++-- cinderclient/tests/v1/test_shell.py | 2 +- cinderclient/tests/v2/fakes.py | 4 ++-- cinderclient/tests/v2/test_shell.py | 2 +- cinderclient/v1/shell.py | 6 +++--- cinderclient/v2/shell.py | 6 +++--- doc/source/index.rst | 1 + 7 files changed, 13 insertions(+), 12 deletions(-) diff --git a/cinderclient/tests/v1/fakes.py b/cinderclient/tests/v1/fakes.py index 648733c57..3df0d95da 100644 --- a/cinderclient/tests/v1/fakes.py +++ b/cinderclient/tests/v1/fakes.py @@ -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, {}, {}) diff --git a/cinderclient/tests/v1/test_shell.py b/cinderclient/tests/v1/test_shell.py index 8c2e33d70..a7e6f1e18 100644 --- a/cinderclient/tests/v1/test_shell.py +++ b/cinderclient/tests/v1/test_shell.py @@ -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') diff --git a/cinderclient/tests/v2/fakes.py b/cinderclient/tests/v2/fakes.py index 890fa5357..826babcef 100644 --- a/cinderclient/tests/v2/fakes.py +++ b/cinderclient/tests/v2/fakes.py @@ -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, {}, {}) diff --git a/cinderclient/tests/v2/test_shell.py b/cinderclient/tests/v2/test_shell.py index 4946adad0..3c1a01134 100644 --- a/cinderclient/tests/v2/test_shell.py +++ b/cinderclient/tests/v2/test_shell.py @@ -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') diff --git a/cinderclient/v1/shell.py b/cinderclient/v1/shell.py index 02ea76941..140d59c79 100644 --- a/cinderclient/v1/shell.py +++ b/cinderclient/v1/shell.py @@ -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).""" diff --git a/cinderclient/v2/shell.py b/cinderclient/v2/shell.py index 636c812f9..f57c8e0fb 100644 --- a/cinderclient/v2/shell.py +++ b/cinderclient/v2/shell.py @@ -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).""" diff --git a/doc/source/index.rst b/doc/source/index.rst index fc94395c6..04e70fd04 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -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 -----