From: Brad Hubbard Date: Mon, 3 Apr 2017 03:37:17 +0000 (+1000) Subject: ceph-disk: Populate mount options when running "list" X-Git-Tag: v12.0.2~175^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7943ab2e01e24f2dfc5b6f1d3ffdc8a49e01af45;p=ceph.git ceph-disk: Populate mount options when running "list" Also tidy up by moving duplicated code into a function Fixes: http://tracker.ceph.com/issues/17331 Signed-off-by: Brad Hubbard --- diff --git a/src/ceph-disk/ceph_disk/main.py b/src/ceph-disk/ceph_disk/main.py index 96676997f0c1..03305d51085e 100755 --- a/src/ceph-disk/ceph_disk/main.py +++ b/src/ceph-disk/ceph_disk/main.py @@ -1582,6 +1582,26 @@ def adjust_symlink(target, path): raise Error('unable to create symlink %s -> %s' % (path, target)) +def get_mount_options(cluster, fs_type): + mount_options = get_conf( + cluster, + variable='osd_mount_options_{fstype}'.format( + fstype=fs_type, + ), + ) + if mount_options is None: + mount_options = get_conf( + cluster, + variable='osd_fs_mount_options_{fstype}'.format( + fstype=fs_type, + ), + ) + else: + # remove whitespaces + mount_options = "".join(mount_options.split()) + return mount_options + + class Device(object): def __init__(self, path, args): @@ -2754,22 +2774,8 @@ class PrepareData(object): ), ) - self.mount_options = get_conf( - cluster=self.args.cluster, - variable='osd_mount_options_{fstype}'.format( - fstype=self.args.fs_type, - ), - ) - if self.mount_options is None: - self.mount_options = get_conf( - cluster=self.args.cluster, - variable='osd_fs_mount_options_{fstype}'.format( - fstype=self.args.fs_type, - ), - ) - else: - # remove whitespaces - self.mount_options = "".join(self.mount_options.split()) + self.mount_options = get_mount_options(cluster=self.args.cluster, + fs_type=self.args.fs_type) if self.args.osd_uuid is None: self.args.osd_uuid = str(uuid.uuid4()) @@ -3314,24 +3320,7 @@ def mount_activate( # TODO always using mount options from cluster=ceph for # now; see http://tracker.newdream.net/issues/3253 - mount_options = get_conf( - cluster='ceph', - variable='osd_mount_options_{fstype}'.format( - fstype=fstype, - ), - ) - - if mount_options is None: - mount_options = get_conf( - cluster='ceph', - variable='osd_fs_mount_options_{fstype}'.format( - fstype=fstype, - ), - ) - - # remove whitespaces from mount_options - if mount_options is not None: - mount_options = "".join(mount_options.split()) + mount_options = get_mount_options(cluster='ceph', fs_type=fstype) path = mount(dev=dev, fstype=fstype, options=mount_options) @@ -4418,9 +4407,11 @@ def list_devices(): fs_type = get_dev_fs(dev_to_mount) if fs_type is not None: + mount_options = get_mount_options(cluster='ceph', + fs_type=fs_type) try: tpath = mount(dev=dev_to_mount, - fstype=fs_type, options='') + fstype=fs_type, options=mount_options) try: for name in Space.NAMES: space_uuid = get_oneliner(tpath,