No need to raise exc.HTTPBadRequest when no volume_id in create_backup

Bug #1549647 reported by Lisa Li
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
In Progress
Low
Tushar Trambak Gite

Bug Description

Mitaka imports the function of backing snapshot.

When creating backup of a snapshot with following comamnd:
curl -g -i -X POST http://192.168.2.180:8776/v2/2add7d16f22a45a789ab896805e3bdc4/backups -H "User-Agent: python-cinderclient" -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: 4d52d927501745318d578814cd61cc88" -d '{"backup": {"force": false, "description": null, "incremental": false, "snapshot_id": "3d12f820-853d-406d-920f-01399c94426a", "container": null, "name": "test1"}}'

it gives following error:

HTTP/1.1 400 Bad Request
Content-Length: 73
Content-Type: application/json; charset=UTF-8
X-Compute-Request-Id: req-843344e9-1e52-4c4c-af77-00e00fbc3fff
X-Openstack-Request-Id: req-843344e9-1e52-4c4c-af77-00e00fbc3fff
Date: Thu, 25 Feb 2016 07:37:54 GMT

{"badRequest": {"message": "Incorrect request body format", "code": 400}}

Reason:

    def create(self, req, body):
        """Create a new backup."""
        LOG.debug('Creating new backup %s', body)
        self.assert_valid_body(body, 'backup')

        context = req.environ['cinder.context']
        backup = body['backup']

        try:
            volume_id = backup['volume_id']
        except KeyError:
            msg = _("Incorrect request body format")
            raise exc.HTTPBadRequest(explanation=msg) Here no need to raise exception.

Lisa Li (lisali)
Changed in cinder:
importance: Undecided → High
importance: High → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

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

Changed in cinder:
status: New → In Progress
Lisa Li (lisali)
Changed in cinder:
importance: Medium → High
Lisa Li (lisali)
Changed in cinder:
milestone: none → mitaka-3
Changed in cinder:
importance: High → Medium
Revision history for this message
Lisa Li (lisali) wrote :

Set it to low as volume_id in creating backup is required in Liberty. Should/Can we change it from required to optional when introducing snapshot backup?

Changed in cinder:
importance: Medium → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on cinder (master)

Change abandoned by LisaLi (<email address hidden>) on branch: master
Review: https://review.openstack.org/284572

Revision history for this message
Sean McGinnis (sean-mcginnis) wrote : Bug Assignee Expired

Unassigning due to no activity for > 6 months.

Changed in cinder:
assignee: Lisa Li (lisali) → nobody
Changed in cinder:
status: In Progress → New
Changed in cinder:
assignee: nobody → Tushar Trambak Gite (tushargite96)
Changed in cinder:
status: New → In Progress
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.