diff options
-rw-r--r-- | nova/api/openstack/compute/servers.py | 4 | ||||
-rw-r--r-- | nova/tests/api/openstack/compute/test_servers.py | 14 |
2 files changed, 18 insertions, 0 deletions
diff --git a/nova/api/openstack/compute/servers.py b/nova/api/openstack/compute/servers.py index a62740681..b0531d0e4 100644 --- a/nova/api/openstack/compute/servers.py +++ b/nova/api/openstack/compute/servers.py @@ -981,6 +981,10 @@ class Controller(wsgi.Controller): msg = _("HostId cannot be updated.") raise exc.HTTPBadRequest(explanation=msg) + if 'personality' in body['server']: + msg = _("Personality cannot be updated.") + raise exc.HTTPBadRequest(explanation=msg) + try: instance = self.compute_api.get(ctxt, id) req.cache_db_instance(instance) diff --git a/nova/tests/api/openstack/compute/test_servers.py b/nova/tests/api/openstack/compute/test_servers.py index d32640bf2..dcbd62225 100644 --- a/nova/tests/api/openstack/compute/test_servers.py +++ b/nova/tests/api/openstack/compute/test_servers.py @@ -1184,6 +1184,20 @@ class ServersControllerTest(test.TestCase): self.assertEqual(res_dict['server']['id'], FAKE_UUID) self.assertEqual(res_dict['server']['accessIPv6'], '') + def test_update_server_personality(self): + req = fakes.HTTPRequest.blank('/v2/fake/servers/%s' % FAKE_UUID) + req.method = 'PUT' + req.content_type = 'application/json' + body = { + 'server': { + 'personality': [] + } + } + req.body = jsonutils.dumps(body) + + self.assertRaises(webob.exc.HTTPBadRequest, + self.controller.update, req, FAKE_UUID, body) + def test_update_server_adminPass_ignored(self): inst_dict = dict(name='server_test', adminPass='bacon') body = dict(server=inst_dict) |