ceph-disk: dmcrypt file permissions

The directory in which key files are stored for dmcrypt must be 700 and
the file 600.

http://tracker.ceph.com/issues/9785 Fixes: #9785

Signed-off-by: Loic Dachary <ldachary@redhat.com>
Merge pull request #3087 from dachary/wip-9785-dmcrypt-keys-permissions

ceph-disk: dmcrypt file permissions

Reviewed-by: Sage Weil <sage@redhat.com>
check endpoints is not empty before use it.

Signed-off-by: VRan Liu <gliuwr@gmail.com>
(cherry picked from commit 9d5e4edc15678de675d7a77badcbace0b710d553)
common/blkdev: get_block_device_base

And a test.  Ideally the test would get run on a machine with weirdo
devices like /dev/cciss/c0d1.

This mirrors the logic in ceph-disk, which has been tested.

Signed-off-by: Sage Weil <sage@redhat.com>
common/blkdev: fix block device discard check

- fix base name calculation (do not assume sda)
- reverse sense of check (it was returning false when true before?)
- add a generic helper to get other properties, too

Fixes: #10296
Signed-off-by: Sage Weil <sage@redhat.com>
common/blkdev: add simple sandboxing function for testing

Signed-off-by: Sage Weil <sage@redhat.com>
unittest_blkdev: test an abbreviated /sys/block dir

Note that we assume unittest_blkdev is run from the current directory (or
rather that test/common/test_blkdev_sys_block exists).

Signed-off-by: Sage Weil <sage@redhat.com>
Merge pull request #3153 from ceph/wip-10296

osd: fix block device discard detection

Reviewed-by: Loic Dachary <loic@dachary.org>
Tested-by: Jianpeng Ma <jianpeng.ma@intel.com>
Merge remote-tracking branch 'gh/next'