diff options
| author | Andrea Rosa <andrea.rosa@hp.com> | 2013-02-20 10:10:04 +0000 |
|---|---|---|
| committer | Michael Still <mikal@stillhq.com> | 2013-06-12 11:27:25 +1000 |
| commit | c741e862fd35d28338d7966e03bf662c8fb65dac (patch) | |
| tree | dbb6cd67e829fc5836d4ec1fc27b101e07c67fbe /nova/db | |
| parent | d7f898eab900de8f804285333e6fb921294520fc (diff) | |
| download | nova-c741e862fd35d28338d7966e03bf662c8fb65dac.tar.gz nova-c741e862fd35d28338d7966e03bf662c8fb65dac.tar.xz nova-c741e862fd35d28338d7966e03bf662c8fb65dac.zip | |
Give a way to save why a service has been disabled.
Implements blueprint record-reason-for-disabling-service
We added a field to the service table to log a reason when a service has
been disabled.
We added a new API extension called os-extended-services. The new extension
will extend the os-services extension adding:
- A method for disabling a service and specify a reason for that.
PUT /v2/{tenant_id}/os-services/disable-log-reason
When the os-extended-extension is loaded the call:
GET /V2/{tenant_id}/os-services
will return the list of services with reason information it that exists.
DocImpact
Change-Id: I87a4affc45160796ff11c7b03e591e6aba73d62a
Diffstat (limited to 'nova/db')
| -rw-r--r-- | nova/db/sqlalchemy/migrate_repo/versions/188_add_reason_column_to_service.py | 36 | ||||
| -rw-r--r-- | nova/db/sqlalchemy/models.py | 1 |
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 28fe36a0d..d12e47246 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): |
