From 2b89f9fbe806a7c1a139e6be37902ff08ffa6283 Mon Sep 17 00:00:00 2001 From: Thomas Goirand Date: Wed, 16 Apr 2014 20:55:52 +0800 Subject: [PATCH] Fixed 11c6e18605c8_pool_monitor_status_.py migration Change-Id: Ic6c16c99635505b61b44dc8fce1ccbd10862482a Rewritten-From: 4c43e457371e7436fe9f1ce6e059e7aa27ee016d --- ...ult_in_migration_pool_monitor_status.patch | 27 +++++++++++++++++++ .../fix-alembic-migration-with-sqlite3.patch | 21 --------------- trusty/debian/patches/series | 1 + 3 files changed, 28 insertions(+), 21 deletions(-) create mode 100644 trusty/debian/patches/Properly_apply_column_default_in_migration_pool_monitor_status.patch diff --git a/trusty/debian/patches/Properly_apply_column_default_in_migration_pool_monitor_status.patch b/trusty/debian/patches/Properly_apply_column_default_in_migration_pool_monitor_status.patch new file mode 100644 index 000000000..2353aff95 --- /dev/null +++ b/trusty/debian/patches/Properly_apply_column_default_in_migration_pool_monitor_status.patch @@ -0,0 +1,27 @@ +From: Eugene Nikanorov +Date: Thu, 10 Apr 2014 09:36:45 +0000 (+0400) +Subject: Properly apply column default in migration pool_monitor_status +X-Git-Url: https://review.openstack.org/gitweb?p=openstack%2Fneutron.git;a=commitdiff_plain;h=c7dceedde516170d1a6ac1257103bdacb3b0cc84 + +Properly apply column default in migration pool_monitor_status + +server_default parameter should be used to apply default value at +table/column creation time. Otherwise non-nullable column can't +be created because of existing rows in the tables. + +Change-Id: I7136e6a0dfb9dc66ca63ff3c9fcf6de164e27e63 +Closes-Bug: #1305725 +--- + +diff --git a/neutron/db/migration/alembic_migrations/versions/11c6e18605c8_pool_monitor_status_.py b/neutron/db/migration/alembic_migrations/versions/11c6e18605c8_pool_monitor_status_.py +index a31bf6a..598f2ab 100644 +--- a/neutron/db/migration/alembic_migrations/versions/11c6e18605c8_pool_monitor_status_.py ++++ b/neutron/db/migration/alembic_migrations/versions/11c6e18605c8_pool_monitor_status_.py +@@ -45,6 +45,7 @@ def upgrade(active_plugins=None, options=None): + + op.add_column('poolmonitorassociations', sa.Column('status', + sa.String(16), ++ server_default='', + nullable=False)) + op.add_column('poolmonitorassociations', sa.Column('status_description', + sa.String(255))) diff --git a/trusty/debian/patches/fix-alembic-migration-with-sqlite3.patch b/trusty/debian/patches/fix-alembic-migration-with-sqlite3.patch index 12315a944..fcd14cbae 100644 --- a/trusty/debian/patches/fix-alembic-migration-with-sqlite3.patch +++ b/trusty/debian/patches/fix-alembic-migration-with-sqlite3.patch @@ -233,27 +233,6 @@ Index: neutron/neutron/db/migration/alembic_migrations/versions/f9263d6df56_remo def downgrade(active_plugins=None, options=None): ---- neutron-2014.1~rc1.orig/neutron/db/migration/alembic_migrations/versions/11c6e18605c8_pool_monitor_status_.py -+++ neutron-2014.1~rc1/neutron/db/migration/alembic_migrations/versions/11c6e18605c8_pool_monitor_status_.py -@@ -43,9 +43,15 @@ def upgrade(active_plugins=None, options - if not migration.should_run(active_plugins, migration_for_plugins): - return - -- op.add_column('poolmonitorassociations', sa.Column('status', -- sa.String(16), -- nullable=False)) -+ bind = op.get_bind() -+ engine = bind.engine -+ if engine.name == 'sqlite': -+ op.add_column('poolmonitorassociations', sa.Column('status', -+ sa.String(16))) -+ else: -+ op.add_column('poolmonitorassociations', sa.Column('status', -+ sa.String(16), -+ nullable=False)) - op.add_column('poolmonitorassociations', sa.Column('status_description', - sa.String(255))) - --- neutron-2014.1~rc1.orig/neutron/db/migration/alembic_migrations/versions/e197124d4b9_add_unique_constrain.py +++ neutron-2014.1~rc1/neutron/db/migration/alembic_migrations/versions/e197124d4b9_add_unique_constrain.py @@ -47,11 +47,17 @@ def upgrade(active_plugins=None, options diff --git a/trusty/debian/patches/series b/trusty/debian/patches/series index bc368e184..ee7bdf346 100644 --- a/trusty/debian/patches/series +++ b/trusty/debian/patches/series @@ -3,3 +3,4 @@ better-config-default.patch OVS_lib_defer_apply_doesn_t_handle_concurrency.patch 0001-Add-parameter-and-iptables-rules-to-protect-dnsmasq-.patch 0004-Fix-Metering-doesn-t-respect-the-l3-agent-binding.patch +Properly_apply_column_default_in_migration_pool_monitor_status.patch -- 2.45.2