Project

General

Profile

Bug #43193

"ceph ping mon.<id>" cannot work

Added by Min Shi about 4 years ago. Updated 5 months ago.

Status:
Rejected
Priority:
Normal
Assignee:
Category:
-
Target version:
-
% Done:

100%

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

Description

The command "ceph ping mon.<id>" returns an error output:

$ sudo ceph ping mon.c3325
[errno 2] error calling ping_monitor

The command ”ceph ping mon.*" returns correct output.
This is caused by lacking connect to ceph cluster.
In ping_monitor function(src/ceph.in), for the command "ceph ping mon.*", it first connect to the ceph cluster and then execute this command.
But for the command with a mon id specified, it lacks connect operation.
def ping_monitor(cluster_handle, name, timeout):
    if 'mon.' not in name:
        print('"ping" expects a monitor to ping; try "ping mon.<id>"', file=sys.stderr)
        return 1

    mon_id = name[len('mon.'):]
    if mon_id == '*':
        run_in_thread(cluster_handle.connect, timeout=timeout)
        for m in monids():
            s = run_in_thread(cluster_handle.ping_monitor, m)
            if s is None:
                print("mon.{0}".format(m) + '\n' + "Error connecting to monitor.")
            else:
                print("mon.{0}".format(m) + '\n' + s)
    else:
            s = run_in_thread(cluster_handle.ping_monitor, mon_id)
            print(s)
    return 0


Related issues

Related to RADOS - Bug #44420: cephadm cluster: "ceph ping mon.*" works fine, but "ceph ping mon.<id>" is broken Fix Under Review

History

#1 Updated by Min Shi about 4 years ago

The command "ceph ping mon.a" or "ceph ping mon.b" or "ceph ping mon.c" works fine.
If the mon id is not specified, the MonClient just get monmap from config file, and it just get the addr. For mon id, it generate noname-a, noname-b, noname-c for these 3 monitor.
Actually, we use short hostname as the mon id. In MonClient::ping_monitor, id specified as a hostname is not in monmap.

#2 Updated by Neha Ojha about 4 years ago

  • Status changed from New to Need More Info

Can you provide the sequence of commands that fail? Also, please attach the monitor names and monmap.

#3 Updated by Nathan Cutler over 3 years ago

  • Status changed from Need More Info to Fix Under Review
  • Pull request ID set to 37716

I can confirm this. There is a detailed explanation at https://github.com/ceph/ceph/pull/37716 but the briefest summary is that, instead of mon.ID, the "ceph ping" command takes "mon.a", "mon.b", "mon.c", etc., where "a", "b", "c", etc. refer to the MONs in the order they are listed in ceph.conf.

And since teuthology tests rely on this behavior (?) and there is no good way to make "ceph ping mon.ID" (where ID is the mon's real ID) work (since it would require that the command first connect to a MON in order to find the IP address of the MON with the given ID), the current behavior is not going to be changed.

#4 Updated by Nathan Cutler over 3 years ago

  • Related to Bug #44420: cephadm cluster: "ceph ping mon.*" works fine, but "ceph ping mon.<id>" is broken added

#5 Updated by Konstantin Shalygin 5 months ago

  • Status changed from Fix Under Review to Rejected
  • Assignee set to Mykola Golub
  • % Done changed from 0 to 100

Also available in: Atom PDF