Upgrade from bionic-rocky to bionic-stein failed migrations.

Bug #1835037 reported by Angel Vargas
14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
In Progress
Undecided
Unassigned
OpenStack Nova Cloud Controller Charm
Fix Released
Critical
Unassigned

Bug Description

We were trying to upgrade from rocky to stein using the charm procedure described here:

https://docs.openstack.org/project-deploy-guide/charm-deployment-guide/latest/app-upgrade-openstack.html

and we got into this problem,

2019-07-02 09:56:44 ERROR juju-log online_data_migrations failed
b'Running batches of 50 until complete\nError attempting to run <function fill_virtual_interface_list at 0x7fee41f77048>\n9 rows matched query populate_user_id, 0 migrated\n+---------------------------------------------+--------------+-----------+\n| Migration | Total Needed | Completed |\n+---------------------------------------------+--------------+-----------+\n| create_incomplete_consumers | 0 | 0 |\n| delete_build_requests_with_no_instance_uuid | 0 | 0 |\n| fill_virtual_interface_list | 0 | 0 |\n| migrate_empty_ratio | 0 | 0 |\n| migrate_keypairs_to_api_db | 0 | 0 |\n| migrate_quota_classes_to_api_db | 0 | 0 |\n| migrate_quota_limits_to_api_db | 0 | 0 |\n| migration_migrate_to_uuid | 0 | 0 |\n| populate_missing_availability_zones | 0 | 0 |\n| populate_queued_for_delete | 0 | 0 |\n| populate_user_id | 9 | 0 |\n| populate_uuids | 0 | 0 |\n| service_uuids_online_data_migration | 0 | 0 |\n+---------------------------------------------+--------------+-----------+\nSome migrations failed unexpectedly. Check log for details.\n'

What should we do to get this fixed?

Regards,

Revision history for this message
Angel Vargas (angelvargas) wrote :

After about 15 minutes the process said has ended, but the outcome is mess, as we lost all the resources control, as many resources are missing and I can not access the hypervisors

:~/master-node/openstack/juju-units-conf$ openstack hypervisor list
Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible.
<class 'ModuleNotFoundError'> (HTTP 500) (Request-ID: req-e2ec7d6c-b6c2-4d6c-a52e-fae80fbea324)

Revision history for this message
Sahid Orentino (sahid-ferdjaoui) wrote :

Looks like an issue when executing 'nova-manager db online_data_migrations'.

Can you share package version currently installed:
$ dpkg -s nova-common

Also sharing logs of nova-manage located under /var/log/nova may help.

If you have not configured your env in debug, please consider using:
$ juju config nova-cloud-controller debug=true

Then you could try to ru-run locally:
$ nova-manager db online_data_migrations

Thanks,
s.

Revision history for this message
Angel Vargas (angelvargas) wrote :

Hi,

this is how I have solved the problem, seems after the upgrade most of the packages got upgraded to python3 but there was missing a package for mysql

Logs showed:

/home/ubuntu# cat /var/log/nova/nova-manage.log

", line 534, in _setup_for_connection
2019-07-02 10:01:14.453 729831 ERROR nova.cmd.manage sql_connection=sql_connection, **engine_kwargs)
2019-07-02 10:01:14.453 729831 ERROR nova.cmd.manage File "/usr/lib/python3/dist-packages/debtcollector/renames.py", line 43, in decorator
2019-07-02 10:01:14.453 729831 ERROR nova.cmd.manage return wrapped(*args, **kwargs)
2019-07-02 10:01:14.453 729831 ERROR nova.cmd.manage File "/usr/lib/python3/dist-packages/oslo_db/sqlalchemy/engines.py", line 177, in create_engine
2019-07-02 10:01:14.453 729831 ERROR nova.cmd.manage engine = sqlalchemy.create_engine(url, **engine_args)
2019-07-02 10:01:14.453 729831 ERROR nova.cmd.manage File "/usr/lib/python3/dist-packages/sqlalchemy/engine/__init__.py", line 425, in create_engine
2019-07-02 10:01:14.453 729831 ERROR nova.cmd.manage return strategy.create(*args, **kwargs)
2019-07-02 10:01:14.453 729831 ERROR nova.cmd.manage File "/usr/lib/python3/dist-packages/sqlalchemy/engine/strategies.py", line 81, in create
2019-07-02 10:01:14.453 729831 ERROR nova.cmd.manage dbapi = dialect_cls.dbapi(**dbapi_args)
2019-07-02 10:01:14.453 729831 ERROR nova.cmd.manage File "/usr/lib/python3/dist-packages/sqlalchemy/dialects/mysql/mysqldb.py", line 102, in dbapi
2019-07-02 10:01:14.453 729831 ERROR nova.cmd.manage return __import__('MySQLdb')
2019-07-02 10:01:14.453 729831 ERROR nova.cmd.manage ModuleNotFoundError: No module named 'MySQLdb'
2019-07-02 10:01:14.453 729831 ERROR nova.cmd.manage
2019-07-02 10:01:14.463 729831 WARNING oslo_db.sqlalchemy.engines [req-42da38ea-f420-4e4c-ab58-e19d68804d10 - - - - -] URL mysql://nova:***@10.10.0.202/nova does not contain a '+drivername' portion, and will make use of a default driver. A full dbname+drivername:// protocol is recommended. For MySQL, it is strongly recommended that mysql+pymysql:// be specified for maximum service compatibility
2019-07-02 10:01:14.464 729831 WARNING nova.objects.instance_mapping [req-42da38ea-f420-4e4c-ab58-e19d68804d10 - - - - -] Encountered exception: "No module named 'MySQLdb'" while querying instances from cell: e5f8f404-9361-40ad-a67a-a0746d4868b0(cell1). Continuing to the next cell.: ModuleNotFoundError: No module named 'MySQLdb'

After see that in the logs, I checked and effectively there wasn't a lib for python - mysql

I did:

sudo apt-get install -y python3-mysqldb

and then all worked fine.

Is this a isolated case or is actually a bug? Why should be this package missing after the upgrade?

Revision history for this message
Sahid Orentino (sahid-ferdjaoui) wrote :

Thanks for your investigation and sharing resolution. I don't think it's isolated case I saw several issues on other charms around that.

Changed in charm-nova-cloud-controller:
status: New → Triaged
importance: Undecided → High
Revision history for this message
Angel Vargas (angelvargas) wrote :
Download full text (6.9 KiB)

Sorry @sahid-ferdjaoui I missed your questions:

Re: Package version where we hitted the bug:

ubuntu@juju-45ee93-2-lxd-2:~$ dpkg -s nova-common
Package: nova-common
Status: install ok installed
Priority: extra
Section: net
Installed-Size: 505
Maintainer: Ubuntu Developers <email address hidden>
Architecture: all
Source: nova
Version: 2:19.0.0-0ubuntu2~cloud0
Replaces: nova-ajax-console-proxy (<< 2:18.0.0~b2-0ubuntu3~), nova-api (<< 2:18.0.0~b2-0ubuntu3~), nova-api-metadata (<< 2:18.0.0~b2-0ubuntu3~), nova-api-os-compute (<< 2:18.0.0~b2-0ubuntu3~), nova-cells (<< 2:18.0.0~b2-0ubuntu3~), nova-compute (<< 2:18.0.0~b2-0ubuntu3~), nova-compute-libvirt (<< 2:18.0.0~b2-0ubuntu3~), nova-compute-vmware (<< 2:18.0.0~b2-0ubuntu3~), nova-conductor (<< 2:18.0.0~b2-0ubuntu3~), nova-console (<< 2:18.0.0~b2-0ubuntu3~), nova-consoleauth (<< 2:18.0.0~b2-0ubuntu3~), nova-network (<< 2:18.0.0~b2-0ubuntu3~), nova-novncproxy (<< 2:18.0.0~b2-0ubuntu3~), nova-placement-api (<< 2:18.0.0~b2-0ubuntu3~), nova-scheduler (<< 2:18.0.0~b2-0ubuntu3~), nova-serialproxy (<< 2:18.0.0~b2-0ubuntu3~), nova-spiceproxy (<< 2:18.0.0~b2-0ubuntu3~), nova-xvpvncproxy (<< 2:18.0.0~b2-0ubuntu3~), python-nova (<< 2:18.0.0-0ubuntu2~)
Depends: adduser
Breaks: nova-ajax-console-proxy (<< 2:18.0.0~b2-0ubuntu3~), nova-api (<< 2:18.0.0~b2-0ubuntu3~), nova-api-metadata (<< 2:18.0.0~b2-0ubuntu3~), nova-api-os-compute (<< 2:18.0.0~b2-0ubuntu3~), nova-cells (<< 2:18.0.0~b2-0ubuntu3~), nova-compute (<< 2:18.0.0~b2-0ubuntu3~), nova-compute-libvirt (<< 2:18.0.0~b2-0ubuntu3~), nova-compute-vmware (<< 2:18.0.0~b2-0ubuntu3~), nova-conductor (<< 2:18.0.0~b2-0ubuntu3~), nova-console (<< 2:18.0.0~b2-0ubuntu3~), nova-consoleauth (<< 2:18.0.0~b2-0ubuntu3~), nova-network (<< 2:18.0.0~b2-0ubuntu3~), nova-novncproxy (<< 2:18.0.0~b2-0ubuntu3~), nova-placement-api (<< 2:18.0.0~b2-0ubuntu3~), nova-scheduler (<< 2:18.0.0~b2-0ubuntu3~), nova-serialproxy (<< 2:18.0.0~b2-0ubuntu3~), nova-spiceproxy (<< 2:18.0.0~b2-0ubuntu3~), nova-xvpvncproxy (<< 2:18.0.0~b2-0ubuntu3~), python-nova (<< 2:18.0.0-0ubuntu2~)
Conffiles:
 /etc/logrotate.d/nova-common c8b4e3ac8388c4395b7fb8af33068753
 /etc/nova/api-paste.ini adfc3bc985a189b27e45b7be66d1a296
 /etc/nova/logging.conf dd4cdd10a6db5e711c519067603dcec2
 /etc/nova/nova.conf 0473e0723f12e4b51c44fb3209ca0a35
 /etc/nova/rootwrap.conf 90396580aced374b1ac7e25b49a68bb1
 /etc/nova/rootwrap.d/api-metadata.filters 973935718801ea5e303bf167809b66f2
 /etc/nova/rootwrap.d/compute.filters 6b66ceadead04371d5437e3e11407851
 /etc/nova/rootwrap.d/network.filters 58e5367d0ed714b5780be81f7a004bb5
 /etc/sudoers.d/nova_sudoers e06b72d1c3653b1eca9747f8423a1d16
Description: OpenStack Compute - common files
 OpenStack is a reliable cloud infrastructure. Its mission is to produce
 the ubiquitous cloud computing platform that will meet the needs of public
 and private cloud providers regardless of size, by being simple to implement
 and massively scalable.
 .
 OpenStack Compute, codenamed Nova, is a cloud computing fabric controller. In
 addition to its "native" API (the OpenStack API), it also supports the Amazon
 EC2 API.
 .
 Nova is intended to be modular and easy to extend and adapt. I...

Read more...

Revision history for this message
James Page (james-page) wrote :

At Stein, the default sqlalchemy mysql driver was switched back to mysqldb; prior to stein we just used the default which was mysqldb in older releases, and pymysql from at least queens/bionic->cosmic/rocky.

The pymysql package is installed, its just that the connection URL in the nova configuration file is not using the correct pymysql+ prefix to switch to the pymysql driver.

James Page (james-page)
Changed in charm-nova-cloud-controller:
importance: High → Critical
Revision history for this message
James Page (james-page) wrote :

Sahid and I chatted about this last night; the issue is that the DB urls written into the Nova DB for each cell only have the mysql:// prefix; with the switch of the default dialect to MySQLDB at stein, these need to be updated to be mysql+pymysql://.

Changed in charm-nova-cloud-controller:
assignee: nobody → James Page (james-page)
status: Triaged → In Progress
James Page (james-page)
Changed in charm-nova-cloud-controller:
assignee: James Page (james-page) → Sahid Orentino (sahid-ferdjaoui)
milestone: none → 19.07
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to charm-nova-cloud-controller (master)

Related fix proposed to branch: master
Review: https://review.opendev.org/671252

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to charm-nova-cloud-controller (master)

Fix proposed to branch: master
Review: https://review.opendev.org/671253

Revision history for this message
Sahid Orentino (sahid-ferdjaoui) wrote :

I also proposed a fix for nova since 'nova-manage cellv2 update_cell' is bugged for cell0.

  https://review.opendev.org/#/c/672045/

Matt Riedemann (mriedem)
tags: added: cells nova-manage upgrade
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to charm-nova-cloud-controller (master)

Related fix proposed to branch: master
Review: https://review.opendev.org/672321

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to charm-nova-cloud-controller (master)

Reviewed: https://review.opendev.org/672321
Committed: https://git.openstack.org/cgit/openstack/charm-nova-cloud-controller/commit/?id=3c806a23f6dada5b1bc4417099d328f97e5c7e2a
Submitter: Zuul
Branch: master

commit 3c806a23f6dada5b1bc4417099d328f97e5c7e2a
Author: James Page <email address hidden>
Date: Tue Jul 23 16:47:06 2019 +0100

    stein: install python3-mysqldb for sqlalchemy dialect change

    At Stein, the default mysql dialect in SQLAlchemy switched back
    to MySQLDB in Ubuntu; as a result the db connection URL's stored
    in the nova_api database for Nova cells are stale and need to
    prefixed mysql+pymysql:// to work with the pymysql dialect.

    However at this point in time there is no way to update the DB
    URL for Nova Cell 0.

    This fix works around this problem by installing python3-mysqldb
    which provides the default dialect needed when using mysql://
    prefixed DB connection URI's.

    Change-Id: I3f74f18f649786fefa113fc3d8fa7c24010a185d
    Related-Bug: 1835037

Revision history for this message
Alvaro Uria (aluria) wrote :

I've hit this same issue. See https://pastebin.ubuntu.com/p/hnwFBvhSnY/

tags: added: canonical-bootstack
David Ames (thedac)
Changed in charm-nova-cloud-controller:
milestone: 19.07 → 19.10
David Ames (thedac)
Changed in charm-nova-cloud-controller:
milestone: 19.10 → 20.01
tags: added: openstack-upgrade
removed: upgrade
Revision history for this message
Ryan Beisner (1chb1n) wrote :

The fix merged in master and is in the current stable charms as of 19.10.

Changed in charm-nova-cloud-controller:
status: In Progress → Fix Committed
status: Fix Committed → Fix Released
Matt Riedemann (mriedem)
Changed in nova:
status: New → In Progress
assignee: nobody → Sahid Orentino (sahid-ferdjaoui)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on charm-nova-cloud-controller (master)

Change abandoned by "James Page <email address hidden>" on branch: master
Review: https://review.opendev.org/c/openstack/charm-nova-cloud-controller/+/671253
Reason: This review is > 12 weeks without comment, and failed testing the last time it was checked. We are abandoning this for now. Feel free to reactivate the review by pressing the restore button and leaving a 'recheck' comment to get fresh test results.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Change abandoned by "Alex Kavanagh <email address hidden>" on branch: master
Review: https://review.opendev.org/c/openstack/charm-nova-cloud-controller/+/672486
Reason: Abandoning as this patch has been overtaken by events. The same/similar fix has appeared in a later patch that has merged: I670d0295ea339b21166ef7b18509b04a5beaa959

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Change abandoned by "Alex Kavanagh <email address hidden>" on branch: master
Review: https://review.opendev.org/c/openstack/charm-nova-cloud-controller/+/671252
Reason: Abandoning as this was the foundation work for the stacked changes and they have both been abandoned. Please re-open if the other stacked changes are still required.

Changed in nova:
assignee: Sahid Orentino (sahid-ferdjaoui) → nobody
Changed in charm-nova-cloud-controller:
assignee: Sahid Orentino (sahid-ferdjaoui) → nobody
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.