service update catch wrong exception

Bug #1551101 reported by Lisa Li on 2016-02-29
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Low
Lisa Li

Bug Description

During service update api, it catches serviceNotFound exception.

https://github.com/openstack/cinder/blob/master/cinder/api/contrib/services.py#L224
 try:
            svc = objects.Service.get_by_args(context, host, binary_key)
....
        except exception.ServiceNotFound:
            raise webob.exc.HTTPNotFound(explanation=_("service not found"))

        ret_val.update({'host': host, 'service': service,
                        'binary': binary, 'status': status})

This is wrong. As objects.Service.get_by_args raises HostBinaryNotFound exception.

Lisa Li (lisali) on 2016-02-29
Changed in cinder:
importance: Undecided → Low

Fix proposed to branch: master
Review: https://review.openstack.org/285908

Changed in cinder:
status: New → In Progress

Reviewed: https://review.openstack.org/285908
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=802c5633e064ad7d79ae7e5aa0ffb2e1df60f96b
Submitter: Jenkins
Branch: master

commit 802c5633e064ad7d79ae7e5aa0ffb2e1df60f96b
Author: LisaLi <email address hidden>
Date: Mon Feb 29 15:12:18 2016 +0800

    Fix exception during service update

    The function objects.Service.get_by_args raises HostBinaryNotFound
    exception, but in service update function, it catches ServiceNotFound
    exception by mistake.

    This patch is to remove HostBinaryNotFound and use ServiceNotFound to make
    things simple and consistent.

    Change-Id: Ic2ef79ca03393f3b1eb5bb89d4ffcf92d76460c6
    Closes-bug: #1551101

Changed in cinder:
status: In Progress → Fix Released
wanghao (wanghao749) on 2016-03-03
Changed in cinder:
milestone: none → mitaka-3
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers