~ubuntu-branches/ubuntu/quantal/nova/quantal-proposed

« back to all changes in this revision

Viewing changes to nova/api/openstack/volume/types.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-08-16 14:04:11 UTC
  • mto: This revision was merged to the branch mainline in revision 84.
  • Revision ID: package-import@ubuntu.com-20120816140411-0mr4n241wmk30t9l
Tags: upstream-2012.2~f3
ImportĀ upstreamĀ versionĀ 2012.2~f3

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
from webob import exc
21
21
 
 
22
from nova.api.openstack.volume.views import types as views_types
22
23
from nova.api.openstack import wsgi
23
24
from nova.api.openstack import xmlutil
24
25
from nova import exception
48
49
        return xmlutil.MasterTemplate(root, 1)
49
50
 
50
51
 
51
 
class VolumeTypesController(object):
 
52
class VolumeTypesController(wsgi.Controller):
52
53
    """ The volume types API controller for the OpenStack API """
53
54
 
 
55
    _view_builder_class = views_types.ViewBuilder
 
56
 
54
57
    @wsgi.serializers(xml=VolumeTypesTemplate)
55
58
    def index(self, req):
56
59
        """ Returns the list of volume types """
57
60
        context = req.environ['nova.context']
58
 
        return {'volume_types': volume_types.get_all_types(context).values()}
 
61
        vol_types = volume_types.get_all_types(context).values()
 
62
        return self._view_builder.index(req, vol_types)
59
63
 
60
64
    @wsgi.serializers(xml=VolumeTypeTemplate)
61
65
    def show(self, req, id):
69
73
 
70
74
        # TODO(bcwaldon): remove str cast once we use uuids
71
75
        vol_type['id'] = str(vol_type['id'])
72
 
        return {'volume_type': vol_type}
 
76
        return self._view_builder.show(req, vol_type)
73
77
 
74
78
 
75
79
def create_resource():