diff options
| author | Brian Waldon <bcwaldon@gmail.com> | 2012-05-04 14:36:52 -0700 |
|---|---|---|
| committer | Brian Waldon <bcwaldon@gmail.com> | 2012-05-08 09:25:46 -0700 |
| commit | 99f3822fd3341eecb4bc8d699b9721fdf59aeee8 (patch) | |
| tree | fdd287c16686c02d248720028cfc7e222e34e25f /nova/db | |
| parent | 7ad7e9049c651367e8a864863cde5f75fa45b5c9 (diff) | |
Remove instance action logging mechanism
* Remove InstanceActions db model
* Remove relevant db api functions
* Add migration 93 which drops the instance_actions
* Remove server_action_list API extension
* Fixes bug 994846
Change-Id: Ibbd787183034314460f41c84b9ad152655739209
Diffstat (limited to 'nova/db')
| -rw-r--r-- | nova/db/api.py | 10 | ||||
| -rw-r--r-- | nova/db/sqlalchemy/api.py | 21 | ||||
| -rw-r--r-- | nova/db/sqlalchemy/migrate_repo/versions/093_drop_instance_actions_table.py | 52 | ||||
| -rw-r--r-- | nova/db/sqlalchemy/models.py | 10 |
4 files changed, 52 insertions, 41 deletions
diff --git a/nova/db/api.py b/nova/db/api.py index 34de50faa..93eea8f10 100644 --- a/nova/db/api.py +++ b/nova/db/api.py @@ -623,16 +623,6 @@ def instance_remove_security_group(context, instance_id, security_group_id): security_group_id) -def instance_action_create(context, values): - """Create an instance action from the values dictionary.""" - return IMPL.instance_action_create(context, values) - - -def instance_get_actions(context, instance_uuid): - """Get instance actions by instance uuid.""" - return IMPL.instance_get_actions(context, instance_uuid) - - def instance_get_id_to_uuid_mapping(context, ids): """Return a dictionary containing 'ID: UUID' given the ids""" return IMPL.instance_get_id_to_uuid_mapping(context, ids) diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py index 02c835515..46e080578 100644 --- a/nova/db/sqlalchemy/api.py +++ b/nova/db/sqlalchemy/api.py @@ -1682,27 +1682,6 @@ def instance_remove_security_group(context, instance_uuid, security_group_id): @require_context -def instance_action_create(context, values): - """Create an instance action from the values dictionary.""" - action_ref = models.InstanceActions() - action_ref.update(values) - - session = get_session() - with session.begin(): - action_ref.save(session=session) - return action_ref - - -@require_admin_context -def instance_get_actions(context, instance_uuid): - """Return the actions associated to the given instance id""" - session = get_session() - return session.query(models.InstanceActions).\ - filter_by(instance_uuid=instance_uuid).\ - all() - - -@require_context def instance_get_id_to_uuid_mapping(context, ids): session = get_session() instances = session.query(models.Instance).\ diff --git a/nova/db/sqlalchemy/migrate_repo/versions/093_drop_instance_actions_table.py b/nova/db/sqlalchemy/migrate_repo/versions/093_drop_instance_actions_table.py new file mode 100644 index 000000000..dc69607f6 --- /dev/null +++ b/nova/db/sqlalchemy/migrate_repo/versions/093_drop_instance_actions_table.py @@ -0,0 +1,52 @@ +# Copyright 2012 Openstack, LLC. +# All Rights Reserved. +# +# 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 Boolean, Column, DateTime, ForeignKey +from sqlalchemy import Integer, MetaData, String, Table, Text + + +def upgrade(migrate_engine): + meta = MetaData() + meta.bind = migrate_engine + instance_actions = Table('instance_actions', meta, autoload=True) + instance_actions.drop() + + +def downgrade(migrate_engine): + meta = MetaData() + meta.bind = migrate_engine + + instances = Table('instances', meta, autoload=True, + autoload_with=migrate_engine) + + instance_actions = Table('instance_actions', meta, + Column('created_at', DateTime(timezone=False)), + Column('updated_at', DateTime(timezone=False)), + Column('deleted_at', DateTime(timezone=False)), + Column('deleted', Boolean(create_constraint=True, name=None)), + Column('id', Integer(), primary_key=True, nullable=False), + Column('instance_id', + Integer(), + ForeignKey('instances.id')), + Column('action', + String(length=255, convert_unicode=False, + assert_unicode=None, + unicode_error=None, _warn_on_bytestring=False)), + Column('error', + Text(length=None, convert_unicode=False, + assert_unicode=None, + unicode_error=None, _warn_on_bytestring=False)), + ) + instance_actions.create() diff --git a/nova/db/sqlalchemy/models.py b/nova/db/sqlalchemy/models.py index e35a78257..9007de424 100644 --- a/nova/db/sqlalchemy/models.py +++ b/nova/db/sqlalchemy/models.py @@ -300,15 +300,6 @@ class InstanceInfoCache(BASE, NovaBase): primaryjoin=instance_id == Instance.uuid) -class InstanceActions(BASE, NovaBase): - """Represents a guest VM's actions and results""" - __tablename__ = "instance_actions" - id = Column(Integer, primary_key=True) - instance_uuid = Column(String(36), ForeignKey('instances.uuid')) - action = Column(String(255)) - error = Column(Text) - - class InstanceTypes(BASE, NovaBase): """Represent possible instance_types or flavor of VM offered""" __tablename__ = "instance_types" @@ -1051,7 +1042,6 @@ def register_models(): FixedIp, FloatingIp, Instance, - InstanceActions, InstanceFault, InstanceMetadata, InstanceTypeExtraSpecs, |
