diff options
| author | Jenkins <jenkins@review.openstack.org> | 2013-03-12 16:58:49 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-03-12 16:58:49 +0000 |
| commit | 1c0d29ccccaa59aa253a7eb752f54d184addd17e (patch) | |
| tree | e3a85dc44944f9394fa4fd978341bdda3fc502cd /nova/db | |
| parent | a3786b4b8aa47cf19b9dc2babb4df85f578a1280 (diff) | |
| parent | fed1ea1d7528e7a3d2da181112da62cf04cb5092 (diff) | |
| download | nova-1c0d29ccccaa59aa253a7eb752f54d184addd17e.tar.gz nova-1c0d29ccccaa59aa253a7eb752f54d184addd17e.tar.xz nova-1c0d29ccccaa59aa253a7eb752f54d184addd17e.zip | |
Merge "Remove instance['instance_type'] relationship from db api"
Diffstat (limited to 'nova/db')
| -rw-r--r-- | nova/db/sqlalchemy/api.py | 16 | ||||
| -rw-r--r-- | nova/db/sqlalchemy/models.py | 7 |
2 files changed, 1 insertions, 22 deletions
diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py index 0bd9cfce7..f35f23e56 100644 --- a/nova/db/sqlalchemy/api.py +++ b/nova/db/sqlalchemy/api.py @@ -1429,9 +1429,6 @@ def instance_create(context, values): instance_ref.security_groups = _get_sec_group_models(session, security_groups) instance_ref.save(session=session) - # NOTE(comstud): This forces instance_type to be loaded so it - # exists in the ref when we return. Fixes lazy loading issues. - instance_ref.instance_type # create the instance uuid to ec2_id mapping entry for instance db.ec2_instance_create(context, instance_ref['uuid']) @@ -1521,7 +1518,6 @@ def _build_instance_get(context, session=None): options(joinedload_all('security_groups.rules')).\ options(joinedload('info_cache')).\ options(joinedload('metadata')).\ - options(joinedload('instance_type')).\ options(joinedload('system_metadata')) @@ -1529,7 +1525,7 @@ def _build_instance_get(context, session=None): def instance_get_all(context, columns_to_join=None): if columns_to_join is None: columns_to_join = ['info_cache', 'security_groups', 'metadata', - 'instance_type', 'system_metadata'] + 'system_metadata'] query = model_query(context, models.Instance) for column in columns_to_join: query = query.options(joinedload(column)) @@ -1559,7 +1555,6 @@ def instance_get_all_by_filters(context, filters, sort_key, sort_dir, options(joinedload('security_groups')).\ options(joinedload('system_metadata')).\ options(joinedload('metadata')).\ - options(joinedload('instance_type')).\ order_by(sort_fn[sort_dir](getattr(models.Instance, sort_key))) # Make a copy of the filters dictionary to use going forward, as we'll @@ -1658,7 +1653,6 @@ def instance_get_active_by_window_joined(context, begin, end=None, query = query.options(joinedload('info_cache')).\ options(joinedload('security_groups')).\ options(joinedload('metadata')).\ - options(joinedload('instance_type')).\ options(joinedload('system_metadata')).\ filter(or_(models.Instance.terminated_at == None, models.Instance.terminated_at > begin)) @@ -1678,7 +1672,6 @@ def _instance_get_all_query(context, project_only=False): options(joinedload('info_cache')).\ options(joinedload('security_groups')).\ options(joinedload('metadata')).\ - options(joinedload('instance_type')).\ options(joinedload('system_metadata')) @@ -1847,13 +1840,6 @@ def _instance_update(context, instance_uuid, values, copy_old_instance=False): instance_ref.update(values) instance_ref.save(session=session) - if 'instance_type_id' in values: - # NOTE(comstud): It appears that sqlalchemy doesn't refresh - # the instance_type model after you update the ID. You end - # up with an instance_type model that only has 'id' updated, - # but the rest of the model has the data from the old - # instance_type. - session.refresh(instance_ref['instance_type']) return (old_instance_ref, instance_ref) diff --git a/nova/db/sqlalchemy/models.py b/nova/db/sqlalchemy/models.py index a675357df..3f45c614b 100644 --- a/nova/db/sqlalchemy/models.py +++ b/nova/db/sqlalchemy/models.py @@ -273,13 +273,6 @@ class InstanceTypes(BASE, NovaBase): disabled = Column(Boolean, default=False) is_public = Column(Boolean, default=True) - instances = relationship(Instance, - backref=backref('instance_type', uselist=False), - foreign_keys=id, - primaryjoin='and_(' - 'Instance.instance_type_id == ' - 'InstanceTypes.id)') - class Volume(BASE, NovaBase): """Represents a block storage device that can be attached to a VM.""" |
