Skip to content

Commit

Permalink
os/ceph-bluestore-tool: unify output for bluefs-bdev-expand command.
Browse files Browse the repository at this point in the history
This commit is specific for pre-Nautilius releases (mimic & luminous)
as we don't backport main device expansion feature. Which
makes this mimic/luminous commit completely different from nautilus one.

Signed-off-by: Igor Fedotov <ifedotov@suse.com>
(cherry picked from commit c098f5f)
  • Loading branch information
ifed01 committed Dec 20, 2018
1 parent 2912a7a commit 1c1784e
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/os/bluestore/bluestore_tool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -477,15 +477,15 @@ int main(int argc, char **argv)
}
else if (action == "bluefs-bdev-expand") {
BlueFS *fs = open_bluefs(cct.get(), path, devs);
cout << "start:" << std::endl;
fs->dump_block_extents(cout);
cout << "Expanding..." << std::endl;
for (int devid : { BlueFS::BDEV_WAL, BlueFS::BDEV_DB }) {
if (!fs->is_device(devid)) {
continue;
}
if (!fs->is_device_expandable(devid)) {
cout << devid
<< " : can't be expanded."
<< " : can't be expanded. Bypassing..."
<< std::endl;
continue;
}
Expand All @@ -495,12 +495,14 @@ int main(int argc, char **argv)
uint64_t end = before.range_end();
uint64_t size = fs->get_block_device_size(devid);
if (end < size) {
cout << "expanding dev " << devid << " from 0x" << std::hex
cout << devid
<<" : expanding " << " from 0x" << std::hex
<< end << " to 0x" << size << std::dec << std::endl;
fs->add_block_extent(devid, end, size-end);
const char* path = find_device_path(devid, cct.get(), devs);
if (path == nullptr) {
cerr << "Can't find device path for dev " << devid << std::endl;
cerr << devid
<<": can't find device path " << std::endl;
continue;
}
bluestore_bdev_label_t label;
Expand All @@ -517,8 +519,9 @@ int main(int argc, char **argv)
<< cpp_strerror(r) << std::endl;
continue;
}
cout << "dev " << devid << " size label updated to "
<< size << std::endl;
cout << devid
<<" : size label updated to " << size
<< std::endl;
}
}
delete fs;
Expand Down

0 comments on commit 1c1784e

Please sign in to comment.