delete or query an not exist snapshot raise exception more readable

Bug #1279189 reported by jichenjc
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
jichenjc

Bug Description

In V2 API layer code, it would be better if we raise exception instead of return it

try:
            self.volume_api.delete_snapshot(context, id)
        except exception.NotFound:
            return exc.HTTPNotFound() ----> use raise instead of return

jichenjc (jichenjc)
Changed in nova:
assignee: nobody → jichencom (jichenjc)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

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

Changed in nova:
status: New → In Progress
Revision history for this message
jichenjc (jichenjc) wrote :

From Ken'ichi Ohmichi's review comments, this defect is 'make code more readable ' not modify the output value

$ curl -i 'http://192.168.11.100:8774/v2/ddfa0a03f4134a8b916db8becd02017e/os-snapshots/<non-existent id>' -X GET [..]
HTTP/1.1 404 Not Found
X-Compute-Request-Id: req-d4f4b159-4ba9-4954-a7bd-4276f4a882ed
Content-Length: 52
Content-Type: text/plain; charset=UTF-8
Date: Tue, 11 Mar 2014 09:42:27 GMT

404 Not Found

The resource could not be found.
$

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/72906
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=0b311bffc0f22f0b877d6bcad0c4cbcf1701dd54
Submitter: Jenkins
Branch: master

commit 0b311bffc0f22f0b877d6bcad0c4cbcf1701dd54
Author: jichenjc <email address hidden>
Date: Tue Jan 28 12:13:38 2014 +0800

    Raise exception if volume snapshot id not found instead of return

    In V2 API, if show or delete a snapshot with an unknown id, exception
    will be returned instead of raised. Even though correct error
    will be returned to client, it's not aligned to other API layer
    code, this patch modify it by raise exception instead of return.

    Change-Id: I22d4565ca08e1c0ed5041ce903bf6ba918c14cfd
    Closes-Bug: #1279189

Changed in nova:
status: In Progress → Fix Committed
Changed in nova:
milestone: none → icehouse-rc1
Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: icehouse-rc1 → 2014.1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.