From: Peter Sabaini Date: Thu, 7 Apr 2016 22:30:55 +0000 (+0200) Subject: ceph-disk: Accept bcache devices as data disks X-Git-Tag: v10.2.3~118^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=21f0216287485e6cce8811f324fee804ef733524;p=ceph.git ceph-disk: Accept bcache devices as data disks Fixes: http://tracker.ceph.com/issues/13278 Signed-off-by: Peter Sabaini --- diff --git a/src/ceph-disk/ceph_disk/main.py b/src/ceph-disk/ceph_disk/main.py index d0ec596c2aa..7e29eaf416c 100755 --- a/src/ceph-disk/ceph_disk/main.py +++ b/src/ceph-disk/ceph_disk/main.py @@ -713,6 +713,20 @@ def get_partition_base_mpath(dev): return os.path.join('/dev/mapper', name) +def is_bcache(dev_name): + """ + Check if dev_name is a bcache + """ + if not dev_name.startswith('bcache'): + return False + if not os.path.exists(os.path.join('/sys/block', dev_name, 'bcache')): + return False + if os.path.exists(os.path.join('/sys/block', dev_name, + 'bcache/cache_mode')): + return True + return False + + def is_partition(dev): """ Check whether a given device path is a partition or a full disk. @@ -726,6 +740,8 @@ def is_partition(dev): raise Error('not a block device', dev) name = get_dev_name(dev) + if is_bcache(name): + return True if os.path.exists(os.path.join('/sys/block', name)): return False