Rename the new "set" command to "modify"

nbd-vmsplice
Vitaliy Filippov 2021-11-13 21:24:11 +03:00
parent 697ee30a26
commit 110b39900b
4 changed files with 9 additions and 4 deletions

View File

@ -153,7 +153,7 @@ target_link_libraries(vitastor-nbd
# vitastor-cli # vitastor-cli
add_executable(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 target_link_libraries(vitastor-cli
vitastor_client vitastor_client

View File

@ -103,7 +103,7 @@ void cli_tool_t::help()
"%s snap-create [-p|--pool <id|name>] <image>@<snapshot>\n" "%s snap-create [-p|--pool <id|name>] <image>@<snapshot>\n"
" Create a snapshot of image <name>. May be used live if only a single writer is active.\n" " Create a snapshot of image <name>. May be used live if only a single writer is active.\n"
"\n" "\n"
"%s set <name> [-s|--size <size>] [--readonly | --readwrite] [-f|--force]\n" "%s modify <name> [-s|--size <size>] [--readonly | --readwrite] [-f|--force]\n"
" Resize image or change its readonly status. Images with children can't be made read-write.\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" " 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" " 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 // Create image/snapshot
action_cb = start_create(cfg); action_cb = start_create(cfg);
} }
else if (cmd[0] == "modify")
{
// Modify image
action_cb = start_modify(cfg);
}
else if (cmd[0] == "rm-data") else if (cmd[0] == "rm-data")
{ {
// Delete inode data // Delete inode data

View File

@ -52,7 +52,7 @@ public:
std::function<bool(void)> start_ls(json11::Json cfg); std::function<bool(void)> start_ls(json11::Json cfg);
std::function<bool(void)> start_create(json11::Json cfg); std::function<bool(void)> start_create(json11::Json cfg);
std::function<bool(void)> start_set(json11::Json cfg); std::function<bool(void)> start_modify(json11::Json cfg);
std::function<bool(void)> start_rm(json11::Json); std::function<bool(void)> start_rm(json11::Json);
std::function<bool(void)> start_merge(json11::Json); std::function<bool(void)> start_merge(json11::Json);
std::function<bool(void)> start_flatten(json11::Json); std::function<bool(void)> start_flatten(json11::Json);

View File

@ -145,7 +145,7 @@ resume_2:
} }
}; };
std::function<bool(void)> cli_tool_t::start_set(json11::Json cfg) std::function<bool(void)> cli_tool_t::start_modify(json11::Json cfg)
{ {
json11::Json::array cmd = cfg["command"].array_items(); json11::Json::array cmd = cfg["command"].array_items();
auto changer = new image_changer_t(); auto changer = new image_changer_t();