From 5fdcf190aa79eaa04b20cc6acf63dd99bce5e106 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Mon, 4 Mar 2013 20:38:09 -0500 Subject: Remove uses of instance['instance_type'] from libvirt driver. Note that this includes a few tweaks to the libvirt tests where the instance type in use was expected to have no swap, but the actual id-matching fake did. This integration makes it a little harder for the tests to be out of whack like that, which is good. 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: I190258bd0947944d9bcdf49956eed40d402606f5 --- nova/virt/libvirt/blockinfo.py | 3 ++- nova/virt/libvirt/driver.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'nova/virt') diff --git a/nova/virt/libvirt/blockinfo.py b/nova/virt/libvirt/blockinfo.py index 3e4b3995c..88f97a271 100644 --- a/nova/virt/libvirt/blockinfo.py +++ b/nova/virt/libvirt/blockinfo.py @@ -66,6 +66,7 @@ variables / types used """ from nova import block_device +from nova.compute import instance_types from nova import exception from nova.openstack.common import log as logging from nova.virt import configdrive @@ -296,7 +297,7 @@ def get_disk_mapping(virt_type, instance, Returns the guest disk mapping for the devices.""" - inst_type = instance['instance_type'] + inst_type = instance_types.extract_instance_type(instance) mapping = {} diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index 9858e0af2..625560773 100755 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -63,6 +63,7 @@ from xml.dom import minidom from nova.api.metadata import base as instance_metadata from nova import block_device +from nova.compute import instance_types from nova.compute import power_state from nova.compute import task_states from nova.compute import vm_mode @@ -1773,7 +1774,7 @@ class LibvirtDriver(driver.ComputeDriver): root_fname = imagecache.get_cache_fname(disk_images, 'image_id') size = instance['root_gb'] * 1024 * 1024 * 1024 - inst_type = instance['instance_type'] + inst_type = instance_types.extract_instance_type(instance) if size == 0 or suffix == '.rescue': size = None -- cgit