Cleanup instance_update so it only takes a UUID.
You know when you try to do something simple like tweak instance_update and instance_update_and_get_original and it turns out to have all these knock on effects? Yeah, that. I still think this is a good idea though. I'd like to live in a future where we don't have instance ids at all at the DB API level. We need to do this to get there. Change-Id: Ia51d06beaec068a8544642a6a4bf489247ff61a0
This commit is contained in:
@@ -117,7 +117,7 @@ class DbApiTestCase(test.TestCase):
|
||||
instance = db.instance_create(ctxt, values)
|
||||
results = db.instance_get_all_hung_in_rebooting(ctxt, 10)
|
||||
self.assertEqual(1, len(results))
|
||||
db.instance_update(ctxt, instance.id, {"task_state": None})
|
||||
db.instance_update(ctxt, instance['uuid'], {"task_state": None})
|
||||
|
||||
# Ensure the newly rebooted instance is not returned.
|
||||
updated_at = utils.utcnow()
|
||||
@@ -125,7 +125,7 @@ class DbApiTestCase(test.TestCase):
|
||||
instance = db.instance_create(ctxt, values)
|
||||
results = db.instance_get_all_hung_in_rebooting(ctxt, 10)
|
||||
self.assertEqual(0, len(results))
|
||||
db.instance_update(ctxt, instance.id, {"task_state": None})
|
||||
db.instance_update(ctxt, instance['uuid'], {"task_state": None})
|
||||
|
||||
def test_network_create_safe(self):
|
||||
ctxt = context.get_admin_context()
|
||||
@@ -177,7 +177,7 @@ class DbApiTestCase(test.TestCase):
|
||||
# Update the metadata
|
||||
values = {'metadata': {'host': 'bar'},
|
||||
'system_metadata': {'original_image_ref': 'baz'}}
|
||||
db.instance_update(ctxt, instance.id, values)
|
||||
db.instance_update(ctxt, instance['uuid'], values)
|
||||
|
||||
# Retrieve the user-provided metadata to ensure it was successfully
|
||||
# updated
|
||||
@@ -200,7 +200,7 @@ class DbApiTestCase(test.TestCase):
|
||||
# Update the metadata
|
||||
values = {'metadata': {'host': 'bar'},
|
||||
'system_metadata': {'original_image_ref': 'baz'}}
|
||||
db.instance_update(ctxt, instance.uuid, values)
|
||||
db.instance_update(ctxt, instance['uuid'], values)
|
||||
|
||||
# Retrieve the user-provided metadata to ensure it was successfully
|
||||
# updated
|
||||
@@ -219,7 +219,7 @@ class DbApiTestCase(test.TestCase):
|
||||
instance = db.instance_create(ctxt, values)
|
||||
|
||||
(old_ref, new_ref) = db.instance_update_and_get_original(ctxt,
|
||||
instance['id'], {'vm_state': 'needscoffee'})
|
||||
instance['uuid'], {'vm_state': 'needscoffee'})
|
||||
self.assertEquals("building", old_ref["vm_state"])
|
||||
self.assertEquals("needscoffee", new_ref["vm_state"])
|
||||
|
||||
|
||||
@@ -1297,7 +1297,7 @@ class LibvirtConnTestCase(test.TestCase):
|
||||
'power_state': power_state.RUNNING,
|
||||
'vm_state': vm_states.ACTIVE}
|
||||
instance_ref = db.instance_create(self.context, self.test_instance)
|
||||
instance_ref = db.instance_update(self.context, instance_ref['id'],
|
||||
instance_ref = db.instance_update(self.context, instance_ref['uuid'],
|
||||
instance_dict)
|
||||
vol_dict = {'status': 'migrating', 'size': 1}
|
||||
volume_ref = db.volume_create(self.context, vol_dict)
|
||||
|
||||
@@ -1267,7 +1267,7 @@ class XenAPIGenerateLocal(test.TestCase):
|
||||
def test_generate_swap(self):
|
||||
"""Test swap disk generation."""
|
||||
instance = db.instance_create(self.context, self.instance_values)
|
||||
instance = db.instance_update(self.context, instance['id'],
|
||||
instance = db.instance_update(self.context, instance['uuid'],
|
||||
{'instance_type_id': 5})
|
||||
|
||||
def fake_generate_swap(*args, **kwargs):
|
||||
@@ -1279,7 +1279,7 @@ class XenAPIGenerateLocal(test.TestCase):
|
||||
def test_generate_ephemeral(self):
|
||||
"""Test ephemeral disk generation."""
|
||||
instance = db.instance_create(self.context, self.instance_values)
|
||||
instance = db.instance_update(self.context, instance['id'],
|
||||
instance = db.instance_update(self.context, instance['uuid'],
|
||||
{'instance_type_id': 4})
|
||||
|
||||
def fake_generate_ephemeral(*args):
|
||||
|
||||
Reference in New Issue
Block a user