diff options
author | git-harry <git-harry@live.co.uk> | 2013-10-03 10:32:50 +0100 |
---|---|---|
committer | git-harry <git-harry@live.co.uk> | 2013-10-03 10:32:50 +0100 |
commit | 22f8325dbfce7ef2e97bf015c0f8bba53e75dfe9 (patch) | |
tree | 81d2cd737a9a051d5d3de147d4e797bf6e15b1fa | |
parent | d3ba8da597384516c85a9af928971a585843aeb4 (diff) | |
download | ceph-22f8325dbfce7ef2e97bf015c0f8bba53e75dfe9.tar.gz |
Make fsid comparison case-insensitive
get_fsid and find_cluster_by_uuid are modified so ceph-disk activate and
ceph-disk activate-all will work if the fsid uses uppercase characters.
Signed-off-by: Harry Harrington <git-harry@live.co.uk>
-rwxr-xr-x | src/ceph-disk | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/ceph-disk b/src/ceph-disk index 939f65b85dd..64d944d9db0 100755 --- a/src/ceph-disk +++ b/src/ceph-disk @@ -570,7 +570,7 @@ def get_fsid(cluster): fsid = get_conf(cluster=cluster, variable='fsid') if fsid is None: raise Error('getting cluster uuid from configuration failed') - return fsid + return fsid.lower() def get_or_create_dmcrypt_key( @@ -1601,6 +1601,7 @@ def find_cluster_by_uuid(_uuid): Find a cluster name by searching /etc/ceph/*.conf for a conf file with the right uuid. """ + _uuid = _uuid.lower() no_fsid = [] if not os.path.exists('/etc/ceph'): return None @@ -1608,11 +1609,15 @@ def find_cluster_by_uuid(_uuid): if not conf_file.endswith('.conf'): continue cluster = conf_file[:-5] - fsid = get_conf(cluster, 'fsid') - if fsid is None: + try: + fsid = get_fsid(cluster) + except Error as e: + if e.message != 'getting cluster uuid from configuration failed': + raise e no_fsid.append(cluster) - elif fsid == _uuid: - return cluster + else: + if fsid == _uuid: + return cluster # be tolerant of /etc/ceph/ceph.conf without an fsid defined. if len(no_fsid) == 1 and no_fsid[0] == 'ceph': LOG.warning('No fsid defined in /etc/ceph/ceph.conf; using anyway') |