Skip to content

Commit

Permalink
Merge pull request ceph#684 from git-harry/ceph_disk_lowercase_fsid
Browse files Browse the repository at this point in the history
Make fsid comparison case-insensitive

Reviewed-by: Sage Weil <[email protected]>
  • Loading branch information
Sage Weil committed Oct 3, 2013
2 parents c19935c + 22f8325 commit 86e9657
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/ceph-disk
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -1601,18 +1601,23 @@ 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
for conf_file in os.listdir('/etc/ceph'):
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')
Expand Down

0 comments on commit 86e9657

Please sign in to comment.