Merge "InstanceNUMAToplogy object create remove uuid param"

This commit is contained in:
Jenkins 2014-09-03 04:59:24 +00:00 committed by Gerrit Code Review
commit eccc42d496
4 changed files with 7 additions and 5 deletions

View File

@ -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

View File

@ -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']

View File

@ -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)

View File

@ -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',