mirror of
https://github.com/ceph/ceph
synced 2024-12-17 17:05:42 +00:00
ceph.in: make osdids() (and mon, mds) work on old mons
Signed-off-by: Dan Mick <dan.mick@inktank.com> Reviewed-by: Sage Weil <sage@inktank.com>
This commit is contained in:
parent
4b739005a5
commit
3f93691bf3
11
src/ceph.in
11
src/ceph.in
@ -64,6 +64,9 @@ cluster_handle = None
|
||||
|
||||
def osdids():
|
||||
ret, outbuf, outs = json_command(cluster_handle, prefix='osd ls')
|
||||
if ret == -errno.EINVAL:
|
||||
# try old mon
|
||||
ret, outbuf, outs = send_command(cluster_handle, cmd=['osd', 'ls'])
|
||||
if ret:
|
||||
raise RuntimeError('Can\'t contact mon for osd list')
|
||||
return [i for i in outbuf.split('\n') if i != '']
|
||||
@ -71,6 +74,10 @@ def osdids():
|
||||
def monids():
|
||||
ret, outbuf, outs = json_command(cluster_handle, prefix='mon dump',
|
||||
argdict={'format':'json'})
|
||||
if ret == -errno.EINVAL:
|
||||
# try old mon
|
||||
ret, outbuf, outs = send_command(cluster_handle,
|
||||
cmd=['mon', 'dump', '--format=json'])
|
||||
if ret:
|
||||
raise RuntimeError('Can\'t contact mon for mon list')
|
||||
d = json.loads(outbuf)
|
||||
@ -79,6 +86,10 @@ def monids():
|
||||
def mdsids():
|
||||
ret, outbuf, outs = json_command(cluster_handle, prefix='mds dump',
|
||||
argdict={'format':'json'})
|
||||
if ret == -errno.EINVAL:
|
||||
# try old mon
|
||||
ret, outbuf, outs = send_command(cluster_handle,
|
||||
cmd=['mds', 'dump', '--format=json'])
|
||||
if ret:
|
||||
raise RuntimeError('Can\'t contact mon for mds list')
|
||||
d = json.loads(outbuf)
|
||||
|
Loading…
Reference in New Issue
Block a user