MCPcopy Create free account
hub / github.com/ceph/ceph / execute_diff

Function execute_diff

src/tools/rbd/action/Export.cc:267–312  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

265}
266
267int execute_diff(const po::variables_map &vm,
268 const std::vector<std::string> &ceph_global_init_args) {
269 size_t arg_index = 0;
270 std::string pool_name;
271 std::string namespace_name;
272 std::string image_name;
273 std::string snap_name;
274 int r = utils::get_pool_image_snapshot_names(
275 vm, at::ARGUMENT_MODIFIER_SOURCE, &arg_index, &pool_name, &namespace_name,
276 &image_name, &snap_name, true, utils::SNAPSHOT_PRESENCE_PERMITTED,
277 utils::SPEC_VALIDATION_NONE);
278 if (r < 0) {
279 return r;
280 }
281
282 std::string path;
283 r = utils::get_path(vm, &arg_index, &path);
284 if (r < 0) {
285 return r;
286 }
287
288 std::string from_snap_name;
289 if (vm.count(at::FROM_SNAPSHOT_NAME)) {
290 from_snap_name = vm[at::FROM_SNAPSHOT_NAME].as<std::string>();
291 }
292
293 librados::Rados rados;
294 librados::IoCtx io_ctx;
295 librbd::Image image;
296 r = utils::init_and_open_image(pool_name, namespace_name, image_name, "",
297 snap_name, true, &rados, &io_ctx, &image);
298 if (r < 0) {
299 return r;
300 }
301
302 r = do_export_diff(image,
303 from_snap_name.empty() ? nullptr : from_snap_name.c_str(),
304 snap_name.empty() ? nullptr : snap_name.c_str(),
305 vm[at::WHOLE_OBJECT].as<bool>(), path.c_str(),
306 vm[at::NO_PROGRESS].as<bool>());
307 if (r < 0) {
308 std::cerr << "rbd: export-diff error: " << cpp_strerror(r) << std::endl;
309 return r;
310 }
311 return 0;
312}
313
314Shell::Action action_diff(
315 {"export-diff"}, {}, "Export incremental diff to file.", "",

Callers

nothing calls this directly

Calls 8

init_and_open_imageFunction · 0.85
do_export_diffFunction · 0.85
cpp_strerrorFunction · 0.85
get_pathFunction · 0.50
countMethod · 0.45
emptyMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected