Bug #44962
closed"ceph fs status" command outputs to stderr instead of stdout when json formatting is passed
0%
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)
Updated by Kotresh Hiremath Ravishankar about 4 years ago
- Assignee set to Kotresh Hiremath Ravishankar
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
Updated by Kotresh Hiremath Ravishankar about 4 years ago
- Status changed from New to In Progress
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.
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
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
Updated by Kotresh Hiremath Ravishankar about 4 years ago
- Pull request ID set to 34561
Updated by Kotresh Hiremath Ravishankar about 4 years ago
Yes, you are right. Sent the PR.
Updated by Kotresh Hiremath Ravishankar about 4 years ago
- Status changed from In Progress to Fix Under Review
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.
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.
Updated by Kotresh Hiremath Ravishankar about 4 years ago
- Status changed from In Progress to Pending Backport
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
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".