~ubuntu-branches/ubuntu/saucy/nova/saucy-proposed

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-05-24 13:12:53 UTC
  • mfrom: (1.1.55)
  • Revision ID: package-import@ubuntu.com-20120524131253-ommql08fg1en06ut
Tags: 2012.2~f1-0ubuntu1
* New upstream release.
* Prepare for quantal:
  - Dropped debian/patches/upstream/0006-Use-project_id-in-ec2.cloud._format_image.patch
  - Dropped debian/patches/upstream/0005-Populate-image-properties-with-project_id-again.patch
  - Dropped debian/patches/upstream/0004-Fixed-bug-962840-added-a-test-case.patch
  - Dropped debian/patches/upstream/0003-Allow-unprivileged-RADOS-users-to-access-rbd-volumes.patch
  - Dropped debian/patches/upstream/0002-Stop-libvirt-test-from-deleting-instances-dir.patch
  - Dropped debian/patches/upstream/0001-fix-bug-where-nova-ignores-glance-host-in-imageref.patch 
  - Dropped debian/patches/0001-fix-useexisting-deprecation-warnings.patch
* debian/control: Add python-keystone as a dependency. (LP: #907197)
* debian/patches/kombu_tests_timeout.patch: Refreshed.
* debian/nova.conf, debian/nova-common.postinst: Convert to new ini
  file configuration
* debian/patches/nova-manage_flagfile_location.patch: Refreshed

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 import extensions
22
23
from nova.api.openstack import wsgi
23
24
from nova.api.openstack import xmlutil
24
 
from nova.api.openstack import extensions
25
25
from nova import db
26
26
from nova import exception
27
27
 
66
66
            db.instance_type_extra_specs_update_or_create(context,
67
67
                                                              flavor_id,
68
68
                                                              specs)
69
 
        except exception.QuotaError as error:
70
 
            self._handle_quota_error(error)
 
69
        except exception.MetadataLimitExceeded as error:
 
70
            raise exc.HTTPBadRequest(explanation=unicode(error))
71
71
        return body
72
72
 
73
73
    @wsgi.serializers(xml=ExtraSpecsTemplate)
85
85
            db.instance_type_extra_specs_update_or_create(context,
86
86
                                                               flavor_id,
87
87
                                                               body)
88
 
        except exception.QuotaError as error:
89
 
            self._handle_quota_error(error)
 
88
        except exception.MetadataLimitExceeded as error:
 
89
            raise exc.HTTPBadRequest(explanation=unicode(error))
90
90
 
91
91
        return body
92
92
 
107
107
        authorize(context)
108
108
        db.instance_type_extra_specs_delete(context, flavor_id, id)
109
109
 
110
 
    def _handle_quota_error(self, error):
111
 
        """Reraise quota errors as api-specific http exceptions."""
112
 
        if error.code == "MetadataLimitExceeded":
113
 
            raise exc.HTTPBadRequest(explanation=error.message)
114
 
        raise error
115
 
 
116
110
 
117
111
class Flavorextraspecs(extensions.ExtensionDescriptor):
118
112
    """Instance type (flavor) extra specs"""