diff options
author | Stephen Finucane <stephenfin@redhat.com> | 2021-09-28 15:59:12 +0100 |
---|---|---|
committer | Stephen Finucane <stephenfin@redhat.com> | 2021-11-03 17:33:53 +0000 |
commit | 0a213019d29c761ddf8ef658d8721518e41f4a9e (patch) | |
tree | 7a5e9aad4f2f96d5123387aef44d4629133c3c15 /nova/db | |
parent | 2b02b66bae7fba5103839e48bc4c48bb30cffead (diff) | |
download | nova-0a213019d29c761ddf8ef658d8721518e41f4a9e.tar.gz |
db: Remove models for removed services, features
We've built up a large amount of tables that are no longer used for
anything, given the removal of their users in past releases. We'd like
to remove those, but before we do that we need to drop the models. This
means there are no references to the tables come N+2, at which point we
can remove the tables themselves.
XenAPI virt driver
Feature removed entirely in Victoria.
- agent_builds
- bw_usage_cache
- console_pools
- consoles
Cells v1
Feature removed entirely in Train.
- cells
Volume Snapshots
Feature removed entirely in Liberty.
- snapshots
EC2 API
Feature removed entirely in Mitaka. Note that these tables are *not*
used by the separate ec2-api project.
- snapshot_id_mappings
- volume_id_mappings
There are still some tables related to nova-network left here. Those are
unfortunately referenced from elsewhere, so we need to clean them up
separately.
Change-Id: I5e3d022fdf7328a1132f6e00998a3286b19be69a
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Diffstat (limited to 'nova/db')
-rw-r--r-- | nova/db/main/models.py | 163 |
1 files changed, 20 insertions, 143 deletions
diff --git a/nova/db/main/models.py b/nova/db/main/models.py index baea2ae6bf..72313cbded 100644 --- a/nova/db/main/models.py +++ b/nova/db/main/models.py @@ -68,6 +68,26 @@ REMOVED_TABLES = { 'key_pairs', 'resource_provider_aggregates', 'resource_providers', + + # Tables for the removed XenAPI virt driver. The models were + # removed in Y and the tables can be dropped in Z or later + 'agent_builds', + 'bw_usage_cache', + 'console_pools', + 'consoles', + + # Tables for the removed cells v1 feature. The model was removed in + # Y and the table can be dropped in Z or later + 'cells', + + # Tables for the removed volume snapshot feature. The model was + # removed in Y and the table can be dropped in Z or later + 'snapshots', + + # Tables for the removed in-tree EC2 API. The models were removed + # in Y and the table can be dropped in Z or later + 'snapshot_id_mappings', + 'volume_id_mappings', } # we don't configure 'cls' since we have models that don't use the @@ -558,32 +578,6 @@ class Reservation(BASE, NovaBase, models.SoftDeleteMixin): 'QuotaUsage.deleted == 0)') -# TODO(macsz) This class can be removed. It might need a DB migration to drop -# this. -class Snapshot(BASE, NovaBase, models.SoftDeleteMixin): - """Represents a block storage device that can be attached to a VM.""" - __tablename__ = 'snapshots' - __table_args__ = () - id = sa.Column(sa.String(36), primary_key=True, nullable=False) - deleted = sa.Column(sa.String(36), default="") - - @property - def volume_name(self): - return CONF.volume_name_template % self.volume_id - - user_id = sa.Column(sa.String(255)) - project_id = sa.Column(sa.String(255)) - - volume_id = sa.Column(sa.String(36), nullable=False) - status = sa.Column(sa.String(255)) - progress = sa.Column(sa.String(255)) - volume_size = sa.Column(sa.Integer) - scheduled_at = sa.Column(sa.DateTime) - - display_name = sa.Column(sa.String(255)) - display_description = sa.Column(sa.String(255)) - - class BlockDeviceMapping(BASE, NovaBase, models.SoftDeleteMixin): """Represents block device mapping that is defined by EC2.""" __tablename__ = "block_device_mapping" @@ -980,41 +974,6 @@ class DNSDomain(BASE, NovaBase, models.SoftDeleteMixin): project_id = sa.Column(sa.String(255)) -# TODO(stephenfin): Remove in V or later -class ConsolePool(BASE, NovaBase, models.SoftDeleteMixin): - """Represents pool of consoles on the same physical node.""" - __tablename__ = 'console_pools' - __table_args__ = ( - schema.UniqueConstraint( - "host", "console_type", "compute_host", "deleted", - name="uniq_console_pools0host0console_type0compute_host0deleted"), - ) - id = sa.Column(sa.Integer, primary_key=True) - address = sa.Column(types.IPAddress()) - username = sa.Column(sa.String(255)) - password = sa.Column(sa.String(255)) - console_type = sa.Column(sa.String(255)) - public_hostname = sa.Column(sa.String(255)) - host = sa.Column(sa.String(255)) - compute_host = sa.Column(sa.String(255)) - - -# TODO(stephenfin): Remove in V or later -class Console(BASE, NovaBase, models.SoftDeleteMixin): - """Represents a console session for an instance.""" - __tablename__ = 'consoles' - __table_args__ = ( - sa.Index('consoles_instance_uuid_idx', 'instance_uuid'), - ) - id = sa.Column(sa.Integer, primary_key=True) - instance_name = sa.Column(sa.String(255)) - instance_uuid = sa.Column(sa.String(36), sa.ForeignKey('instances.uuid')) - password = sa.Column(sa.String(255)) - port = sa.Column(sa.Integer) - pool_id = sa.Column(sa.Integer, sa.ForeignKey('console_pools.id')) - pool = orm.relationship(ConsolePool, backref=orm.backref('consoles')) - - class InstanceMetadata(BASE, NovaBase, models.SoftDeleteMixin): """Represents a user-provided metadata key/value pair for an instance.""" __tablename__ = 'instance_metadata' @@ -1050,70 +1009,6 @@ class InstanceSystemMetadata(BASE, NovaBase, models.SoftDeleteMixin): foreign_keys=instance_uuid) -# TODO(stephenfin): Remove this in the U release or later, once we're sure we -# won't want it back (it's for cells v1, so we won't) -class Cell(BASE, NovaBase, models.SoftDeleteMixin): - """Represents parent and child cells of this cell. Cells can - have multiple parents and children, so there could be any number - of entries with is_parent=True or False - """ - __tablename__ = 'cells' - __table_args__ = (schema.UniqueConstraint( - "name", "deleted", name="uniq_cells0name0deleted" - ), - ) - id = sa.Column(sa.Integer, primary_key=True) - # Name here is the 'short name' of a cell. For instance: 'child1' - name = sa.Column(sa.String(255)) - api_url = sa.Column(sa.String(255)) - - transport_url = sa.Column(sa.String(255), nullable=False) - - weight_offset = sa.Column(sa.Float(), default=0.0) - weight_scale = sa.Column(sa.Float(), default=1.0) - is_parent = sa.Column(sa.Boolean()) - - -# TODO(stephenfin): Remove this in the W release or later, once we're sure we -# won't want it back (it's for a XenAPI-only feature) -class AgentBuild(BASE, NovaBase, models.SoftDeleteMixin): - """Represents an agent build.""" - __tablename__ = 'agent_builds' - __table_args__ = ( - sa.Index('agent_builds_hypervisor_os_arch_idx', 'hypervisor', 'os', - 'architecture'), - schema.UniqueConstraint("hypervisor", "os", "architecture", "deleted", - name="uniq_agent_builds0hypervisor0os0architecture0deleted"), - ) - id = sa.Column(sa.Integer, primary_key=True) - hypervisor = sa.Column(sa.String(255)) - os = sa.Column(sa.String(255)) - architecture = sa.Column(sa.String(255)) - version = sa.Column(sa.String(255)) - url = sa.Column(sa.String(255)) - md5hash = sa.Column(sa.String(255)) - - -# TODO(stephenfin): Remove this in the W release or later, once we're sure we -# won't want it back (it's for a XenAPI-only feature) -class BandwidthUsage(BASE, NovaBase, models.SoftDeleteMixin): - """Cache for instance bandwidth usage data pulled from the hypervisor.""" - __tablename__ = 'bw_usage_cache' - __table_args__ = ( - sa.Index('bw_usage_cache_uuid_start_period_idx', 'uuid', - 'start_period'), - ) - id = sa.Column(sa.Integer, primary_key=True, nullable=False) - uuid = sa.Column(sa.String(36)) - mac = sa.Column(sa.String(255)) - start_period = sa.Column(sa.DateTime, nullable=False) - last_refreshed = sa.Column(sa.DateTime) - bw_in = sa.Column(sa.BigInteger) - bw_out = sa.Column(sa.BigInteger) - last_ctr_in = sa.Column(sa.BigInteger) - last_ctr_out = sa.Column(sa.BigInteger) - - class VolumeUsage(BASE, NovaBase, models.SoftDeleteMixin): """Cache for volume usage data pulled from the hypervisor.""" __tablename__ = 'volume_usage_cache' @@ -1145,24 +1040,6 @@ class S3Image(BASE, NovaBase, models.SoftDeleteMixin): uuid = sa.Column(sa.String(36), nullable=False) -class VolumeIdMapping(BASE, NovaBase, models.SoftDeleteMixin): - """Compatibility layer for the EC2 volume service.""" - __tablename__ = 'volume_id_mappings' - __table_args__ = () - id = sa.Column( - sa.Integer, primary_key=True, nullable=False, autoincrement=True) - uuid = sa.Column(sa.String(36), nullable=False) - - -class SnapshotIdMapping(BASE, NovaBase, models.SoftDeleteMixin): - """Compatibility layer for the EC2 snapshot service.""" - __tablename__ = 'snapshot_id_mappings' - __table_args__ = () - id = sa.Column( - sa.Integer, primary_key=True, nullable=False, autoincrement=True) - uuid = sa.Column(sa.String(36), nullable=False) - - class InstanceFault(BASE, NovaBase, models.SoftDeleteMixin): __tablename__ = 'instance_faults' __table_args__ = ( |