diff options
| author | Jenkins <jenkins@review.openstack.org> | 2013-03-09 15:30:35 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-03-09 15:30:35 +0000 |
| commit | a28bce3453b1732b1c25ea1151f0bd298e2f71e2 (patch) | |
| tree | 5c0592de327b8aaca11984c2797dab8a4e1c46b2 | |
| parent | 5970a553e79aa3fae71d85b35ed8a14fd51df296 (diff) | |
| parent | 21b7149c5a9f8a33b337eec44d4a8a9c716781e3 (diff) | |
Merge "Fix instance evacuate with shared storage"
| -rw-r--r-- | nova/api/openstack/compute/contrib/evacuate.py | 1 | ||||
| -rw-r--r-- | nova/tests/api/openstack/compute/contrib/test_evacuate.py | 26 |
2 files changed, 27 insertions, 0 deletions
diff --git a/nova/api/openstack/compute/contrib/evacuate.py b/nova/api/openstack/compute/contrib/evacuate.py index 7877fa1fd..275cec904 100644 --- a/nova/api/openstack/compute/contrib/evacuate.py +++ b/nova/api/openstack/compute/contrib/evacuate.py @@ -53,6 +53,7 @@ class Controller(wsgi.Controller): on_shared_storage = utils.bool_from_str( evacuate_body["onSharedStorage"]) + password = None if 'adminPass' in evacuate_body: # check that if requested to evacuate server on shared storage # password not specified 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) |
