summaryrefslogtreecommitdiff
path: root/nova/api/openstack/compute
diff options
context:
space:
mode:
authorjichenjc <jichenjc@cn.ibm.com>2014-03-25 14:47:39 +0800
committerjichenjc <jichenjc@cn.ibm.com>2014-06-17 03:18:31 +0800
commitd62fb490b10d9372bd52189d4c688a7c1b495d8b (patch)
tree4e6d668bd378bed274ea68e3b399c5919beb6357 /nova/api/openstack/compute
parentfc03bd4595ace761c0ca3244c1da5290d6ec1b7b (diff)
downloadnova-d62fb490b10d9372bd52189d4c688a7c1b495d8b.tar.gz
Make resize raise exception when no valid host found
When resize operation starts, it will ask conductor to find a valid host and try to resize to that host. When there is no valid host can be found ,current code return directly without error notification, which will make upper layer code (e.g novaclient) thinks the execution is succesfully performed and report 'Finished'. But actually it isn't due to no valid host was found. Change-Id: I3d66dbfc0a7346762b920e802aa3be92c43d93b7 Closes-Bug: #1297052
Diffstat (limited to 'nova/api/openstack/compute')
-rw-r--r--nova/api/openstack/compute/contrib/admin_actions.py2
-rw-r--r--nova/api/openstack/compute/plugins/v3/migrate_server.py3
-rw-r--r--nova/api/openstack/compute/servers.py2
3 files changed, 7 insertions, 0 deletions
diff --git a/nova/api/openstack/compute/contrib/admin_actions.py b/nova/api/openstack/compute/contrib/admin_actions.py
index 1702371581..183b5d7d83 100644
--- a/nova/api/openstack/compute/contrib/admin_actions.py
+++ b/nova/api/openstack/compute/contrib/admin_actions.py
@@ -159,6 +159,8 @@ class AdminActionsController(wsgi.Controller):
'migrate')
except exception.InstanceNotFound as e:
raise exc.HTTPNotFound(explanation=e.format_message())
+ except exception.NoValidHost as e:
+ raise exc.HTTPBadRequest(explanation=e.format_message())
except Exception as e:
LOG.exception(_("Error in migrate %s"), e)
raise exc.HTTPBadRequest()
diff --git a/nova/api/openstack/compute/plugins/v3/migrate_server.py b/nova/api/openstack/compute/plugins/v3/migrate_server.py
index e43a3c99fa..b2aa8a9dc9 100644
--- a/nova/api/openstack/compute/plugins/v3/migrate_server.py
+++ b/nova/api/openstack/compute/plugins/v3/migrate_server.py
@@ -63,6 +63,9 @@ class MigrateServerController(wsgi.Controller):
'migrate')
except exception.InstanceNotFound as e:
raise exc.HTTPNotFound(explanation=e.format_message())
+ except exception.NoValidHost as e:
+ raise exc.HTTPBadRequest(explanation=e.format_message())
+
return webob.Response(status_int=202)
@extensions.expected_errors((400, 404, 409))
diff --git a/nova/api/openstack/compute/servers.py b/nova/api/openstack/compute/servers.py
index a1da4ccb25..9ede845318 100644
--- a/nova/api/openstack/compute/servers.py
+++ b/nova/api/openstack/compute/servers.py
@@ -1188,6 +1188,8 @@ class Controller(wsgi.Controller):
except exception.Invalid:
msg = _("Invalid instance image.")
raise exc.HTTPBadRequest(explanation=msg)
+ except exception.NoValidHost as e:
+ raise exc.HTTPBadRequest(explanation=e.format_message())
return webob.Response(status_int=202)