diff --git a/nova/objects/instance.py b/nova/objects/instance.py index 233418893153..6f10d8c3ca4c 100644 --- a/nova/objects/instance.py +++ b/nova/objects/instance.py @@ -350,7 +350,8 @@ class Instance(base.NovaPersistentObject, base.NovaObject): db_inst = db.instance_create(context, updates) if numa_topology: expected_attrs.append('numa_topology') - numa_topology.create(context, db_inst['uuid']) + numa_topology.instance_uuid = db_inst['uuid'] + numa_topology.create(context) self._from_db_object(context, self, db_inst, expected_attrs) @base.remotable diff --git a/nova/objects/instance_numa_topology.py b/nova/objects/instance_numa_topology.py index 57b5df54409c..6e7a9ab8ad03 100644 --- a/nova/objects/instance_numa_topology.py +++ b/nova/objects/instance_numa_topology.py @@ -62,14 +62,14 @@ class InstanceNUMATopology(base.NovaObject): return hardware.VirtNUMAInstanceTopology(cells=cells) @base.remotable - def create(self, context, instance_uuid): + def create(self, context): if self.obj_attr_is_set('id'): raise exception.ObjectActionError(action='create', reason='already created') topology = self.topology_from_obj() if not topology: return - values = {'instance_uuid': instance_uuid, + values = {'instance_uuid': self.instance_uuid, 'numa_topology': topology.to_json()} db_object = db.instance_extra_create(context, values) self.instance_uuid = db_object['instance_uuid'] diff --git a/nova/tests/objects/test_instance_numa_topology.py b/nova/tests/objects/test_instance_numa_topology.py index 77623a8f560d..67289f298f1e 100644 --- a/nova/tests/objects/test_instance_numa_topology.py +++ b/nova/tests/objects/test_instance_numa_topology.py @@ -38,7 +38,8 @@ class _TestInstanceNUMATopology(object): def test_create(self): topo_obj = objects.InstanceNUMATopology.obj_from_topology( fake_numa_topology) - topo_obj.create(self.context, fake_db_topology['instance_uuid']) + topo_obj.instance_uuid = fake_db_topology['instance_uuid'] + topo_obj.create(self.context) got = objects.InstanceNUMATopology.get_by_instance_uuid( self.context, fake_db_topology['instance_uuid']) self.assertIsNotNone(got) diff --git a/nova/tests/objects/test_objects.py b/nova/tests/objects/test_objects.py index 72cabc788321..35bf63924592 100644 --- a/nova/tests/objects/test_objects.py +++ b/nova/tests/objects/test_objects.py @@ -961,7 +961,7 @@ object_data = { 'InstanceInfoCache': '1.5-ef64b604498bfa505a8c93747a9d8b2f', 'InstanceList': '1.8-16db4c93fe5b80564413b9a4f547e0d1', 'InstanceNUMACell': '1.0-17e6ee0a24cb6651d1b084efa3027bda', - 'InstanceNUMATopology': '1.0-a4264388d42c21a692cb74ed8fa8bb4d', + 'InstanceNUMATopology': '1.0-86b95d263c4c68411d44c6741b8d2bb0', 'KeyPair': '1.1-3410f51950d052d861c11946a6ae621a', 'KeyPairList': '1.0-71132a568cc5d078ba1748a9c02c87b8', 'Migration': '1.1-67c47726c2c71422058cd9d149d6d3ed',