LOG.debug(_('Restoring backup %(backup_id)s (%(body)s)'),
{'backup_id': id, 'body': body})
if not self.is_valid_body(body, 'restore'):
- raise exc.HTTPBadRequest()
-
- context = req.environ['cinder.context']
-
- try:
- restore = body['restore']
- except KeyError:
msg = _("Incorrect request body format")
raise exc.HTTPBadRequest(explanation=msg)
+
+ context = req.environ['cinder.context']
+ restore = body['restore']
volume_id = restore.get('volume_id', None)
LOG.audit(_("Restoring backup %(backup_id)s to volume %(volume_id)s"),
self.assertEqual(res.status_int, 400)
self.assertEqual(res_dict['badRequest']['code'], 400)
self.assertEqual(res_dict['badRequest']['message'],
- 'The server could not comply with the request since'
- ' it is either malformed or otherwise incorrect.')
+ 'Incorrect request body format')
db.backup_destroy(context.get_admin_context(), backup_id)
self.assertEqual(res.status_int, 400)
self.assertEqual(res_dict['badRequest']['code'], 400)
self.assertEqual(res_dict['badRequest']['message'],
- 'The server could not comply with the request since'
- ' it is either malformed or otherwise incorrect.')
+ 'Incorrect request body format')
def test_restore_backup_volume_id_unspecified(self):