provide way to specify id in models_v2

Bug #1025127 reported by Aaron Rosen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Undecided
Aaron Rosen

Bug Description

Currently in models_v2.py there is no way to pass in your own id for tables that inherit HasId.

For example:

class HasId(object):
    """id mixin, add to subclasses that have an id."""
    id = sa.Column(sa.String(36), primary_key=True, default=utils.str_uuid)

class Network(model_base.BASEV2, HasId, HasTenant):
    <...snip>

I suggest modifying db_base_plugin_v2.py so this is possible:

For example:

  def create_network(self, context, network):
        n = network['network']

        tenant_id = self._get_tenant_id_for_create(context, n)
        with context.session.begin():
            network = models_v2.Network(tenant_id=tenant_id,
                                        id = n.get('id') or utils.str_uuid(),
           <..snip>

This modification would not change the interface at all. Does anyone have any strong opinions against this? If not I'll make a bug report and provide the patch.

Thanks,

Aaron

Aaron Rosen (arosen)
Changed in quantum:
assignee: nobody → Aaron Rosen (arosen)
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/9893

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/9893
Committed: http://github.com/openstack/quantum/commit/659d0ba03a076bdacc141069ee4837ac5bc1ccc8
Submitter: Jenkins
Branch: master

commit 659d0ba03a076bdacc141069ee4837ac5bc1ccc8
Author: Aaron Rosen <email address hidden>
Date: Tue Jul 17 01:59:10 2012 -0400

    Provide way to specify id in models_v2

    Bug #1025127

    Change-Id: Ie4112b841c1e42408cdb539c2b87446c596e92ba

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

Related questions

Remote bug watches

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