The behaviors of creating and updating mapping cell0 differ

Bug #1794493 reported by Scott Wulf on 2018-09-26
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Medium
Surya Seetharaman

Bug Description

Description
===========
The behaviors of creating and updating cell0 differ. Given that the parameters to nova-manage did not change, I would have expected no changes made to the cell_mappings table other than updating updated_at.

Steps to reproduce
==================
NOTE: Be sure to replace <MUST_BE_A_VALID_NOVA_API_DB_CONNECTION_STRING> in api.conf with a valid db connection string.
OPTIONAL NOTE: In order to restart nova-api and run "nova service-list" successfully, replace "mysql+pymysql://nova:novapwd@vip/nova?ssl_ca=/etc/ssl/ca-bundle.pem" in api.conf with a valid db connection string.

controller1:~ # mkdir -p /etc/novabug
controller1:~ # cat << EOF > /etc/novabug/api.conf
[database]
backend = sqlalchemy
connection = mysql+pymysql://nova:novapwd@vip/nova?ssl_ca=/etc/ssl/ca-bundle.pem
[api_database]
connection = <MUST_BE_A_VALID_NOVA_API_DB_CONNECTION_STRING>
EOF
controller1:~ # cat << EOF > /etc/novabug/nova.conf
[DEFAULT]
transport_url = rabbit://rabbit:rabbitpwd@vip:5671/
EOF
controller1:~ # chown -R nova:nova /etc/novabug
controller1:~ # /usr/local/bin/nova-manage --config-file /etc/novabug/nova.conf --config-file /etc/novabug/api.conf cell_v2 map_cell0
controller1:~ # mysql -D nova_api -e "select * from cell_mappings"
+---------------------+---------------------+----+--------------------------------------+-------+------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+
| created_at | updated_at | id | uuid | name | transport_url | database_connection |
+---------------------+---------------------+----+--------------------------------------+-------+------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+
| 2018-09-26 09:14:21 | NULL | 1 | 00000000-0000-0000-0000-000000000000 | cell0 | none:/// | mysql+pymysql://nova:novapwd@vip/nova_cell0?ssl_ca=/etc/ssl/ca-bundle.pem |
+---------------------+---------------------+----+--------------------------------------+-------+------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+

controller1:~ # /usr/local/bin/nova-manage --config-file /etc/novabug/nova.conf --config-file /etc/novabug/api.conf cell_v2 update_cell --cell_uuid 00000000-0000-0000-0000-000000000000
controller1:~ # mysql -D nova_api -e "select * from cell_mappings"
+---------------------+---------------------+----+--------------------------------------+-------+------------------------------------------------------------+----------------------------------------------------------------------------------------------------+
| created_at | updated_at | id | uuid | name | transport_url | database_connection |
+---------------------+---------------------+----+--------------------------------------+-------+------------------------------------------------------------+----------------------------------------------------------------------------------------------------+
| 2018-09-26 09:14:21 | 2018-09-26 09:15:01 | 1 | 00000000-0000-0000-0000-000000000000 | cell0 | rabbit://rabbit:rabbitpwd@vip:5671/ | mysql+pymysql://nova:novapwd@vip/nova?ssl_ca=/etc/ssl/ca-bundle.pem |
+---------------------+---------------------+----+--------------------------------------+-------+------------------------------------------------------------+----------------------------------------------------------------------------------------------------+

Expected result
===============
Given that the parameters to nova-manage did not change, I would have expected no changes made to the transport_url and database_connection values of cell0.

Actual result
=============
After running "cell_v2 update_cell --cell_uuid 00000000-0000-0000-0000-000000000000", the transport_url changed from the hardcoded "none:///" from CellV2Commands.map_cell0() to the actual transport URL from nova.conf and the database_connection value lost it's string "_cell0" previously added by the nested function CellV2Commands.map_cell0().cell0_default_connection(). These changes cause ripple effects like the duplication of all rows in the output of "nova service-list" [as well as in Horizon]. See below.

controller1:~ # service nova-api restart
controller1:~ # nova service-list
+----+------------------+----------------+----------+---------+-------+----------------------------+-----------------+
| Id | Binary | Host | Zone | Status | State | Updated_at | Disabled Reason |
+----+------------------+----------------+----------+---------+-------+----------------------------+-----------------+
| 1 | nova-conductor | controller1 | internal | enabled | up | 2018-09-26T09:19:13.000000 | - |
| 2 | nova-scheduler | controller1 | internal | enabled | up | 2018-09-26T09:19:05.000000 | - |
| 3 | nova-consoleauth | controller1 | internal | enabled | up | 2018-09-26T09:19:07.000000 | - |
| 6 | nova-compute | compute001 | nova | enabled | up | 2018-09-26T09:19:09.000000 | - |
| 1 | nova-conductor | controller1 | internal | enabled | up | 2018-09-26T09:19:13.000000 | - |
| 2 | nova-scheduler | controller1 | internal | enabled | up | 2018-09-26T09:19:05.000000 | - |
| 3 | nova-consoleauth | controller1 | internal | enabled | up | 2018-09-26T09:19:07.000000 | - |
| 6 | nova-compute | compute001 | nova | enabled | up | 2018-09-26T09:19:09.000000 | - |
+----+------------------+----------------+----------+---------+-------+----------------------------+-----------------+

Environment
===========
Version: Current master branch

Workaround
==========
We are having to avoid using the --config-file parameters altogether and duplicate the cell0 logic from nova/cmd/manage.py in our own scripts by:
1) For "cell_v2 map_cell0", specifying --database_connection containing "_cell0"
2) For "cell_v2 update_cell" of cell0, specifying --database_connection containing "_cell0" and --transport-url of "none:///"
3) For creating or updating cell1, specifying --database_connection not containing "_cell0" and the actual --transport-url

Scott Wulf (scottwulf) on 2018-09-26
summary: - The behaviors of creating and updating cell0 mapping differ
+ The behaviors of creating and updating mapping cell0 differ
tags: added: cells nova-manage
Surya Seetharaman (tssurya) wrote :

This is similar to https://bugs.launchpad.net/nova/+bug/1793423 but for cell0 and it had a review https://review.openstack.org/#/c/603998 submitted and it was abandoned because this behavior of update_cell taking options from the config file is designed on purpose. See the comments. It would be expected that the corresponding config file of that cell conductor (default nova.conf for cell0) would be used for the update of that cell. However since cell0 is a special case and it doesn't have a transport url, the update_cell command should check for this and not update the cell0's transport_url when using the default nova.conf (like in the default devstack setup), just like we don't allow disabling cell0.

Changed in nova:
importance: Undecided → Medium
status: New → Triaged
assignee: nobody → Surya Seetharaman (tssurya)

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

Changed in nova:
status: Triaged → In Progress
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers