commit eda54b1ed73b0c102f4352e1522e34908dc7c17f
Author: Matt Riedemann <email address hidden>
Date: Fri Dec 30 12:27:48 2016 -0500
Handle unicode when dealing with duplicate flavors during online migrations
In python 2.7 you can't cast unicode to str and you'll get a
UnicodeEncodeError if you try. Since our exception messages are
translated, they can contain unicode and if we hit a duplicate flavor
exception while performing online flavor migrations it will break the
migration and block any further migrations until resolved - which would
require manual intervention.
This patch fixes the bug so that we use six.text_type instead of str
for logging the duplicate exception and adds a test to exhibit the bug
and prove it's fixed.
On a side note, it's curious that we don't delete the duplicate flavor
from the main database during the online data migration, but it's also
strange that you'd have duplicates in the API database because the
Flavor.create() checks to see if all flavors have been migrated from
the main DB to the API DB and if not you can't create new flavors in
the API DB - so the only way to get the duplicates is either by inserting
them into the API DB manually or perhaps some other kind of race issue.
Anyway, that's not dealt with here.
Reviewed: https:/ /review. openstack. org/415898 /git.openstack. org/cgit/ openstack/ nova/commit/ ?id=eda54b1ed73 b0c102f4352e152 2e34908dc7c17f
Committed: https:/
Submitter: Jenkins
Branch: master
commit eda54b1ed73b0c1 02f4352e1522e34 908dc7c17f
Author: Matt Riedemann <email address hidden>
Date: Fri Dec 30 12:27:48 2016 -0500
Handle unicode when dealing with duplicate flavors during online migrations
In python 2.7 you can't cast unicode to str and you'll get a deError if you try. Since our exception messages are
UnicodeEnco
translated, they can contain unicode and if we hit a duplicate flavor
exception while performing online flavor migrations it will break the
migration and block any further migrations until resolved - which would
require manual intervention.
This patch fixes the bug so that we use six.text_type instead of str
for logging the duplicate exception and adds a test to exhibit the bug
and prove it's fixed.
On a side note, it's curious that we don't delete the duplicate flavor
from the main database during the online data migration, but it's also
strange that you'd have duplicates in the API database because the
Flavor.create() checks to see if all flavors have been migrated from
the main DB to the API DB and if not you can't create new flavors in
the API DB - so the only way to get the duplicates is either by inserting
them into the API DB manually or perhaps some other kind of race issue.
Anyway, that's not dealt with here.
Change-Id: I3bdb1a8ca72c3e 72ddc3bc5102cff 8df18148617
Partial-Bug: #1653261