summaryrefslogtreecommitdiffstats
path: root/nova/db
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-06-12 18:49:17 +0000
committerGerrit Code Review <review@openstack.org>2013-06-12 18:49:17 +0000
commitfc763abf2563da231871d3d34d35bf8d7e1f36d7 (patch)
tree8d69b45ae926a94d609d74c5f550575216fddfd3 /nova/db
parentb9a0f54bdbf1668137e4f1210ac8d007fd577252 (diff)
parentc741e862fd35d28338d7966e03bf662c8fb65dac (diff)
downloadnova-fc763abf2563da231871d3d34d35bf8d7e1f36d7.tar.gz
nova-fc763abf2563da231871d3d34d35bf8d7e1f36d7.tar.xz
nova-fc763abf2563da231871d3d34d35bf8d7e1f36d7.zip
Merge "Give a way to save why a service has been disabled."
Diffstat (limited to 'nova/db')
-rw-r--r--nova/db/sqlalchemy/migrate_repo/versions/188_add_reason_column_to_service.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/188_add_reason_column_to_service.py b/nova/db/sqlalchemy/migrate_repo/versions/188_add_reason_column_to_service.py
new file mode 100644
index 000000000..ed87bcfeb
--- /dev/null
+++ b/nova/db/sqlalchemy/migrate_repo/versions/188_add_reason_column_to_service.py
@@ -0,0 +1,36 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2013 OpenStack Foundation.
+#
+# 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, MetaData, String, Table
+
+
+def upgrade(migrate_engine):
+ meta = MetaData()
+ meta.bind = migrate_engine
+ services = Table('services', meta, autoload=True)
+ reason = Column('disabled_reason', String(255))
+ services.create_column(reason)
+ shadow_services = Table('shadow_services', meta, autoload=True)
+ shadow_services.create_column(reason.copy())
+
+
+def downgrade(migrate_engine):
+ meta = MetaData()
+ meta.bind = migrate_engine
+ services = Table('services', meta, autoload=True)
+ services.drop_column('disabled_reason')
+ shadow_services = Table('shadow_services', meta, autoload=True)
+ shadow_services.drop_column('disabled_reason')
diff --git a/nova/db/sqlalchemy/models.py b/nova/db/sqlalchemy/models.py
index b6e821e5a..99a68d2cf 100644
--- a/nova/db/sqlalchemy/models.py
+++ b/nova/db/sqlalchemy/models.py
@@ -53,6 +53,7 @@ class Service(BASE, NovaBase):
topic = Column(String(255), nullable=True)
report_count = Column(Integer, nullable=False, default=0)
disabled = Column(Boolean, default=False)
+ disabled_reason = Column(String(255))
class ComputeNode(BASE, NovaBase):