Project

General

Profile

Actions

Bug #44962

closed

"ceph fs status" command outputs to stderr instead of stdout when json formatting is passed

Added by Sébastien Han about 4 years ago. Updated almost 4 years ago.

Status:
Resolved
Priority:
Normal
Category:
-
Target version:
-
% Done:

0%

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

Description

[root@rook-ceph-operator-7db68b8877-hdqxp /]# ceph -c /var/lib/rook/rook-ceph/rook-ceph.config fs status 
myfs - 0 clients
====
RANK      STATE        MDS       ACTIVITY     DNS    INOS  
 0        active      myfs-a  Reqs:    0 /s    10     13   
0-s   standby-replay  myfs-b  Evts:    0 /s     0      3   
     POOL        TYPE     USED  AVAIL  
myfs-metadata  metadata   536k  82.4G  
  myfs-data0     data       0   82.4G  
MDS version: ceph version 15.2.0 (dc6a0b5c3cbf6a5e1d6d4f20b5ad466d76b96247) octopus (rc)
[root@rook-ceph-operator-7db68b8877-hdqxp /]# ceph -c /var/lib/rook/rook-ceph/rook-ceph.config fs status 1> /dev/null
[root@rook-ceph-operator-7db68b8877-hdqxp /]# ceph -c /var/lib/rook/rook-ceph/rook-ceph.config fs status 2> /dev/null
myfs - 0 clients
====
RANK      STATE        MDS       ACTIVITY     DNS    INOS  
 0        active      myfs-a  Reqs:    0 /s    10     13   
0-s   standby-replay  myfs-b  Evts:    0 /s     0      3   
     POOL        TYPE     USED  AVAIL  
myfs-metadata  metadata   536k  82.4G  
  myfs-data0     data       0   82.4G  
MDS version: ceph version 15.2.0 (dc6a0b5c3cbf6a5e1d6d4f20b5ad466d76b96247) octopus (rc)

Related issues 1 (0 open1 closed)

Copied to CephFS - Backport #45251: octopus: "ceph fs status" command outputs to stderr instead of stdout when json formatting is passedResolvedKotresh Hiremath RavishankarActions
Actions #1

Updated by Kotresh Hiremath Ravishankar about 4 years ago

  • Assignee set to Kotresh Hiremath Ravishankar
Actions #2

Updated by Kotresh Hiremath Ravishankar about 4 years ago

I think there is slight confusion w.r.t to fd numbers of stdout and stderr.

As per /usr/include/unistd.h

/* Standard file descriptors. /
#define STDIN_FILENO 0 /
Standard input. /
#define STDOUT_FILENO 1 /
Standard output. /
#define STDERR_FILENO 2 /
Standard error output. */

So, as per your description, the command is redirecting properly to stdout. When stdout is redirected to dev/null,
nothing is printing on console and vice versa.

[root@rook-ceph-operator-7db68b8877-hdqxp /]# ceph -c /var/lib/rook/rook-ceph/rook-ceph.config fs status 1> /dev/null
[root@rook-ceph-operator-7db68b8877-hdqxp /]# ceph -c /var/lib/rook/rook-ceph/rook-ceph.config fs status 2> /dev/null
myfs - 0 clients ====
RANK STATE MDS ACTIVITY DNS INOS
0 active myfs-a Reqs: 0 /s 10 13
0-s standby-replay myfs-b Evts: 0 /s 0 3
POOL TYPE USED AVAIL
myfs-metadata metadata 536k 82.4G
myfs-data0 data 0 82.4G
MDS version: ceph version 15.2.0 (dc6a0b5c3cbf6a5e1d6d4f20b5ad466d76b96247) octopus (rc)

Thanks,
Kotresh

Actions #3

Updated by Kotresh Hiremath Ravishankar about 4 years ago

  • Status changed from New to In Progress
Actions #4

Updated by Sébastien Han about 4 years ago

Sorry my bad, this only happens when --format json is used.
Sorry for the confusing, I updated the description.

Actions #5

Updated by Sébastien Han about 4 years ago

[root@rook-ceph-operator-7db68b8877-qjftc /]# ceph -c /var/lib/rook/rook-ceph/rook-ceph.config fs status --format json 1> /dev/null
{"clients": [{"clients": 0, "fs": "myfs"}], "mds_version": "ceph version 15.1.1 (4536217610b4c55c08a293e67f5ae1f1129190be) octopus (rc)", "mdsmap": [{"dns": 10, "inos": 13, "name": "myfs-a", "rank": 0, "rate": 0.0, "state": "active"}, {"dns": 5, "events": 0.0, "inos": 5, "name": "myfs-b", "rank": 0, "state": "standby-replay"}], "pools": [{"avail": 85472018432, "id": 1, "name": "myfs-metadata", "type": "metadata", "used": 524288}, {"avail": 85472018432, "id": 2, "name": "myfs-data0", "type": "data", "used": 65536}]}
[root@rook-ceph-operator-7db68b8877-qjftc /]# ceph -c /var/lib/rook/rook-ceph/rook-ceph.config fs status --format json 2> /dev/null
Actions #6

Updated by Sébastien Han about 4 years ago

  • Subject changed from "ceph fs status" command outputs to stderr instead of stdout to "ceph fs status" command outputs to stderr instead of stdout when json formatting is passed
Actions #7

Updated by Kotresh Hiremath Ravishankar about 4 years ago

  • Pull request ID set to 34561
Actions #8

Updated by Kotresh Hiremath Ravishankar about 4 years ago

Yes, you are right. Sent the PR.

Actions #9

Updated by Kotresh Hiremath Ravishankar about 4 years ago

  • Status changed from In Progress to Fix Under Review
Actions #10

Updated by Greg Farnum about 4 years ago

  • Status changed from Fix Under Review to In Progress

Kotresh, this merged to master but I'm not sure how far we need to backport it, please check and update the ticket.

Actions #11

Updated by Kotresh Hiremath Ravishankar about 4 years ago

Greg Farnum wrote:

Kotresh, this merged to master but I'm not sure how far we need to backport it, please check and update the ticket.

The patch needs to be backported to Octopus. Nautilus doesn't have json support for "ceph fs status" command.

Actions #12

Updated by Kotresh Hiremath Ravishankar about 4 years ago

  • Status changed from In Progress to Pending Backport
Actions #13

Updated by Kotresh Hiremath Ravishankar about 4 years ago

  • Copied to Backport #45251: octopus: "ceph fs status" command outputs to stderr instead of stdout when json formatting is passed added
Actions #14

Updated by Nathan Cutler almost 4 years ago

  • Backport set to octopus
Actions #15

Updated by Nathan Cutler almost 4 years ago

  • Status changed from Pending Backport to Resolved

While running with --resolve-parent, the script "backport-create-issue" noticed that all backports of this issue are in status "Resolved" or "Rejected".

Actions

Also available in: Atom PDF