summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hamilton <peter.hamilton@jhuapl.edu>2014-02-11 08:36:41 -0500
committerAvishay Traeger <avishay@il.ibm.com>2014-02-12 21:38:41 +0200
commit6fd8d8e12e7788e7f5b85bc3b8ef2f6ee2eb7714 (patch)
tree13e897803d49399207015e7dd6638a16d3d07044
parent7914e46b03614dde9ae4604cfe35b283d3a55253 (diff)
downloadpython-cinderclient-6fd8d8e12e7788e7f5b85bc3b8ef2f6ee2eb7714.tar.gz
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
-rw-r--r--cinderclient/tests/v1/fakes.py4
-rw-r--r--cinderclient/tests/v1/test_shell.py2
-rw-r--r--cinderclient/tests/v2/fakes.py4
-rw-r--r--cinderclient/tests/v2/test_shell.py2
-rw-r--r--cinderclient/v1/shell.py6
-rw-r--r--cinderclient/v2/shell.py6
-rw-r--r--doc/source/index.rst1
7 files changed, 13 insertions, 12 deletions
diff --git a/cinderclient/tests/v1/fakes.py b/cinderclient/tests/v1/fakes.py
index 648733c..3df0d95 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 8c2e33d..a7e6f1e 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 890fa53..826babc 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 4946ada..3c1a011 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 02ea769..140d59c 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 636c812..f57c8e0 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 fc94395..04e70fd 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
-----