ceph / ceph-medic

find common issues in ceph clusters
MIT License
22 stars 18 forks source link

cluster name might get overridden #74

Open alfredodeza opened 7 years ago

alfredodeza commented 7 years ago

Currently, 'cluster name' is set when connecting to each host. If one host has 'test' the cluster name gets set to 'test', but if a subsequent node has something else, this will get changed.

This 'cluster' name should go under the node metadata, in the 'ceph' section: data['ceph']['cluster']. The current logic exists in the connection.py module:

    if not ceph_medic.config['cluster_name']:
        cluster_conf_files, stderr, exit_code = remoto.process.check(conn, ['ls', '/etc/ceph/'])
        cluster_name = 'ceph'
        if 'ceph.conf' not in cluster_conf_files:
            logger.warning('/etc/ceph/ceph.conf was not found, will try to infer the cluster name')
            for i in cluster_conf_files:
                if i.endswith('conf'):
                    cluster_name = i.split('.conf')[0]
                    logger.warning('inferred %s as the cluster name', cluster_name)
        ceph_medic.metadata['cluster_name'] = cluster_name
    else:
        ceph_medic.metadata['cluster_name'] = ceph_medic.config['cluster_name']