ceph device ls* output and CLI verbosity

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm working on the device tracking (to support disk failure prediction 
etc), and have a question about how to approach the CLI commands.  We have 
several commands,

 device info <devid>
 device ls
 device ls-by-daemon <who>
 device ls-by-host <host>

info will dump metadata about a single device, e.g.

$ bin/ceph device info 
INTEL_SSDPEDMD400G4_CVFT520200G7400BGN 
device INTEL_SSDPEDMD400G4_CVFT520200G7400BGN
attachment gnit:nvme0n1
daemons osd.0,osd.1
expected_failure 2019-10-20 21:12:12.000000 (as of 2018-06-06 09:35:21.876620)

$ bin/ceph device info INTEL_SSDPEDMD400G4_CVFT520200G7400BGN  -f json-pretty

{
    "devid": "INTEL_SSDPEDMD400G4_CVFT520200G7400BGN",
    "location": [
        {
            "host": "gnit",
            "dev": "nvme0n1"
        }
    ],
    "daemons": [
        "osd.0",
        "osd.1"
    ],
    "expected_failure": "2019-10-20 21:12:12.000000",
    "expected_failure_stamp": "2018-06-06 09:35:21.876620"
}

I'm not sure about the ls commands, though.  Originally, ls would just 
list the device ids, like so:

$ bin/ceph device ls
INTEL_SSDPEDMD400G4_CVFT520200G7400BGN

but it is nice to get a table with useful information like so:

$ bin/ceph device ls
DEVICE                                 HOST         DAEMONS     EXPECTED FAILURE           
INTEL_SSDPEDMD400G4_CVFT520200G7400BGN gnit:nvme0n1 osd.0 osd.1 2019-10-20 21:12:12.000000 

Same for the ls-by-* variants, which skip (or change) the HOST and DAEMONS 
columns.

Similarly, the original JSON commands just output a JSON list, but I 
changed them to dump everything:

$ bin/ceph device ls-by-daemon osd.0 -f json-pretty

[
    {
        "devid": "INTEL_SSDPEDMD400G4_CVFT520200G7400BGN",
        "location": [
            {
                "host": "gnit",
                "dev": "nvme0n1"
            }
        ],
        "daemons": [
            "osd.0",
            "osd.1"
        ],
        "expected_failure": "2019-10-20 21:12:12.000000",
        "expected_failure_stamp": "2018-06-06 09:35:21.876620"
    }
]

I think this is all fine and good except that lazy bash graybeards like 
myself who haven't mastered jq can do a simple for f in `ceph device ls` 
loop.  We could only dump the table if you add an optional 'detail' 
argument like we've done elsewhere, but I kind of hate that.

Any suggestions on how we should approach this type of thing in the CLI?

The current version of the PR is doing the verbose thing:

	https://github.com/ceph/ceph/pull/22423
	
sage
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux