diff options
| author | Kravchenko Pavel <kpavel@il.ibm.com> | 2013-03-08 16:13:30 +0200 |
|---|---|---|
| committer | Kravchenko Pavel <kpavel@il.ibm.com> | 2013-03-08 16:16:16 +0200 |
| commit | 21b7149c5a9f8a33b337eec44d4a8a9c716781e3 (patch) | |
| tree | d9772a8c9d44d15f5a6dbbbf35ce37e9cacd593e /nova/tests | |
| parent | b0998792222bd3aede65feeb32d1c2d6e6f8080b (diff) | |
Fix instance evacuate with shared storage
Fixes instance evacuation problem when --on-shared-storage flag
specified. The problem occurs as the password variable ends up being
accessed before it is assigned. Also adds missing test case.
Fixes bug 1152492
Change-Id: I461c0f7fcf8835028f7529a7860fb330d1759d68
Diffstat (limited to 'nova/tests')
| -rw-r--r-- | nova/tests/api/openstack/compute/contrib/test_evacuate.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/nova/tests/api/openstack/compute/contrib/test_evacuate.py b/nova/tests/api/openstack/compute/contrib/test_evacuate.py index fad89db02..7aa02e53a 100644 --- a/nova/tests/api/openstack/compute/contrib/test_evacuate.py +++ b/nova/tests/api/openstack/compute/contrib/test_evacuate.py @@ -154,3 +154,29 @@ class EvacuateTest(test.TestCase): self.assertEqual(resp.status_int, 200) resp_json = jsonutils.loads(resp.body) self.assertEqual(CONF.password_length, len(resp_json['adminPass'])) + + def test_evacuate_shared(self): + ctxt = context.get_admin_context() + ctxt.user_id = 'fake' + ctxt.project_id = 'fake' + ctxt.is_admin = True + app = fakes.wsgi_app(fake_auth_context=ctxt) + uuid = self.UUID + req = webob.Request.blank('/v2/fake/servers/%s/action' % uuid) + req.method = 'POST' + req.body = jsonutils.dumps({ + 'evacuate': { + 'host': 'my_host', + 'onSharedStorage': 'True', + } + }) + req.content_type = 'application/json' + + def fake_update(inst, context, instance, + task_state, expected_task_state): + return None + + self.stubs.Set(compute_api.API, 'update', fake_update) + + res = req.get_response(app) + self.assertEqual(res.status_int, 200) |
