~ubuntu-cloud-archive/ubuntu/precise/nova/trunk

« back to all changes in this revision

Viewing changes to nova/api/openstack/compute/contrib/flavor_access.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Chuck Short, Soren Hansen
  • Date: 2012-09-07 17:49:53 UTC
  • mfrom: (1.1.61)
  • Revision ID: package-import@ubuntu.com-20120907174953-oapuvix1jxm830he
Tags: 2012.2~rc1~20120907.15996-0ubuntu1
[ Chuck Short ]
* New upstream release.
* debian/nova-common.postinst: Drop nova_sudoers permission changing
  since we do it in the debian/rules. (LP: #995285)

[ Soren Hansen ]
* Update debian/watch to account for symbolically named tarballs and
  use newer URL.
* Fix Launchpad URLs in debian/watch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
139
139
        if authorize(context):
140
140
            # Attach our slave template to the response object
141
141
            resp_obj.attach(xml=FlavorextradatumTemplate())
142
 
 
143
 
            try:
144
 
                flavor_ref = instance_types.get_instance_type_by_flavor_id(id)
145
 
            except exception.FlavorNotFound:
146
 
                explanation = _("Flavor not found.")
147
 
                raise webob.exc.HTTPNotFound(explanation=explanation)
148
 
 
149
 
            self._extend_flavor(resp_obj.obj['flavor'], flavor_ref)
 
142
            db_flavor = req.get_db_flavor(id)
 
143
 
 
144
            self._extend_flavor(resp_obj.obj['flavor'], db_flavor)
150
145
 
151
146
    @wsgi.extends
152
147
    def detail(self, req, resp_obj):
156
151
            resp_obj.attach(xml=FlavorextradataTemplate())
157
152
 
158
153
            flavors = list(resp_obj.obj['flavors'])
159
 
            flavor_refs = self._get_flavor_refs(context)
160
 
 
161
154
            for flavor_rval in flavors:
162
 
                flavor_ref = flavor_refs[flavor_rval['id']]
163
 
                self._extend_flavor(flavor_rval, flavor_ref)
 
155
                db_flavor = req.get_db_flavor(flavor_rval['id'])
 
156
                self._extend_flavor(flavor_rval, db_flavor)
164
157
 
165
158
    @wsgi.extends(action='create')
166
159
    def create(self, req, body, resp_obj):
169
162
            # Attach our slave template to the response object
170
163
            resp_obj.attach(xml=FlavorextradatumTemplate())
171
164
 
172
 
            try:
173
 
                fid = resp_obj.obj['flavor']['id']
174
 
                flavor_ref = instance_types.get_instance_type_by_flavor_id(fid)
175
 
            except exception.FlavorNotFound:
176
 
                explanation = _("Flavor not found.")
177
 
                raise webob.exc.HTTPNotFound(explanation=explanation)
 
165
            db_flavor = req.get_db_flavor(resp_obj.obj['flavor']['id'])
178
166
 
179
 
            self._extend_flavor(resp_obj.obj['flavor'], flavor_ref)
 
167
            self._extend_flavor(resp_obj.obj['flavor'], db_flavor)
180
168
 
181
169
    @wsgi.serializers(xml=FlavorAccessTemplate)
182
170
    @wsgi.action("addTenantAccess")