Comment 6 for bug 1314732

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to ironic (master)

Reviewed: https://review.openstack.org/109252
Committed: https://git.openstack.org/cgit/openstack/ironic/commit/?id=b22507913ab741a46b67ccad14ecd35df14dad3e
Submitter: Jenkins
Branch: master

commit b22507913ab741a46b67ccad14ecd35df14dad3e
Author: Lucas Alvares Gomes <email address hidden>
Date: Thu Jul 24 11:56:47 2014 +0100

    Clean up calls to get_port()

    The same work have already been done by Nodes (see 2192f2848e), so right
    now the dbapi's are inconsistent across different objects. This patch
    fixes it for Port.

    This patch removes all direct calls to dbapi's get_port(). They are
    replaced either by Port.get(), Port.get_by_id(), Port.get_by_uuid()
    or Port.get_by_address() calls.

    Additional detail about the changes:

    1) Break DBAPI get_port() into get_port_by_id(), get_port_by_uuid(),
    and get_port_by_address(). Let's be explicit about which type we're
    passing. This allows Port.get_by_uuid() to work exactly how its
    named. Also, do not return an object from the DB API calls. The Chassis
    object itself will do the conversion.

    2) Adds Port.get_by_id() and Port.get_by_address to compliment the
    current Port.get_by_uuid() for places you are querying by the ID.

    3) Adds Port.get() so that you can still have a single method to use to
    pass either and ID, UUID or MAC address.

    4) Make all of the Port.get* calls set the 'context' so that you can
    later just port.save() without passing it. Doc strings have been updated
    to clarify what 'context' is for.

    Co-Authored-By: Chris Behrens <email address hidden>
    Related-Bug: #1314732
    Change-Id: I39d9a7acc12f0f3b7e06abd038537cd2759fb088