nova/nova/tests/unit/compute
Matt Riedemann 08d1153d3b Don't expect meta attributes in object_compat that aren't in the db obj
The object_compat decorator expects to get the Instance object with
'metadata' and 'system_metadata' attributes but if those aren't in the
db instance dict object, Instance._from_db_object will fail with a
KeyError.

In Kilo this happens per refresh_instance_security_rules because in the
compute API code, the instance passed to refresh_instance_security_rules
comes from the call to get the security group(s) which joins on the
instances column, but that doesn't join on the metadata/system_metadata
fields for the instances.  So when the instances get to object_compat in
the compute manager and the db instance dict is converted to the
Instance object, it expects fields that aren't in the dict and we get
the KeyError.

The refresh_instance_security_rules case is fixed in Liberty per commit
12fbe6f082 - in that case the compute API
passes Instance objects to the compute manager so object_compat doesn't
have anything to do, _load_instance just sees instance_or_dict isn't a
dict and ignores it.

We're making this change since (1) it's an obviously wrong assumption in
object_compat and should be fixed and (2) we need to backport this fix
to stable/kilo since it's an upgrade impact for users there.

Closes-Bug: #1484738

Change-Id: I36a954c095a9aa35879200784dc18e35edf689e6
(cherry picked from commit 9369aab04e)
2015-09-09 20:37:14 -07:00
..
monitors Make compute unit tests inherit from test.NoDBTestCase 2015-02-24 17:54:29 +02:00
__init__.py move all tests to nova/tests/unit 2014-11-12 15:31:08 -05:00
eventlet_utils.py move all tests to nova/tests/unit 2014-11-12 15:31:08 -05:00
fake_resource_tracker.py Objectify calls to service_get_by_compute_host 2015-02-17 23:38:04 +00:00
test_arch.py move all tests to nova/tests/unit 2014-11-12 15:31:08 -05:00
test_claims.py Merge "objects: introduce numa topology limits objects" 2015-03-13 09:45:23 +00:00
test_compute.py Don't expect meta attributes in object_compat that aren't in the db obj 2015-09-09 20:37:14 -07:00
test_compute_api.py Don't check flavor disk size when booting from volume 2015-08-14 15:02:17 -04:00
test_compute_cells.py Don't check flavor disk size when booting from volume 2015-08-14 15:02:17 -04:00
test_compute_mgr.py Merge "Handle unexpected clear events call" into stable/kilo 2015-08-14 16:14:54 +00:00
test_compute_utils.py Truncate encoded instance sys meta to 255 or less 2015-03-04 20:17:08 -06:00
test_compute_xen.py Switch to using oslo_* instead of oslo.* 2015-02-06 06:03:10 -05:00
test_flavors.py Make compute unit tests inherit from test.NoDBTestCase 2015-02-24 17:54:29 +02:00
test_host_api.py Use cells.utils.ServiceProxy object within cells_api 2015-04-07 23:09:38 +02:00
test_hvtype.py Add 'docker' to the list of known hypervisor types 2015-06-18 18:47:51 +00:00
test_keypairs.py Adds cleanup on v2.2 keypair api and tests 2015-03-24 17:06:18 +02:00
test_multiple_nodes.py Switch to using oslo_* instead of oslo.* 2015-02-06 06:03:10 -05:00
test_resource_tracker.py Resource tracker: unable to restart nova compute 2015-04-20 04:34:57 -07:00
test_resources.py Make compute unit tests inherit from test.NoDBTestCase 2015-02-24 17:54:29 +02:00
test_rpcapi.py Add security group calls missing from latest compute rpc api version bump 2015-04-27 07:42:04 -07:00
test_shelve.py Execute _poll_shelved_instances only if shelved_offload_time is > 0 2015-07-24 05:57:18 +00:00
test_stats.py Convert nova.compute.* to use instance dot notation 2015-02-25 17:21:36 -05:00
test_tracker.py Merge "Move ComputeNode creation at init stage in ResourceTracker" 2015-03-27 19:28:47 +00:00
test_virtapi.py Switch to moxstubout and mockpatch from oslotest 2014-12-02 08:03:42 -05:00
test_vmmode.py Convert nova.compute.* to use instance dot notation 2015-02-25 17:21:36 -05:00