Project

General

Profile

Actions

Bug #40294

open

librados mon_command json parser int/float type problem

Added by Dominik Csapak almost 5 years ago. Updated almost 5 years ago.

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

0%

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

Description

for some commands there is a parameterof type float,
e.g. for 'osd reweight' there is the parameter 'weight' of type float (with a range of 0.0 to 1.0)

when giving such command as json to rados_mon_command
e.g.

{ "prefix":"osd reweight", "id":0, "weight":0.0 }

it works, but

{ "prefix":"osd reweight", "id":0, "weight": 0 }

does not

this is a problem, since json does not define different types of numbers, so 0.0 and 0 should be treated the same
and some json encoders will convert 0.0 to 0 (e.g. in Perl using JSON::encode_json)


Files

test.c (1.72 KB) test.c Dominik Csapak, 06/13/2019 07:39 AM
Actions #1

Updated by Greg Farnum almost 5 years ago

What's the failure mode? What version are you running against?

Actions #2

Updated by Dominik Csapak almost 5 years ago

Greg Farnum wrote:

What's the failure mode? What version are you running against?

ceph version is 14.2.1

i am not sure what you mean with failure modes, but i have attached a small sample program to
make it clear what we do

that program prints:

cmd successfully exectued
mon_command error: Invalid argument
status: bad or missing field 'weight'
Actions

Also available in: Atom PDF