Compare commits

..

1 Commits

Author SHA1 Message Date
Vitaliy Filippov 6eb68adbeb WIP Implement resizing partitions created with vitastor-disk
Test / test_root_node (push) Successful in 8s Details
Test / test_dd (push) Successful in 11s Details
Test / test_rebalance_verify_ec (push) Successful in 1m45s Details
Test / test_rebalance_verify_ec_imm (push) Successful in 1m46s Details
Test / test_write_no_same (push) Successful in 8s Details
Test / test_switch_primary (push) Successful in 33s Details
Test / test_write (push) Successful in 32s Details
Test / test_write_xor (push) Successful in 35s Details
Test / test_heal_pg_size_2 (push) Successful in 2m15s Details
Test / test_heal_ec (push) Successful in 2m14s Details
Test / test_heal_antietcd (push) Successful in 2m16s Details
Test / test_heal_csum_32k_dmj (push) Successful in 2m17s Details
Test / test_heal_csum_32k_dj (push) Successful in 2m16s Details
Test / test_heal_csum_32k (push) Successful in 2m16s Details
Test / test_heal_csum_4k_dmj (push) Successful in 2m17s Details
Test / test_osd_tags (push) Successful in 7s Details
Test / test_snapshot_pool2 (push) Successful in 15s Details
Test / test_heal_csum_4k_dj (push) Successful in 2m26s Details
Test / test_enospc (push) Successful in 10s Details
Test / test_enospc_xor (push) Successful in 13s Details
Test / test_enospc_imm (push) Successful in 12s Details
Test / test_enospc_imm_xor (push) Successful in 12s Details
Test / test_scrub (push) Successful in 14s Details
Test / test_scrub_zero_osd_2 (push) Successful in 12s Details
Test / test_scrub_xor (push) Successful in 14s Details
Test / test_scrub_pg_size_3 (push) Successful in 15s Details
Test / test_scrub_pg_size_6_pg_minsize_4_osd_count_6_ec (push) Successful in 16s Details
Test / test_scrub_ec (push) Successful in 13s Details
Test / test_nfs (push) Successful in 12s Details
Test / test_heal_csum_4k (push) Successful in 2m17s Details
2024-10-12 17:54:00 +03:00
3 changed files with 7 additions and 15 deletions

View File

@ -328,7 +328,7 @@ json11::Json disk_tool_t::add_partitions(vitastor_dev_info_t & devinfo, std::vec
script += "+ "+size+" "+std::string(VITASTOR_PART_TYPE)+"\n"; script += "+ "+size+" "+std::string(VITASTOR_PART_TYPE)+"\n";
} }
std::string out; std::string out;
if (shell_exec({ "sfdisk", "--no-reread", "--no-tell-kernel", "--force", devinfo.path }, script, &out, NULL) != 0) if (shell_exec({ "sfdisk", "--no-reread", "--force", devinfo.path }, script, &out, NULL) != 0)
{ {
fprintf(stderr, "Failed to add %zu partition(s) with sfdisk\n", sizes.size()); fprintf(stderr, "Failed to add %zu partition(s) with sfdisk\n", sizes.size());
return {}; return {};
@ -355,9 +355,8 @@ json11::Json disk_tool_t::add_partitions(vitastor_dev_info_t & devinfo, std::vec
{ {
for (const auto & part: new_parts) for (const auto & part: new_parts)
{ {
std::string link_path = "/dev/disk/by-partuuid/"+strtolower(part["uuid"].string_value());
struct stat st; struct stat st;
if (lstat(link_path.c_str(), &st) < 0) if (stat(part["node"].string_value().c_str(), &st) < 0)
{ {
if (errno == ENOENT) if (errno == ENOENT)
{ {
@ -378,7 +377,7 @@ json11::Json disk_tool_t::add_partitions(vitastor_dev_info_t & devinfo, std::vec
} }
else else
{ {
fprintf(stderr, "Failed to lstat %s: %s\n", link_path.c_str(), strerror(errno)); fprintf(stderr, "Failed to lstat %s: %s\n", part["node"].string_value().c_str(), strerror(errno));
return {}; return {};
} }
} }
@ -387,9 +386,8 @@ json11::Json disk_tool_t::add_partitions(vitastor_dev_info_t & devinfo, std::vec
} }
// Wait until device symlinks in /dev/disk/by-partuuid/ appear // Wait until device symlinks in /dev/disk/by-partuuid/ appear
bool exists = false; bool exists = false;
const int max_iter = 300; // max 30 sec
iter = 0; iter = 0;
while (!exists && iter < max_iter) while (!exists && iter < 300) // max 30 sec
{ {
exists = true; exists = true;
for (const auto & part: new_parts) for (const auto & part: new_parts)
@ -399,13 +397,7 @@ json11::Json disk_tool_t::add_partitions(vitastor_dev_info_t & devinfo, std::vec
if (lstat(link_path.c_str(), &st) < 0) if (lstat(link_path.c_str(), &st) < 0)
{ {
if (errno == ENOENT) if (errno == ENOENT)
{
exists = false; exists = false;
if (iter == 4)
{
fprintf(stderr, "Waiting for %s to appear for up to %d sec...\n", link_path.c_str(), max_iter/10);
}
}
else else
{ {
fprintf(stderr, "Failed to lstat %s: %s\n", link_path.c_str(), strerror(errno)); fprintf(stderr, "Failed to lstat %s: %s\n", link_path.c_str(), strerror(errno));

View File

@ -80,8 +80,8 @@ int disk_tool_t::resize_data(std::string device)
{ {
std::string cmd; std::string cmd;
for (auto & kv: move_options) for (auto & kv: move_options)
cmd += " "+kv.first+" = "+kv.second+"\n"; cmd += " --"+kv.first+" "+kv.second;
fprintf(stderr, "Running resize:\n%s", cmd.c_str()); fprintf(stderr, "Running resize%s\n", cmd.c_str());
} }
if (!dry_run && raw_resize() != 0) if (!dry_run && raw_resize() != 0)
return 1; return 1;

View File

@ -377,7 +377,7 @@ int fix_partition_type(std::string dev_by_uuid)
script += "\n"; script += "\n";
} }
std::string out; std::string out;
return shell_exec({ "sfdisk", "--no-reread", "--no-tell-kernel", "--force", parent_dev }, script, &out, NULL); return shell_exec({ "sfdisk", "--no-reread", "--force", parent_dev }, script, &out, NULL);
} }
std::string csum_type_str(uint32_t data_csum_type) std::string csum_type_str(uint32_t data_csum_type)