From f59a0373834655346b50eac2a033c7cb31061c3a Mon Sep 17 00:00:00 2001 From: Tiago Mello Date: Tue, 12 Feb 2013 20:32:59 -0200 Subject: Forces flavorRef to be string in servers resize api flavorid column is a string in the database model and MySQL silently accepts either integer or string as data type. However PostgreSQL expects the right data type. So we force it to be string as early as possible in the api. Fixes Bug 1123525 Change-Id: Id117868b3a2f840f5d7ab463f3b79b6631b3b514 --- nova/api/openstack/compute/servers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nova/api/openstack/compute/servers.py b/nova/api/openstack/compute/servers.py index 723997eba..5858ad640 100644 --- a/nova/api/openstack/compute/servers.py +++ b/nova/api/openstack/compute/servers.py @@ -1202,7 +1202,7 @@ class Controller(wsgi.Controller): def _action_resize(self, req, id, body): """Resizes a given instance to the flavor size requested.""" try: - flavor_ref = body["resize"]["flavorRef"] + flavor_ref = str(body["resize"]["flavorRef"]) if not flavor_ref: msg = _("Resize request has invalid 'flavorRef' attribute.") raise exc.HTTPBadRequest(explanation=msg) -- cgit