ceph-disk: make is_held() smarter about full disks

Handle the case where the device is a full disk.  Make the partition
check a bit more robust (don't make assumptions about naming aside from
the device being a prefix of the partition).

Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit e082f1247fb6ddfb36c4223cbfdf500d6b45c978)
ceph-disk: handle /dev/foo/bar devices throughout

Assume the last component is the unique device name, even if it appears
under a subdir of /dev.

Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit cb97338b1186939deecb78e9d949c38c3ef59026)
ceph-disk: add get_dev_name, path helpers

Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit e0401591e352ea9653e3276d66aebeb41801eeb3)
ceph-disk: refactor list_[all_]partitions

Make these methods work in terms of device *names*, not paths, and fix up
the only direct list_partitions() caller to do the same.

Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit 35d3f2d84808efda3d2ac868afe03e6959d51c03)
ceph-disk: use get_dev_name() helper throughout

This is more robust than the broken split trick.

Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit 3359aaedde838c98d1155611e157fd2da9e8b9f5)
ceph-disk: reimplement is_partition() using /sys/block

Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit 5b031e100b40f597752b4917cdbeebb366eb98d7)
ceph-disk: use /sys/block to determine partition device names

Not all devices are basename + number; some have intervening character(s),
like /dev/cciss/c0d1p2.

Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit 2ea8fac441141d64ee0d26c5dd2b441f9782d840)
ceph-disk: use new get_dev_path helper for list

Backport: cuttlefish
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Dan Mick <dan.mick@inktank.com>
Tested-by: Olivier Bonvalet <ob.ceph@daevel.fr>
(cherry picked from commit fd1fd664d6102a2a96b27e8ca9933b54ac626ecb)