go-ceph icon indicating copy to clipboard operation
go-ceph copied to clipboard

Mistyped rgw adminops parameters

Open sebastianriese opened this issue 3 years ago • 0 comments

If found the following typing errors/inconsistencies in the adminops interface:

  • The fields User.Supended and User.PurgeData are type *int while the API interprets them as booleans (other booleans are typed *bool).

  • The integer parameters QuotaSpec.MaxSizeKb and User.MaxBuckets are mistyped as *int, while they are int64 resp. int32 on the rgw side. The width *int in will depend on the architecture in go. (Note: It is unclear how this works when the values are returned as json – technically all numbers in json are double floats, so int64 can not be represented faithfully – unless the serializer/deserializer both ignore this when serializing/deserializing according to a schema).

Of course, fixing those issues would break any code referencing those fields (as their types would change). So it will have to decided what is more important – stability of the library or consistency with the RGW adminops API.

Independently of the decision this matter should be well documented.

Putting values other than 0 or 1 in the ints-as-booleans will result in the parameter being silently ignored (the return value of RESTargs::get_bool is ignored at all call sites): https://github.com/ceph/ceph/blob/193895ffba4245787a2f50bbd5b80132f0e76e74/src/rgw/rgw_rest.cc#L957

sebastianriese avatar Feb 23 '22 15:02 sebastianriese