summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorMatthew Sherborne <msherborne@gmail.com>2013-03-15 13:46:12 +1000
committerMatthew Sherborne <msherborne@gmail.com>2013-04-23 22:04:01 +1000
commit732bcdb9502aca5c6b38966bd1e53c79236300da (patch)
treee7a5ab2c4fd2fad84c66d64548833f3bc2309236 /nova/api
parentbfc3a3ccb2811cc8a96a15987528e6639ec029bf (diff)
Make os.services.update work with cells
In the nova.api.openstack.compute.contrib.services: * Make update (enable/disable) service work In nova.compute.api.api.HostAPI: Add - service_update - Used by openstack api's services.py In nova.compute.api.cells_api.HostAPI: Add - service_update - Used by openstack api's services.py In cells: * Increase API version from 1.6 to 1.7 * Add service_update Fixes bug #1150499 Change-Id: I5651bd5bc328692df82f4d9da27d390a8c95e03f
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/compute/contrib/services.py18
1 files changed, 8 insertions, 10 deletions
diff --git a/nova/api/openstack/compute/contrib/services.py b/nova/api/openstack/compute/contrib/services.py
index d948c8bc5..9952484f7 100644
--- a/nova/api/openstack/compute/contrib/services.py
+++ b/nova/api/openstack/compute/contrib/services.py
@@ -21,7 +21,6 @@ from nova.api.openstack import extensions
from nova.api.openstack import wsgi
from nova.api.openstack import xmlutil
from nova import compute
-from nova import db
from nova import exception
from nova.openstack.common import timeutils
from nova import utils
@@ -121,7 +120,10 @@ class ServiceController(object):
elif id == "disable":
disabled = True
else:
- raise webob.exc.HTTPNotFound("Unknown action")
+ raise webob.exc.HTTPNotFound(_("Unknown action"))
+
+ status = id + 'd'
+
try:
host = body['host']
binary = body['binary']
@@ -129,15 +131,11 @@ class ServiceController(object):
raise webob.exc.HTTPUnprocessableEntity()
try:
- svc = db.service_get_by_args(context, host, binary)
- if not svc:
- raise webob.exc.HTTPNotFound('Unknown service')
+ svc = self.host_api.service_update(context, host, binary,
+ {'disabled': disabled})
+ except exception.ServiceNotFound as exc:
+ raise webob.exc.HTTPNotFound(_("Unknown service"))
- db.service_update(context, svc['id'], {'disabled': disabled})
- except exception.ServiceNotFound:
- raise webob.exc.HTTPNotFound("service not found")
-
- status = id + 'd'
return {'service': {'host': host, 'binary': binary, 'status': status}}