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: v10.2.8~87^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2271cd81282f3f026316134cbab630f3e4f47782;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 (cherry picked from commit 7943ab2e01e24f2dfc5b6f1d3ffdc8a49e01af45) --- diff --git a/src/ceph-disk/ceph_disk/main.py b/src/ceph-disk/ceph_disk/main.py index ffe0311ceb798..056b0bbea828b 100755 --- a/src/ceph-disk/ceph_disk/main.py +++ b/src/ceph-disk/ceph_disk/main.py @@ -1504,6 +1504,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): @@ -2535,22 +2555,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()) @@ -3058,24 +3064,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) @@ -4160,9 +4149,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,