summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorDan Smith <danms@us.ibm.com>2013-03-07 17:13:12 -0500
committerDan Smith <danms@us.ibm.com>2013-03-08 13:09:56 -0500
commitd64f61f976a0243f48effd97d1e5e2e0bc20040b (patch)
treee4a36717658ea507a6ff02f2665b0c419327a0a4 /nova/api
parentfcdd30a5fb99dd272cf29d909c46416f2e5084e1 (diff)
downloadnova-d64f61f976a0243f48effd97d1e5e2e0bc20040b.tar.gz
nova-d64f61f976a0243f48effd97d1e5e2e0bc20040b.tar.xz
nova-d64f61f976a0243f48effd97d1e5e2e0bc20040b.zip
Remove uses of instance['instance_type'] from nova/api
This removes a test that attempted to delete the data from the instance['instance_type'] structure and confirm that the flavor can still be fetched. Since this data is no longer consulted in that action (and will be removed altogether soon), this test is removed. This is one change in a series aimed at removing the use of instance-linked instance_type objects, in favor of the decoupled type data in system_metadata. See bug 1140119 for more details. Change-Id: I3ba56f9419aece5b9269a181264d09b117ecdb81
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/ec2/cloud.py6
-rw-r--r--nova/api/metadata/base.py4
-rw-r--r--nova/api/openstack/compute/views/servers.py3
3 files changed, 7 insertions, 6 deletions
diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py
index 6bc5185bf..a35460576 100644
--- a/nova/api/ec2/cloud.py
+++ b/nova/api/ec2/cloud.py
@@ -1084,10 +1084,8 @@ class CloudController(object):
@staticmethod
def _format_instance_type(instance, result):
- if instance['instance_type']:
- result['instanceType'] = instance['instance_type'].get('name')
- else:
- result['instanceType'] = None
+ instance_type = instance_types.extract_instance_type(instance)
+ result['instanceType'] = instance_type['name']
@staticmethod
def _format_group_set(instance, result):
diff --git a/nova/api/metadata/base.py b/nova/api/metadata/base.py
index 41f36541c..896c8fbd7 100644
--- a/nova/api/metadata/base.py
+++ b/nova/api/metadata/base.py
@@ -28,6 +28,7 @@ from oslo.config import cfg
from nova.api.ec2 import ec2utils
from nova.api.metadata import password
from nova import block_device
+from nova.compute import instance_types
from nova import conductor
from nova import context
from nova import network
@@ -210,7 +211,8 @@ class InstanceMetadata():
meta_data['product-codes'] = []
if self._check_version('2007-08-29', version):
- meta_data['instance-type'] = self.instance['instance_type']['name']
+ instance_type = instance_types.extract_instance_type(self.instance)
+ meta_data['instance-type'] = instance_type['name']
if False and self._check_version('2007-10-10', version):
# TODO(vish): store ancestor ids
diff --git a/nova/api/openstack/compute/views/servers.py b/nova/api/openstack/compute/views/servers.py
index 165d363a4..f00ab9921 100644
--- a/nova/api/openstack/compute/views/servers.py
+++ b/nova/api/openstack/compute/views/servers.py
@@ -22,6 +22,7 @@ from nova.api.openstack import common
from nova.api.openstack.compute.views import addresses as views_addresses
from nova.api.openstack.compute.views import flavors as views_flavors
from nova.api.openstack.compute.views import images as views_images
+from nova.compute import instance_types
from nova.openstack.common import log as logging
from nova.openstack.common import timeutils
@@ -180,7 +181,7 @@ class ViewBuilder(common.ViewBuilder):
return ""
def _get_flavor(self, request, instance):
- instance_type = instance["instance_type"]
+ instance_type = instance_types.extract_instance_type(instance)
if not instance_type:
LOG.warn(_("Instance has had its instance_type removed "
"from the DB"), instance=instance)