diff options
author | Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp> | 2014-04-10 20:46:13 +0900 |
---|---|---|
committer | Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp> | 2014-04-14 20:25:04 +0900 |
commit | 8e5577f52f660960738f1fc0384dff77fa30fc8a (patch) | |
tree | d6ab6aa24138d9a7acfe61303e93bc2f85c22e33 /nova/api | |
parent | 601b55f8f18ceb88f99254596d835fd60e067268 (diff) | |
download | nova-8e5577f52f660960738f1fc0384dff77fa30fc8a.tar.gz |
Allow -1 as the length of "get console output" API
Current "get console output" API does not allow -1 as the length and
returns a BadRequest response if receiving it. The other APIs(quota)
considers -1 as an unlimited value.
This patch allows -1 as the length for API consistency.
DocImpact
Change-Id: Idf88a238d1b0e545ebab5be872269b1b1030cc56
Related-Bug: #1295426
Diffstat (limited to 'nova/api')
-rw-r--r-- | nova/api/openstack/compute/plugins/v3/console_output.py | 4 | ||||
-rw-r--r-- | nova/api/openstack/compute/schemas/v3/console_output.py | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/nova/api/openstack/compute/plugins/v3/console_output.py b/nova/api/openstack/compute/plugins/v3/console_output.py index 843fe76220..8e118d4d7c 100644 --- a/nova/api/openstack/compute/plugins/v3/console_output.py +++ b/nova/api/openstack/compute/plugins/v3/console_output.py @@ -44,6 +44,10 @@ class ConsoleOutputController(wsgi.Controller): instance = common.get_instance(self.compute_api, context, id) length = body['get_console_output'].get('length') + if length is not None and int(length) == -1: + # NOTE: -1 means an unlimited length. So here translates it to None + # which also means an unlimited in the internal implementation. + length = None try: output = self.compute_api.get_console_output(context, diff --git a/nova/api/openstack/compute/schemas/v3/console_output.py b/nova/api/openstack/compute/schemas/v3/console_output.py index d3f58977eb..c3e70401a1 100644 --- a/nova/api/openstack/compute/schemas/v3/console_output.py +++ b/nova/api/openstack/compute/schemas/v3/console_output.py @@ -20,8 +20,9 @@ get_console_output = { 'properties': { 'length': { 'type': ['integer', 'string'], - 'minimum': 0, - 'pattern': '^[0-9]+$', + 'pattern': '^-?[0-9]+$', + # NOTE: -1 means an unlimited length. + 'minimum': -1, }, }, 'additionalProperties': False, |