summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorRussell Bryant <rbryant@redhat.com>2012-07-26 13:53:33 -0400
committerRussell Bryant <rbryant@redhat.com>2012-07-26 18:46:32 -0400
commit6fa8a0860dace7ba71f32207375d82387bbbbb68 (patch)
tree15fcfe00980c2e22eaa6cca4663d9c5f2575e45d /nova/tests
parenta484f066008487ed89c27ec4bee8a64b011c20f6 (diff)
Send a full instance via rpc for inject_file.
Change the inject_file method of the compute rpc API to take a full instance over rpc instead of just the instance UUID. This cuts down on database access needed by nova-compute. Part of blueprint no-db-messaging. Change-Id: Ife38a87cb8a597b40b2b87d9a6a8c7e81d4439c4
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/compute/test_compute.py6
-rw-r--r--nova/tests/compute/test_rpcapi.py4
2 files changed, 6 insertions, 4 deletions
diff --git a/nova/tests/compute/test_compute.py b/nova/tests/compute/test_compute.py
index e6bc8547f..c6d349057 100644
--- a/nova/tests/compute/test_compute.py
+++ b/nova/tests/compute/test_compute.py
@@ -682,10 +682,10 @@ class ComputeTestCase(BaseTestCase):
self.stubs.Set(nova.virt.fake.FakeDriver, 'inject_file',
fake_driver_inject_file)
- instance = self._create_fake_instance()
+ instance = jsonutils.to_primitive(self._create_fake_instance())
self.compute.run_instance(self.context, instance['uuid'])
- self.compute.inject_file(self.context, instance['uuid'], "/tmp/test",
- "File Contents")
+ self.compute.inject_file(self.context, "/tmp/test",
+ "File Contents", instance=instance)
self.assertTrue(called['inject'])
self.compute.terminate_instance(self.context, instance['uuid'])
diff --git a/nova/tests/compute/test_rpcapi.py b/nova/tests/compute/test_rpcapi.py
index 2bbb7e665..fd4b5eb4e 100644
--- a/nova/tests/compute/test_rpcapi.py
+++ b/nova/tests/compute/test_rpcapi.py
@@ -54,6 +54,7 @@ class ComputeRpcAPITestCase(test.TestCase):
'check_can_live_migrate_source', 'confirm_resize',
'detach_volume', 'finish_resize', 'finish_revert_resize',
'get_console_output', 'get_diagnostics', 'get_vnc_console',
+ 'inject_file',
'pause_instance', 'reboot_instance', 'suspend_instance',
'unpause_instance'
]
@@ -198,7 +199,8 @@ class ComputeRpcAPITestCase(test.TestCase):
def test_inject_file(self):
self._test_compute_api('inject_file', 'cast',
- instance=self.fake_instance, path='path', file_contents='fc')
+ instance=self.fake_instance, path='path', file_contents='fc',
+ version='1.18')
def test_inject_network_info(self):
self._test_compute_api('inject_network_info', 'cast',