summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-05-03 14:48:32 +0000
committerGerrit Code Review <review@openstack.org>2013-05-03 14:48:32 +0000
commit5d96c9dbfb82e888a235075b34d6c7c9783fbd5c (patch)
tree874d9393a71c5ef1cae53d81e1db65de933d2d1f /nova/tests
parent00daebb7d12e6b78cc77f9d6eaaa19e940b21b38 (diff)
parentcccca7a4531cdad88655c27533f63c590a5ddfa1 (diff)
Merge "Fix key error when create lpar instance failed"
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/test_powervm.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/nova/tests/test_powervm.py b/nova/tests/test_powervm.py
index 9440a13b4..96954269e 100644
--- a/nova/tests/test_powervm.py
+++ b/nova/tests/test_powervm.py
@@ -22,6 +22,7 @@ import contextlib
from nova import context
from nova import db
+from nova import exception as nova_exception
from nova import test
from nova.compute import instance_types
@@ -214,6 +215,27 @@ class PowerVMDriverTestCase(test.TestCase):
state = self.powervm_connection.get_info(self.instance)['state']
self.assertEqual(state, power_state.RUNNING)
+ def test_spawn_create_lpar_fail(self):
+ # Verify on a failed spawn, we get the original exception raised.
+ # helper function
+ def raise_(ex):
+ raise ex
+
+ self.flags(powervm_img_local_path='/images/')
+ self.stubs.Set(images, 'fetch', lambda *x, **y: None)
+ self.stubs.Set(
+ self.powervm_connection._powervm,
+ 'get_host_stats',
+ lambda *x, **y: raise_(
+ (nova_exception.ProcessExecutionError('instance_name'))))
+ fake_net_info = network_model.NetworkInfo([
+ fake_network_cache_model.new_vif()])
+ self.assertRaises(exception.PowerVMLPARCreationFailed,
+ self.powervm_connection.spawn,
+ context.get_admin_context(),
+ self.instance,
+ {'id': 'ANY_ID'}, [], 's3cr3t', fake_net_info)
+
def test_spawn_cleanup_on_fail(self):
# Verify on a failed spawn, we get the original exception raised.
# helper function