Remove uses of instance['instance_type'] from nova/compute

Note that some tests were verifying things that can no longer fail, namely
rebuilding instances who use flavors that have since been disabled. These
tests are removed here.

Also, this changes the order of a piece of logic in the resize/migrate
path where before we would have ended up checking the instance type that
we fetched from sys_meta to see if it was disabled (which makes no sense
now). Reversing the check (to see if we're doing a resize or a migrate
before checking the new flavor) eliminates the problem of the stashed
type not having the 'disabled' attribute.

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: I214a693e3bb16c0a365eb9b3afe73601beba4a22
This commit is contained in:
Dan Smith
2013-03-05 13:57:10 -05:00
parent efc30692ce
commit 5a76135526

View File

@@ -1362,6 +1362,13 @@ def metadata_to_dict(metadata):
return result
def dict_to_metadata(metadata):
result = []
for key, value in metadata.iteritems():
result.append(dict(key=key, value=value))
return result
def get_wrapped_function(function):
"""Get the method at the bottom of a stack of decorators."""
if not hasattr(function, 'func_closure') or not function.func_closure: