From c3d8fdd855c7d87d50782be0bb4b505b0417eb3d Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Wed, 26 Feb 2025 10:44:38 +0300 Subject: [PATCH] Fix snap-create without pool_id ID generation with multiple pools --- src/cmd/cli_create.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/cmd/cli_create.cpp b/src/cmd/cli_create.cpp index 2e17eacb..86224870 100644 --- a/src/cmd/cli_create.cpp +++ b/src/cmd/cli_create.cpp @@ -215,6 +215,7 @@ resume_3: goto resume_3; else if (state == 4) goto resume_4; + // FIXME: take all info from etcd requests, not mixed with st_cli.inode_config for (auto & ic: parent->cli->st_cli.inode_config) { if (ic.second.name == image_name+"@"+new_snap) @@ -286,6 +287,7 @@ resume_4: json11::Json::object get_next_id() { + assert(new_pool_id); return json11::Json::object { { "request_range", json11::Json::object { { "key", base64_encode( @@ -321,6 +323,17 @@ resume_4: goto resume_2; else if (state == 3) goto resume_3; + if (!new_pool_id) + { + for (auto & ic: parent->cli->st_cli.inode_config) + { + if (ic.second.name == image_name) + { + new_pool_id = INODE_POOL(ic.first); + break; + } + } + } parent->etcd_txn(json11::Json::object { { "success", json11::Json::array { get_next_id(), json11::Json::object {