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

Function execute_diff

src/tools/rbd/action/Import.cc:481–526  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

479}
480
481int execute_diff(const po::variables_map &vm,
482 const std::vector<std::string> &ceph_global_init_args) {
483 std::string path;
484 size_t arg_index = 0;
485 int r = utils::get_path(vm, &arg_index, &path);
486 if (r < 0) {
487 return r;
488 }
489
490 std::string pool_name;
491 std::string namespace_name;
492 std::string image_name;
493 std::string snap_name;
494 r = utils::get_pool_image_snapshot_names(
495 vm, at::ARGUMENT_MODIFIER_NONE, &arg_index, &pool_name, &namespace_name,
496 &image_name, &snap_name, true, utils::SNAPSHOT_PRESENCE_NONE,
497 utils::SPEC_VALIDATION_NONE);
498 if (r < 0) {
499 return r;
500 }
501
502 size_t sparse_size = utils::RBD_DEFAULT_SPARSE_SIZE;
503 if (vm.count(at::IMAGE_SPARSE_SIZE)) {
504 sparse_size = vm[at::IMAGE_SPARSE_SIZE].as<size_t>();
505 }
506
507 librados::Rados rados;
508 librados::IoCtx io_ctx;
509 librbd::Image image;
510 r = utils::init_and_open_image(pool_name, namespace_name, image_name, "", "",
511 false, &rados, &io_ctx, &image);
512 if (r < 0) {
513 return r;
514 }
515
516 r = do_import_diff(rados, image, path.c_str(),
517 vm[at::NO_PROGRESS].as<bool>(), sparse_size);
518 if (r == -EDOM) {
519 r = -EBADMSG;
520 }
521 if (r < 0) {
522 cerr << "rbd: import-diff failed: " << cpp_strerror(r) << std::endl;
523 return r;
524 }
525 return 0;
526}
527
528Shell::Action action_diff(
529 {"import-diff"}, {},

Callers

nothing calls this directly

Calls 7

init_and_open_imageFunction · 0.85
do_import_diffFunction · 0.85
cpp_strerrorFunction · 0.85
get_pathFunction · 0.50
countMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected