Project

General

Profile

Actions

Bug #14501

closed

"rados" command does not honor the "-f" short argument for generating output in JSON format

Added by Lenz Grimmer over 8 years ago. Updated about 7 years ago.

Status:
Resolved
Priority:
Low
Category:
ceph cli
Target version:
-
% Done:

0%

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

Description

While the "rados" command honors the long option "--format=json" for generating JSON output, it does not accept the "-f" short form. This is inconsistent with e.g. the "ceph" command, which supports both option formats just fine. Example:

% ceph --version
ceph version 0.94.5 (9764da52395923e0b32908d83a9f7304401fee43)

% ceph pg dump pools --format=json
dumped pools in format json

[{"poolid":0,"stat_sum":{"num_bytes":887599693,"num_objects":390,"num_object_clones":0,"num_object_copies":1170,"num_objects_missing_on_primary":0,"num_objects_degraded":172,"num_objects_misplaced":390,"num_objects_unfound":0,"num_objects_dirty":390,"num_whiteouts":0,"num_read":2802,"num_read_kb":9065,"num_write":3129,"num_write_kb":794649,"num_scrub_errors":0,"num_shallow_scrub_errors":0,"num_deep_scrub_errors":0,"num_objects_recovered":0,"num_bytes_recovered":0,"num_keys_recovered":0,"num_objects_omap":3,"num_objects_hit_set_archive":0,"num_bytes_hit_set_archive":0},"stat_cat_sum":{},"log_size":3185,"ondisk_log_size":3185},{"poolid":1,"stat_sum":{"num_bytes":0,"num_objects":0,"num_object_clones":0,"num_object_copies":0,"num_objects_missing_on_primary":0,"num_objects_degraded":0,"num_objects_misplaced":0,"num_objects_unfound":0,"num_objects_dirty":0,"num_whiteouts":0,"num_read":0,"num_read_kb":0,"num_write":0,"num_write_kb":0,"num_scrub_errors":0,"num_shallow_scrub_errors":0,"num_deep_scrub_errors":0,"num_objects_recovered":0,"num_bytes_recovered":0,"num_keys_recovered":0,"num_objects_omap":0,"num_objects_hit_set_archive":0,"num_bytes_hit_set_archive":0},"stat_cat_sum":{},"log_size":0,"ondisk_log_size":0}]

% ceph pg dump pools -f json
dumped pools in format json

[{"poolid":0,"stat_sum":{"num_bytes":887599693,"num_objects":390,"num_object_clones":0,"num_object_copies":1170,"num_objects_missing_on_primary":0,"num_objects_degraded":172,"num_objects_misplaced":390,"num_objects_unfound":0,"num_objects_dirty":390,"num_whiteouts":0,"num_read":2802,"num_read_kb":9065,"num_write":3129,"num_write_kb":794649,"num_scrub_errors":0,"num_shallow_scrub_errors":0,"num_deep_scrub_errors":0,"num_objects_recovered":0,"num_bytes_recovered":0,"num_keys_recovered":0,"num_objects_omap":3,"num_objects_hit_set_archive":0,"num_bytes_hit_set_archive":0},"stat_cat_sum":{},"log_size":3185,"ondisk_log_size":3185},{"poolid":1,"stat_sum":{"num_bytes":0,"num_objects":0,"num_object_clones":0,"num_object_copies":0,"num_objects_missing_on_primary":0,"num_objects_degraded":0,"num_objects_misplaced":0,"num_objects_unfound":0,"num_objects_dirty":0,"num_whiteouts":0,"num_read":0,"num_read_kb":0,"num_write":0,"num_write_kb":0,"num_scrub_errors":0,"num_shallow_scrub_errors":0,"num_deep_scrub_errors":0,"num_objects_recovered":0,"num_bytes_recovered":0,"num_keys_recovered":0,"num_objects_omap":0,"num_objects_hit_set_archive":0,"num_bytes_hit_set_archive":0},"stat_cat_sum":{},"log_size":0,"ondisk_log_size":0}]

However, notice how the "rados" command behaves:
% rados --version
ceph version 0.94.5 (9764da52395923e0b32908d83a9f7304401fee43)

% rados df --format=json
{"pools":[{"name":"rbd","id":"0","size_bytes":"887599693","size_kb":"866797","num_objects":"390","num_object_clones":"0","num_object_copies":"1170","num_objects_missing_on_primary":"0","num_objects_unfound":"0","num_objects_degraded":"172","read_ops":"2802","read_bytes":"9282560","write_ops":"3129","write_bytes":"813720576"},{"name":"testpool","id":"1","size_bytes":"0","size_kb":"0","num_objects":"0","num_object_clones":"0","num_object_copies":"0","num_objects_missing_on_primary":"0","num_objects_unfound":"0","num_objects_degraded":"0","read_ops":"0","read_bytes":"0","write_ops":"0","write_bytes":"0"}],"total_objects":"390","total_used":"34991420","total_avail":"13246180","total_space":"50940440"}%                      

% rados df -f json
pool name                 KB      objects       clones     degraded      unfound           rd        rd KB           wr        wr KB
rbd                   866797          390            0          172           0         2802         9065         3129       794649
testpool                   0            0            0            0           0            0            0            0            0
  total used        34991420          390
  total avail       13246180
  total space       50940440

It would be nice, if the "rados" command would honor the short form "-f" as well.

Actions #1

Updated by Abhishek Lekshmanan about 8 years ago

Unfortunately the short option `f` is already used up as a `force` option

Actions #2

Updated by Kefu Chai about 8 years ago

"force" option is not used at all. unless some unknown test is broken, we can just use '-f' as the alias of '--format'.

Actions #3

Updated by Abhishek Lekshmanan about 8 years ago

  • Status changed from New to In Progress
  • Assignee set to Abhishek Lekshmanan
Actions #4

Updated by Abhishek Lekshmanan about 8 years ago

  • Status changed from In Progress to Fix Under Review

Things are a bit more complicated, here, as `-f` seemed to be already in use for setting the option as foreground in daemons.

Master PR: https://github.com/ceph/ceph/pull/7374

Actions #5

Updated by Sage Weil about 7 years ago

  • Status changed from Fix Under Review to Resolved

this works now

Actions

Also available in: Atom PDF