From 3b2842bf2df46daf4e4d26695c06963499968181 Mon Sep 17 00:00:00 2001 From: ling-yun Date: Tue, 3 Dec 2013 16:19:17 +0800 Subject: [PATCH] All API controllers inherit from wsgi.Controller Most of the Cinder Public API Controllers inherit from wsgi.Controller, but still some Cinder Public APIs controllers directly inherit from object. So it's necessary to unify all the Cinder Public API Controllers inherit from wsgi.Controller. 1. For code cleanup. 2. When we try to do body valid check in api's put/post method later, we can use the helper function is_valid_body instead of using try...catch block. Change-Id: I88812224e0b182939cfccce63982cb8f95792891 Closes-Bug: #1257198 --- cinder/api/contrib/hosts.py | 2 +- cinder/api/contrib/services.py | 2 +- cinder/api/v1/limits.py | 2 +- cinder/api/v1/snapshot_metadata.py | 2 +- cinder/api/v1/volume_metadata.py | 2 +- cinder/api/v2/limits.py | 2 +- cinder/api/v2/snapshot_metadata.py | 2 +- cinder/api/v2/volume_metadata.py | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cinder/api/contrib/hosts.py b/cinder/api/contrib/hosts.py index cf1139533..69e8070e7 100644 --- a/cinder/api/contrib/hosts.py +++ b/cinder/api/contrib/hosts.py @@ -138,7 +138,7 @@ def check_host(fn): return wrapped -class HostController(object): +class HostController(wsgi.Controller): """The Hosts API controller for the OpenStack API.""" def __init__(self): self.api = volume_api.HostAPI() diff --git a/cinder/api/contrib/services.py b/cinder/api/contrib/services.py index a72ae3047..d242e5209 100644 --- a/cinder/api/contrib/services.py +++ b/cinder/api/contrib/services.py @@ -65,7 +65,7 @@ class ServicesUpdateTemplate(xmlutil.TemplateBuilder): return xmlutil.MasterTemplate(root, 1) -class ServiceController(object): +class ServiceController(wsgi.Controller): @wsgi.serializers(xml=ServicesIndexTemplate) def index(self, req): """Return a list of all running services. diff --git a/cinder/api/v1/limits.py b/cinder/api/v1/limits.py index aeac101ed..de70243f9 100644 --- a/cinder/api/v1/limits.py +++ b/cinder/api/v1/limits.py @@ -75,7 +75,7 @@ class LimitsTemplate(xmlutil.TemplateBuilder): return xmlutil.MasterTemplate(root, 1, nsmap=limits_nsmap) -class LimitsController(object): +class LimitsController(wsgi.Controller): """Controller for accessing limits in the OpenStack API.""" @wsgi.serializers(xml=LimitsTemplate) diff --git a/cinder/api/v1/snapshot_metadata.py b/cinder/api/v1/snapshot_metadata.py index c009fbba1..87997aec4 100644 --- a/cinder/api/v1/snapshot_metadata.py +++ b/cinder/api/v1/snapshot_metadata.py @@ -24,7 +24,7 @@ from cinder import volume from webob import exc -class Controller(object): +class Controller(wsgi.Controller): """The volume metadata API controller for the OpenStack API.""" def __init__(self): diff --git a/cinder/api/v1/volume_metadata.py b/cinder/api/v1/volume_metadata.py index 3e196d114..141bbba73 100644 --- a/cinder/api/v1/volume_metadata.py +++ b/cinder/api/v1/volume_metadata.py @@ -24,7 +24,7 @@ from cinder import volume from webob import exc -class Controller(object): +class Controller(wsgi.Controller): """The volume metadata API controller for the OpenStack API.""" def __init__(self): diff --git a/cinder/api/v2/limits.py b/cinder/api/v2/limits.py index face1038d..d8f17d424 100644 --- a/cinder/api/v2/limits.py +++ b/cinder/api/v2/limits.py @@ -74,7 +74,7 @@ class LimitsTemplate(xmlutil.TemplateBuilder): return xmlutil.MasterTemplate(root, 1, nsmap=limits_nsmap) -class LimitsController(object): +class LimitsController(wsgi.Controller): """Controller for accessing limits in the OpenStack API.""" @wsgi.serializers(xml=LimitsTemplate) diff --git a/cinder/api/v2/snapshot_metadata.py b/cinder/api/v2/snapshot_metadata.py index c009fbba1..87997aec4 100644 --- a/cinder/api/v2/snapshot_metadata.py +++ b/cinder/api/v2/snapshot_metadata.py @@ -24,7 +24,7 @@ from cinder import volume from webob import exc -class Controller(object): +class Controller(wsgi.Controller): """The volume metadata API controller for the OpenStack API.""" def __init__(self): diff --git a/cinder/api/v2/volume_metadata.py b/cinder/api/v2/volume_metadata.py index b9449da0c..cf8ef548b 100644 --- a/cinder/api/v2/volume_metadata.py +++ b/cinder/api/v2/volume_metadata.py @@ -23,7 +23,7 @@ from cinder import exception from cinder import volume -class Controller(object): +class Controller(wsgi.Controller): """The volume metadata API controller for the OpenStack API.""" def __init__(self): -- 2.45.2