Project

General

Profile

Bug #44573

mgr/restful Verify API argument

Added by shi liu about 4 years ago. Updated about 4 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
restful module
Target version:
-
% Done:

0%

Source:
Tags:
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

When I use the following command to create a pool through restful

$ curl -k https://${NAME}:${SECRET}@10.34.130.90:42400/pool -X POST -d '{"name":"pool","pg_num":"32"}' | jq
{
  "failed": [],
  "finished": [],
  "has_failed": false,
  "id": "140153186859496",
  "is_finished": false,
  "is_waiting": false,
  "running": [
    {
      "command": "osd pool create pool=pool pg_num=32",
      "outb": "",
      "outs": "" 
    }
  ],
  "state": "pending",
  "waiting": []
}

it seems that everything is normal, but the new pool was not created successfully, and then I found the following error in the mon log:

2020-03-12T01:21:00.000-0400 7f7e9c557700  2 mon.a@0(leader) e1 send_reply 0x55ac71517320 0x55ac7261f040 mon_command_ack([{"prefix": "osd pool create", "pool": "pool", "pg_num": "32"}]=-22 bad or missing field 'pg_num' v20) v1

obviously because of the wrong `pg_num` argument type, I think the restful api interface should add a parameter check mechanism, and return an error directly when the parameter is passed incorrectly

I'll finish the job if no one disputes it

History

#1 Updated by Greg Farnum about 4 years ago

  • Project changed from Ceph to mgr
  • Category changed from rest-api to restful module

Also available in: Atom PDF