Merge pull request #8418 from liewegas/wip-blk-probe

os/ObjectStore: make device uuid probe output something friendly
This commit is contained in:
Sage Weil 2016-04-06 16:57:11 -04:00
commit 297f5f2ce7
3 changed files with 15 additions and 5 deletions

View File

@ -189,7 +189,8 @@ int main(int argc, const char **argv)
} }
if (get_device_fsid) { if (get_device_fsid) {
uuid_d uuid; uuid_d uuid;
int r = ObjectStore::probe_block_device_fsid(device_path, &uuid); int r = ObjectStore::probe_block_device_fsid(g_ceph_context, device_path,
&uuid);
if (r < 0) { if (r < 0) {
cerr << "failed to get device fsid for " << device_path cerr << "failed to get device fsid for " << device_path
<< ": " << cpp_strerror(r) << std::endl; << ": " << cpp_strerror(r) << std::endl;

View File

@ -86,6 +86,7 @@ ObjectStore *ObjectStore::create(CephContext *cct,
} }
int ObjectStore::probe_block_device_fsid( int ObjectStore::probe_block_device_fsid(
CephContext *cct,
const string& path, const string& path,
uuid_d *fsid) uuid_d *fsid)
{ {
@ -95,14 +96,20 @@ int ObjectStore::probe_block_device_fsid(
// first try bluestore -- it has a crc on its header and will fail // first try bluestore -- it has a crc on its header and will fail
// reliably. // reliably.
r = BlueStore::get_block_device_fsid(path, fsid); r = BlueStore::get_block_device_fsid(path, fsid);
if (r == 0) if (r == 0) {
lgeneric_dout(cct, 0) << __func__ << " " << path << " is bluestore, "
<< *fsid << dendl;
return r; return r;
}
#endif #endif
// okay, try FileStore (journal). // okay, try FileStore (journal).
r = FileStore::get_block_device_fsid(path, fsid); r = FileStore::get_block_device_fsid(path, fsid);
if (r == 0) if (r == 0) {
lgeneric_dout(cct, 0) << __func__ << " " << path << " is filestore, "
<< *fsid << dendl;
return r; return r;
}
return -EINVAL; return -EINVAL;
} }

View File

@ -119,8 +119,10 @@ public:
* @param path path to device * @param path path to device
* @param fsid [out] osd uuid * @param fsid [out] osd uuid
*/ */
static int probe_block_device_fsid(const string& path, static int probe_block_device_fsid(
uuid_d *fsid); CephContext *cct,
const string& path,
uuid_d *fsid);
Logger *logger; Logger *logger;