summaryrefslogtreecommitdiff
path: root/nova/db
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-03-23 20:03:57 +0000
committerGerrit Code Review <review@openstack.org>2017-03-23 20:03:57 +0000
commit1e080932d091dd79454af210a63b829445d04c39 (patch)
tree2b5b40b80d5206d37944c5b32ea9b2f8118b5693 /nova/db
parent3c59e93d7474fc8588bcb1a729414d10cb513a09 (diff)
parent7653261efcf0d8c7fe71076972b7ef02ae599161 (diff)
downloadnova-1e080932d091dd79454af210a63b829445d04c39.tar.gz
Merge "db: Add attachment_id to block_device_mapping"
Diffstat (limited to 'nova/db')
-rw-r--r--nova/db/sqlalchemy/migrate_repo/versions/358_bdm_attachment_id.py28
-rw-r--r--nova/db/sqlalchemy/models.py2
2 files changed, 30 insertions, 0 deletions
diff --git a/nova/db/sqlalchemy/migrate_repo/versions/358_bdm_attachment_id.py b/nova/db/sqlalchemy/migrate_repo/versions/358_bdm_attachment_id.py
new file mode 100644
index 0000000000..da0f465838
--- /dev/null
+++ b/nova/db/sqlalchemy/migrate_repo/versions/358_bdm_attachment_id.py
@@ -0,0 +1,28 @@
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+
+from sqlalchemy import Column
+from sqlalchemy import MetaData
+from sqlalchemy import String
+from sqlalchemy import Table
+
+
+def upgrade(migrate_engine):
+ meta = MetaData()
+ meta.bind = migrate_engine
+
+ for prefix in ('', 'shadow_'):
+ table = Table(prefix + 'block_device_mapping', meta, autoload=True)
+ new_column = Column('attachment_id', String(36), nullable=True)
+ if not hasattr(table.c, 'attachment_id'):
+ table.create_column(new_column)
diff --git a/nova/db/sqlalchemy/models.py b/nova/db/sqlalchemy/models.py
index 90b63a9b76..776b2fdf15 100644
--- a/nova/db/sqlalchemy/models.py
+++ b/nova/db/sqlalchemy/models.py
@@ -623,6 +623,8 @@ class BlockDeviceMapping(BASE, NovaBase, models.SoftDeleteMixin):
tag = Column(String(255))
+ attachment_id = Column(String(36))
+
class SecurityGroupInstanceAssociation(BASE, NovaBase, models.SoftDeleteMixin):
__tablename__ = 'security_group_instance_association'