bulk creation does not work

Bug #1024844 reported by yong sheng gong
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Undecided
Salvatore Orlando

Bug Description

It seems bulk creation does not work in API v2.0's plugin.
This is from base.py:
    def create(self, request, body=None):
        """Creates a new instance of the requested entity"""

        body = self._prepare_request_body(request.context, body, True,
                                          allow_bulk=True)

        action = "create_%s" % self._resource

        # Check authz
        try:
            if self._collection in body:
                # Have to account for bulk create
                for item in body[self._collection]:
                    self._validate_network_tenant_ownership(
                        request,
                        item[self._resource],
                    )
                    policy.enforce(
                        request.context,
                        action,
                        item[self._resource],
                    )
            else:
                self._validate_network_tenant_ownership(
                    request,
                    body[self._resource]
                )
                policy.enforce(request.context, action, body[self._resource])
        except exceptions.PolicyNotAuthorized:
            raise webob.exc.HTTPForbidden()

        obj_creator = getattr(self._plugin, action)
        kwargs = {self._resource: body}
        obj = obj_creator(request.context, **kwargs)
        return {self._resource: self._view(obj)}
This is creator for each resource in db_base_plugin_v2.py:
    def create_port(self, context, port):
        p = port['port']
    def create_subnet(self, context, subnet):
        s = subnet['subnet']
    def create_network(self, context, network):
        n = network['network']
I cannot see any of them can deal with bulk creation.

Changed in quantum:
assignee: nobody → Salvatore Orlando (salvatore-orlando)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to quantum (master)

Fix proposed to branch: master
Review: https://review.openstack.org/10732

Changed in quantum:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to quantum (master)

Reviewed: https://review.openstack.org/10732
Committed: http://github.com/openstack/quantum/commit/ff837025e955799e69eebcab665374436649d6f8
Submitter: Jenkins
Branch: master

commit ff837025e955799e69eebcab665374436649d6f8
Author: Salvatore Orlando <email address hidden>
Date: Mon Aug 13 09:31:38 2012 -0700

    Fix bulk create operations and make them atomic.

    Bug 1024844
    Bug 1020639

    The API layer is now able to issue bulk create requests to the plugin,
    assuming that the plugin supports them. Otherwise, the API layer will
    emulate atomic behavior.
    This patch also implements OVS plugin support for bulk requests.

    Change-Id: I515148d870d0dff8371862fe577c477538364929

Changed in quantum:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in quantum:
milestone: none → folsom-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in quantum:
milestone: folsom-3 → 2012.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.