diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a555c914..21113dd3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -153,7 +153,7 @@ target_link_libraries(vitastor-nbd # vitastor-cli add_executable(vitastor-cli - cli.cpp cli_ls.cpp cli_create.cpp cli_set.cpp cli_flatten.cpp cli_merge.cpp cli_rm.cpp cli_snap_rm.cpp + cli.cpp cli_ls.cpp cli_create.cpp cli_modify.cpp cli_flatten.cpp cli_merge.cpp cli_rm.cpp cli_snap_rm.cpp ) target_link_libraries(vitastor-cli vitastor_client diff --git a/src/cli.cpp b/src/cli.cpp index 79c37d86..7374f507 100644 --- a/src/cli.cpp +++ b/src/cli.cpp @@ -103,7 +103,7 @@ void cli_tool_t::help() "%s snap-create [-p|--pool ] @\n" " Create a snapshot of image . May be used live if only a single writer is active.\n" "\n" - "%s set [-s|--size ] [--readonly | --readwrite] [-f|--force]\n" + "%s modify [-s|--size ] [--readonly | --readwrite] [-f|--force]\n" " Resize image or change its readonly status. Images with children can't be made read-write.\n" " If the new size is smaller than the old size, extra data will be purged.\n" " You should resize file system in the image, if present, before shrinking it.\n" @@ -243,6 +243,11 @@ void cli_tool_t::run(json11::Json cfg) // Create image/snapshot action_cb = start_create(cfg); } + else if (cmd[0] == "modify") + { + // Modify image + action_cb = start_modify(cfg); + } else if (cmd[0] == "rm-data") { // Delete inode data diff --git a/src/cli.h b/src/cli.h index bb027622..426069ec 100644 --- a/src/cli.h +++ b/src/cli.h @@ -52,7 +52,7 @@ public: std::function start_ls(json11::Json cfg); std::function start_create(json11::Json cfg); - std::function start_set(json11::Json cfg); + std::function start_modify(json11::Json cfg); std::function start_rm(json11::Json); std::function start_merge(json11::Json); std::function start_flatten(json11::Json); diff --git a/src/cli_set.cpp b/src/cli_modify.cpp similarity index 98% rename from src/cli_set.cpp rename to src/cli_modify.cpp index 4a53d50a..8a5f72b5 100644 --- a/src/cli_set.cpp +++ b/src/cli_modify.cpp @@ -145,7 +145,7 @@ resume_2: } }; -std::function cli_tool_t::start_set(json11::Json cfg) +std::function cli_tool_t::start_modify(json11::Json cfg) { json11::Json::array cmd = cfg["command"].array_items(); auto changer = new image_changer_t();