nova-manage update_cell does not check if the same combination of transport_url and database_connection already exists

Bug #1729806 reported by Surya Seetharaman
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
Surya Seetharaman
Ocata
Triaged
Low
Unassigned
Pike
Triaged
Low
Surya Seetharaman

Bug Description

Unlike in nova-manage create_cell, in nova-manage update_cell the check for the same combination of transport-url and database_connection does not exist. Hence it allows a user to update a cell's transport-url and database_connection to another existing cell's configuration which can create inconsistency (if a user accidentally does do it) and should not be allowed IMO.

Steps to Reproduce :

-> nova-manage cell_v2 list_cells

+-------+--------------------------------------+-----------------------------------------------------------+--------------------------------------------------------------------+
| Name | UUID | Transport URL | Database Connection |
+-------+--------------------------------------+-----------------------------------------------------------+--------------------------------------------------------------------+
| cell0 | 00000000-0000-0000-0000-000000000000 | none:/ | mysql+pymysql://root:****@127.0.0.1/nova_cell0?charset=utf8 |
| cell1 | 20f9fd43-7295-4f67-8f0c-7828b12f5e4f | rabbit://stackrabbit:****@188.185.83.1:5672/nova_cell1 | mysql+pymysql://root:****@188.185.83.1/nova_cell1?charset=utf8 |
| cell2 | 7acaf644-d181-420b-ac80-486b83793bd2 | rabbit://stackrabbit:****@188.185.83.2:5672/nova_cell1 | mysql+pymysql://root:****@188.185.83.2/nova_cell1?charset=utf8 |
+-------+--------------------------------------+-----------------------------------------------------------+--------------------------------------------------------------------+

-> nova-manage cell_v2 update_cell --cell-uuid 7acaf644-d181-420b-ac80-486b83793bd2 --transport-url rabbit://stackrabbit:****@188.185.83.1:5672/nova_cell1 --database_connection mysql+pymysql://root:****@188.185.83.1/nova_cell1?charset=utf8

Expected result
===============
"Cell with the specified transport_url and database_connection combination already exists"

Actual result
=============

-> nova-manage cell_v2 list_cells

+-------+--------------------------------------+-----------------------------------------------------------+--------------------------------------------------------------------+
| Name | UUID | Transport URL | Database Connection |
+-------+--------------------------------------+-----------------------------------------------------------+--------------------------------------------------------------------+
| cell0 | 00000000-0000-0000-0000-000000000000 | none:/ | mysql+pymysql://root:****@127.0.0.1/nova_cell0?charset=utf8 |
| cell1 | 20f9fd43-7295-4f67-8f0c-7828b12f5e4f | rabbit://stackrabbit:****@188.185.83.1:5672/nova_cell1 | mysql+pymysql://root:****@188.185.83.1/nova_cell1?charset=utf8 |
| cell2 | 7acaf644-d181-420b-ac80-486b83793bd2 | rabbit://stackrabbit:****@188.185.83.1:5672/nova_cell1 | mysql+pymysql://root:****@188.185.83.1/nova_cell1?charset=utf8 |
+-------+--------------------------------------+-----------------------------------------------------------+--------------------------------------------------------------------+

Solution : The same kind of check in nova-manage create_cell needs to be done in nova-manage update_cell as well.

Revision history for this message
Matt Riedemann (mriedem) wrote :

Ideally we'd just have a unique constraint across those two columns in the cell_mappings table in the API database, but I'm not sure if there is a case where we'd want more than once cell to have the same db/transport urls, probably not, especially since we don't have a concept of disabled cells.

Changed in nova:
importance: Undecided → Low
status: New → Confirmed
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/518556

Changed in nova:
status: Confirmed → In Progress
Revision history for this message
Surya Seetharaman (tssurya) wrote :

mriedem : Is is possible to add a unique constraint to these columns since they of type "Text()". I do not see MYSQL supporting it directly, I see some hashing solution being suggested. Is there a work around that we use in nova ?

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

Reviewed: https://review.openstack.org/518556
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=c34e37eef31add8224211b799a56d866c5013fbd
Submitter: Zuul
Branch: master

commit c34e37eef31add8224211b799a56d866c5013fbd
Author: Surya Seetharaman <email address hidden>
Date: Wed Nov 8 15:57:16 2017 +0100

    update_cell allows more than once cell to have the same db/transport url

    Unlike in nova-manage create_cell, in nova-manage update_cell the check
    for the same combination of transport-url and/or database_connection
    does not exist. Hence it allows a user to update a cell's transport-url
    and/or database_connection to another existing cell's transport/db urls.

    Change-Id: Ia5d5566c535d6da3d215392590a2d362e1226424
    Closes-Bug: #1729806

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

This issue was fixed in the openstack/nova 17.0.0.0b3 development milestone.

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.