summaryrefslogtreecommitdiffstats
path: root/nova/db
diff options
context:
space:
mode:
authorRick Harris <rconradharris@gmail.com>2013-01-17 20:42:27 +0000
committerRick Harris <rconradharris@gmail.com>2013-01-17 21:44:57 +0000
commitd35fccc579812faa5c8d1338744d24e59c426dd6 (patch)
tree9f544f909d59a24d7567e46daff31dc9976e6572 /nova/db
parent52fe25a5281a50a5e4c1ff093ce9ed966241a3d7 (diff)
Add host to instance_faults table.
Instances can be rescheduled or migrated to different hosts; so, to make troubleshooting easier, it's convenient to store the host in which the failure occured with the instance fault record. Change-Id: Ib2b9a5bab5d95739b730f0eab15884c2db33a782
Diffstat (limited to 'nova/db')
-rw-r--r--nova/db/sqlalchemy/migrate_repo/versions/150_add_host_to_instance_faults.py36
-rw-r--r--nova/db/sqlalchemy/models.py1
2 files changed, 37 insertions, 0 deletions
diff --git a/nova/db/sqlalchemy/migrate_repo/versions/150_add_host_to_instance_faults.py b/nova/db/sqlalchemy/migrate_repo/versions/150_add_host_to_instance_faults.py
new file mode 100644
index 000000000..3fd87e1e1
--- /dev/null
+++ b/nova/db/sqlalchemy/migrate_repo/versions/150_add_host_to_instance_faults.py
@@ -0,0 +1,36 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2013 OpenStack LLC.
+#
+# 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, Index, MetaData, String, Table
+
+
+def upgrade(migrate_engine):
+ meta = MetaData()
+ meta.bind = migrate_engine
+
+ instance_faults = Table('instance_faults', meta, autoload=True)
+ host = Column('host', String(length=255))
+ instance_faults.create_column(host)
+ Index('instance_faults_host_idx', instance_faults.c.host).create(
+ migrate_engine)
+
+
+def downgrade(migrate_engine):
+ meta = MetaData()
+ meta.bind = migrate_engine
+
+ instance_faults = Table('instance_faults', meta, autoload=True)
+ instance_faults.drop_column('host')
diff --git a/nova/db/sqlalchemy/models.py b/nova/db/sqlalchemy/models.py
index 56a4d944a..5050cb77e 100644
--- a/nova/db/sqlalchemy/models.py
+++ b/nova/db/sqlalchemy/models.py
@@ -992,6 +992,7 @@ class InstanceFault(BASE, NovaBase):
code = Column(Integer(), nullable=False)
message = Column(String(255))
details = Column(Text)
+ host = Column(String(255))
class InstanceAction(BASE, NovaBase):