Remove Glance to EC2 ID Nova mapping

Change-Id: I251597542805bd2ed2641041da7a65cd954a6233
This commit is contained in:
Feodor Tersin 2014-12-30 13:07:50 +04:00
parent cf63edf9f9
commit c748453028
6 changed files with 0 additions and 57 deletions

View File

@ -16,7 +16,6 @@ import re
from ec2api.db import api as db_api
from ec2api import exception
from ec2api import novadb
from ec2api.openstack.common.gettextutils import _
from ec2api.openstack.common import log as logging
from ec2api.openstack.common import timeutils
@ -148,21 +147,6 @@ def is_ec2_timestamp_expired(request, expires=None):
return True
def ec2_id_to_glance_id(context, ec2_id):
image_id = _ec2_id_to_id(ec2_id)
return novadb.s3_image_get(context, image_id)['uuid']
# TODO(Alex) This function is copied as is from original cloud.py. It doesn't
# check for the prefix which allows any prefix used for any object.
def _ec2_id_to_id(ec2_id):
"""Convert an ec2 ID (i-[base 16 number]) to an instance id (int)."""
try:
return int(ec2_id.split('-')[-1], 16)
except ValueError:
raise exception.InvalidId(id=ec2_id)
# NOTE(ft): extra functions to use in vpc specific code or instead of
# malformed existed functions

View File

@ -157,11 +157,6 @@ class EC2NotFound(NotFound):
code = 400
class NovaDbImageNotFound(EC2NotFound):
ec2_code = 'InvalidAMIID.NotFound'
msg_fmt = _("The image id '[%(image_id)s]' does not exist")
class InvalidInstanceIDNotFound(EC2NotFound):
ec2_code = 'InvalidInstanceID.NotFound'
msg_fmt = _("The instance ID '%(id)s' does not exist")

View File

@ -80,14 +80,6 @@ MAX_INT = 0x7FFFFFFF
####################
def s3_image_get(context, image_id):
"""Find local s3 image represented by the provided id."""
return IMPL.s3_image_get(context, image_id)
###################
def instance_get_by_uuid(context, uuid, columns_to_join=None, use_slave=False):
"""Get an instance or raise if it does not exist."""
return IMPL.instance_get_by_uuid(context, uuid,

View File

@ -166,21 +166,6 @@ def model_query(context, model, *args, **kwargs):
####################
def s3_image_get(context, image_id):
"""Find local s3 image represented by the provided id."""
result = (model_query(context, models.S3Image, read_deleted="yes").
filter_by(id=image_id).
first())
if not result:
raise exception.NovaDbImageNotFound(image_id=image_id)
return result
###################
@require_context
def instance_get_by_uuid(context, uuid, columns_to_join=None, use_slave=False):
return _instance_get_by_uuid(context, uuid,

View File

@ -51,14 +51,6 @@ class NovaBase(models.SoftDeleteMixin,
super(NovaBase, self).save(session=session)
class S3Image(BASE, NovaBase):
"""Compatibility layer for the S3 image service talking to Glance."""
__tablename__ = 's3_images'
__table_args__ = ()
id = Column(Integer, primary_key=True, nullable=False, autoincrement=True)
uuid = Column(String(36), nullable=False)
class Instance(BASE, NovaBase):
"""Represents a guest VM."""
__tablename__ = 'instances'

View File

@ -37,10 +37,6 @@ class InstanceTestCase(base.ApiTestCase):
self.create_network_interface = (
create_network_interface_patcher.start())
self.addCleanup(create_network_interface_patcher.stop)
ec2_id_to_glance_id_patcher = (
mock.patch('ec2api.api.ec2utils.ec2_id_to_glance_id'))
self.ec2_id_to_glance_id = ec2_id_to_glance_id_patcher.start()
self.addCleanup(ec2_id_to_glance_id_patcher.stop)
utils_generate_uid_patcher = (
mock.patch('ec2api.api.instance._utils_generate_uid'))
self.utils_generate_uid = utils_generate_uid_patcher.start()
@ -179,7 +175,6 @@ class InstanceTestCase(base.ApiTestCase):
self.glance.images.get.return_value = self.fake_image_class(
'fake_image_id', 'active', {})
self.ec2_id_to_glance_id.return_value = 'fake_image_id'
fake_flavor = self.fake_flavor_class('fake_flavor')
self.nova_flavors.list.return_value = [fake_flavor]