Port address field not being normalized

Bug #1259269 reported by Lucas Alvares Gomes
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ironic
Fix Released
Medium
Lucas Alvares Gomes

Bug Description

Having a non-normalized mac address might result different results when filtering one port by address, some db backends are case-insensitive (mysql defaults) and some others are sensitive (pgsql defaults), we need to make sure that the address of ports are normalized before saving it to the db.

Two ways to solve this problem:
1) Normalizing the supplied MAC address on the API side.
2) Make sure the address column in the database is case insensitive regardless of the db backend.

After a small talk on IRC was decided that normalizing it on the API side would be better:

<lucasagomes> devananda, ping... should we normalize the mac address on the API side?
<lucasagomes> or at lease make the address column in the db case insensitive
<devananda> lucasagomes: morning
<devananda> lucasagomes: we should not rely on the db case-sensitivity.
<lucasagomes> Haomeng, raised that in one of my patches (actually 2 of them)
<devananda> mysql defaults to case-insensitive, but can be changed. IIRC< pgsql defaults to sensitive.
<lucasagomes> right
<lucasagomes> I thought there would be something on sqlalchmey that would take care of diff backends
<devananda> lucasagomes: i'm not aware of any setting that automatically munges the case of all inputs
<lucasagomes> devananda, right
<lucasagomes> so I think we can validate (correct format and colon-separated) and normalize it to all lower or upper (pref is lower) case in the API
<devananda> lucasagomes: ++

Changed in ironic:
assignee: nobody → Lucas Alvares Gomes (lucasagomes)
status: New → In Progress
Changed in ironic:
milestone: none → icehouse-1
aeva black (tenbrae)
Changed in ironic:
milestone: icehouse-1 → icehouse-2
aeva black (tenbrae)
Changed in ironic:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ironic (master)

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

commit c0e6e8c2b9b5cdb3c6504d0c4b0b087d33a8ce3a
Author: Lucas Alvares Gomes <email address hidden>
Date: Mon Dec 9 17:38:12 2013 +0000

    API: Validate and normalize address

    On the API side, checks whether the supplied MAC address is formally
    correct and normalize it to all lower case.

    The patch also improves the docstring of the is_valid_mac function.

    Change-Id: I6ae13888a9e17a10bba20acf829cbd01df535a3c
    Closes-Bug: #1259269

Changed in ironic:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in ironic:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in ironic:
milestone: icehouse-2 → 2014.1
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.