nova-manage cell_v2 map_cell0 can create invalid connection URL

Bug #1696001 reported by Thom Gerdes
26
This bug affects 5 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
High
Matt Riedemann
Newton
Fix Committed
Undecided
Sylvain Bauza
Ocata
Fix Committed
Undecided
Sylvain Bauza

Bug Description

Description
===========

nova-manage cell_v2 map_cell0 will automatically generate a database connection url from the existing connection configuration setting. However, if the connection has query parameters like a charset defined, it will generate an invalid URL.

Steps to reproduce
==================
Set the following in the nova.conf:

[database]
connection = mysql+pymysql://nova:<email address hidden>/nova?charset=utf8

Run:

nova-manage cell_v2 map_cell0

Excepted result
===============

Cell0 is mapped to

mysql+pymysql://nova:<email address hidden>/nova_cell0?charset=utf8

Actual Result
=============

Cell0 is mapped to

mysql+pymysql://nova:<email address hidden>/nova?charset=utf8nova_cell0

Subsequent API calls may fail because of this with exceptions like:

2017-06-05 20:54:20.343 2197 ERROR nova.api.openstack.extensions File "/usr/lib/python2.7/dist-packages/pymysql/connections.py", line 660, in __init__
2017-06-05 20:54:20.343 2197 ERROR nova.api.openstack.extensions self.encoding = charset_by_name(self.charset).encoding
2017-06-05 20:54:20.343 2197 ERROR nova.api.openstack.extensions AttributeError: 'NoneType' object has no attribute 'encoding'

because utf8nova_cell0 is not a valid encoding.

Environment:
OpenStack Ocata,
# dpkg -l | grep nova-common
ii nova-common 2:15.0.5-1~u16.04+mcp5 all OpenStack Compute - common files

Tags: cells
Revision history for this message
Vasyl Saienko (vsaienko) wrote :
Changed in nova:
status: New → Confirmed
importance: Undecided → Medium
tags: added: cells
Matt Riedemann (mriedem)
Changed in nova:
importance: Medium → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

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

Changed in nova:
assignee: nobody → Sylvain Bauza (sylvain-bauza)
status: Confirmed → In Progress
Changed in nova:
assignee: Sylvain Bauza (sylvain-bauza) → Matt Riedemann (mriedem)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/ocata)

Fix proposed to branch: stable/ocata
Review: https://review.openstack.org/471790

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/newton)

Fix proposed to branch: stable/newton
Review: https://review.openstack.org/471796

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/471487
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=9a33092fa9b0c65b37b9fdc860f5a571908d7a69
Submitter: Jenkins
Branch: master

commit 9a33092fa9b0c65b37b9fdc860f5a571908d7a69
Author: Sylvain Bauza <email address hidden>
Date: Tue Jun 6 23:28:59 2017 +0200

    Fix cell0 naming when QS params on the connection

    We had a problem when the nova connection string included parameters on the
    query string like charset encoding.
    Note that the connection string necessarly needs to be RFC1738 compliant as
    per Sqlalchemy rules, so it's totally safe to just unquote what the SQLA
    helper method gives us as a result.

    Also removed a tested connection string since it wasn't RFC1738 compatible.

    Change-Id: I45fe9b92e8d93a0099d33bb0070e9d4e540595ac
    Closes-Bug: #1696001

Changed in nova:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 16.0.0.0b2

This issue was fixed in the openstack/nova 16.0.0.0b2 development milestone.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/ocata)

Reviewed: https://review.openstack.org/471790
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=6041572a4c95428f6b13a8d7569090b315a3abd1
Submitter: Jenkins
Branch: stable/ocata

commit 6041572a4c95428f6b13a8d7569090b315a3abd1
Author: Sylvain Bauza <email address hidden>
Date: Tue Jun 6 23:28:59 2017 +0200

    Fix cell0 naming when QS params on the connection

    We had a problem when the nova connection string included parameters on the
    query string like charset encoding.
    Note that the connection string necessarly needs to be RFC1738 compliant as
    per Sqlalchemy rules, so it's totally safe to just unquote what the SQLA
    helper method gives us as a result.

    Also removed a tested connection string since it wasn't RFC1738 compatible.

    Change-Id: I45fe9b92e8d93a0099d33bb0070e9d4e540595ac
    Closes-Bug: #1696001
    (cherry picked from commit 9a33092fa9b0c65b37b9fdc860f5a571908d7a69)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 15.0.6

This issue was fixed in the openstack/nova 15.0.6 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/newton)

Reviewed: https://review.openstack.org/471796
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=041d58a980bd92efc26b20f062af423269b28429
Submitter: Jenkins
Branch: stable/newton

commit 041d58a980bd92efc26b20f062af423269b28429
Author: Sylvain Bauza <email address hidden>
Date: Tue Jun 6 23:28:59 2017 +0200

    Fix cell0 naming when QS params on the connection

    We had a problem when the nova connection string included parameters on the
    query string like charset encoding.
    Note that the connection string necessarly needs to be RFC1738 compliant as
    per Sqlalchemy rules, so it's totally safe to just unquote what the SQLA
    helper method gives us as a result.

    Also removed a tested connection string since it wasn't RFC1738 compatible.

    Conflicts:
          nova/tests/unit/test_nova_manage.py

    NOTE(sbauza): The conflict is due to ddt not being used in Newton.

    Change-Id: I45fe9b92e8d93a0099d33bb0070e9d4e540595ac
    Closes-Bug: #1696001
    (cherry picked from commit 9a33092fa9b0c65b37b9fdc860f5a571908d7a69)
    (cherry picked from commit 6041572a4c95428f6b13a8d7569090b315a3abd1)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 14.0.8

This issue was fixed in the openstack/nova 14.0.8 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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