diff options
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/compute/contrib/services.py | 18 |
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}} |
