Add vitastor-disk update-sb command
Test / buildenv (push) Successful in 10s
Details
Test / build (push) Successful in 3m6s
Details
Test / test_cas (push) Successful in 8s
Details
Test / make_test (push) Successful in 34s
Details
Test / test_change_pg_size (push) Successful in 7s
Details
Test / test_create_nomaxid (push) Successful in 9s
Details
Test / test_change_pg_count_ec (push) Successful in 40s
Details
Test / test_change_pg_count (push) Successful in 45s
Details
Test / test_interrupted_rebalance_imm (push) Successful in 1m22s
Details
Test / test_etcd_fail (push) Successful in 1m29s
Details
Test / test_add_osd (push) Successful in 3m7s
Details
Test / test_failure_domain (push) Successful in 18s
Details
Test / test_interrupted_rebalance (push) Successful in 2m44s
Details
Test / test_interrupted_rebalance_ec_imm (push) Successful in 1m25s
Details
Test / test_snapshot (push) Successful in 25s
Details
Test / test_minsize_1 (push) Successful in 17s
Details
Test / test_snapshot_ec (push) Successful in 31s
Details
Test / test_interrupted_rebalance_ec (push) Successful in 1m55s
Details
Test / test_rm (push) Successful in 16s
Details
Test / test_snapshot_down (push) Successful in 23s
Details
Test / test_snapshot_down_ec (push) Successful in 22s
Details
Test / test_splitbrain (push) Successful in 20s
Details
Test / test_snapshot_chain (push) Successful in 2m8s
Details
Test / test_snapshot_chain_ec (push) Successful in 2m52s
Details
Test / test_rebalance_verify_imm (push) Successful in 2m56s
Details
Test / test_write (push) Successful in 36s
Details
Test / test_rebalance_verify (push) Successful in 3m38s
Details
Test / test_write_no_same (push) Successful in 13s
Details
Test / test_rebalance_verify_ec (push) Successful in 4m0s
Details
Test / test_rebalance_verify_ec_imm (push) Successful in 3m14s
Details
Test / test_heal_pg_size_2 (push) Successful in 3m22s
Details
Test / test_heal_csum_32k_dmj (push) Successful in 5m9s
Details
Test / test_heal_ec (push) Successful in 6m49s
Details
Test / test_heal_csum_32k_dj (push) Successful in 6m14s
Details
Test / test_heal_csum_32k (push) Successful in 6m12s
Details
Test / test_scrub (push) Successful in 1m21s
Details
Test / test_scrub_zero_osd_2 (push) Successful in 1m11s
Details
Test / test_heal_csum_4k_dmj (push) Successful in 6m21s
Details
Test / test_scrub_xor (push) Successful in 1m13s
Details
Test / test_heal_csum_4k_dj (push) Successful in 6m9s
Details
Test / test_scrub_pg_size_6_pg_minsize_4_osd_count_6_ec (push) Successful in 1m3s
Details
Test / test_scrub_pg_size_3 (push) Successful in 1m48s
Details
Test / test_scrub_ec (push) Successful in 52s
Details
Test / test_heal_csum_4k (push) Successful in 6m2s
Details
Test / test_move_reappear (push) Successful in 18s
Details
Test / test_write_xor (push) Failing after 3m5s
Details
Test / buildenv (push) Successful in 10s
Details
Test / build (push) Successful in 3m6s
Details
Test / test_cas (push) Successful in 8s
Details
Test / make_test (push) Successful in 34s
Details
Test / test_change_pg_size (push) Successful in 7s
Details
Test / test_create_nomaxid (push) Successful in 9s
Details
Test / test_change_pg_count_ec (push) Successful in 40s
Details
Test / test_change_pg_count (push) Successful in 45s
Details
Test / test_interrupted_rebalance_imm (push) Successful in 1m22s
Details
Test / test_etcd_fail (push) Successful in 1m29s
Details
Test / test_add_osd (push) Successful in 3m7s
Details
Test / test_failure_domain (push) Successful in 18s
Details
Test / test_interrupted_rebalance (push) Successful in 2m44s
Details
Test / test_interrupted_rebalance_ec_imm (push) Successful in 1m25s
Details
Test / test_snapshot (push) Successful in 25s
Details
Test / test_minsize_1 (push) Successful in 17s
Details
Test / test_snapshot_ec (push) Successful in 31s
Details
Test / test_interrupted_rebalance_ec (push) Successful in 1m55s
Details
Test / test_rm (push) Successful in 16s
Details
Test / test_snapshot_down (push) Successful in 23s
Details
Test / test_snapshot_down_ec (push) Successful in 22s
Details
Test / test_splitbrain (push) Successful in 20s
Details
Test / test_snapshot_chain (push) Successful in 2m8s
Details
Test / test_snapshot_chain_ec (push) Successful in 2m52s
Details
Test / test_rebalance_verify_imm (push) Successful in 2m56s
Details
Test / test_write (push) Successful in 36s
Details
Test / test_rebalance_verify (push) Successful in 3m38s
Details
Test / test_write_no_same (push) Successful in 13s
Details
Test / test_rebalance_verify_ec (push) Successful in 4m0s
Details
Test / test_rebalance_verify_ec_imm (push) Successful in 3m14s
Details
Test / test_heal_pg_size_2 (push) Successful in 3m22s
Details
Test / test_heal_csum_32k_dmj (push) Successful in 5m9s
Details
Test / test_heal_ec (push) Successful in 6m49s
Details
Test / test_heal_csum_32k_dj (push) Successful in 6m14s
Details
Test / test_heal_csum_32k (push) Successful in 6m12s
Details
Test / test_scrub (push) Successful in 1m21s
Details
Test / test_scrub_zero_osd_2 (push) Successful in 1m11s
Details
Test / test_heal_csum_4k_dmj (push) Successful in 6m21s
Details
Test / test_scrub_xor (push) Successful in 1m13s
Details
Test / test_heal_csum_4k_dj (push) Successful in 6m9s
Details
Test / test_scrub_pg_size_6_pg_minsize_4_osd_count_6_ec (push) Successful in 1m3s
Details
Test / test_scrub_pg_size_3 (push) Successful in 1m48s
Details
Test / test_scrub_ec (push) Successful in 52s
Details
Test / test_heal_csum_4k (push) Successful in 6m2s
Details
Test / test_move_reappear (push) Successful in 18s
Details
Test / test_write_xor (push) Failing after 3m5s
Details
parent
4dd6e89263
commit
aca2bef15f
|
@ -17,6 +17,7 @@ It supports the following commands:
|
|||
- [purge](#purge)
|
||||
- [read-sb](#read-sb)
|
||||
- [write-sb](#write-sb)
|
||||
- [update-sb](#update-sb)
|
||||
- [udev](#udev)
|
||||
- [exec-osd](#exec-osd)
|
||||
- [pre-exec](#pre-exec)
|
||||
|
@ -182,6 +183,14 @@ Try to read Vitastor OSD superblock from `<device>` and print it in JSON format.
|
|||
|
||||
Read JSON from STDIN and write it into Vitastor OSD superblock on `<device>`.
|
||||
|
||||
## update-sb
|
||||
|
||||
`vitastor-disk update-sb <device> [--force] [--<parameter> <value>] [...]`
|
||||
|
||||
Read Vitastor OSD superblock from <device>, update parameters in it and write it back.
|
||||
|
||||
`--force` allows to ignore validation errors.
|
||||
|
||||
## udev
|
||||
|
||||
`vitastor-disk udev <device>`
|
||||
|
|
|
@ -17,6 +17,7 @@ vitastor-disk - инструмент командной строки для уп
|
|||
- [purge](#purge)
|
||||
- [read-sb](#read-sb)
|
||||
- [write-sb](#write-sb)
|
||||
- [update-sb](#update-sb)
|
||||
- [udev](#udev)
|
||||
- [exec-osd](#exec-osd)
|
||||
- [pre-exec](#pre-exec)
|
||||
|
@ -187,6 +188,15 @@ throttle_target_mbs, throttle_target_parallelism, throttle_threshold_us.
|
|||
|
||||
Прочитать JSON со стандартного ввода и записать его в суперблок OSD на диск `<device>`.
|
||||
|
||||
## update-sb
|
||||
|
||||
`vitastor-disk update-sb <device> [--force] [--<параметр> <значение>] [...]`
|
||||
|
||||
Прочитать суперблок OSD с диска `<device>`, изменить в нём заданные параметры и записать обратно.
|
||||
|
||||
Опция `--force` позволяет читать суперблок, даже если он считается некорректным
|
||||
из-за ошибок валидации.
|
||||
|
||||
## udev
|
||||
|
||||
`vitastor-disk udev <device>`
|
||||
|
|
|
@ -127,6 +127,10 @@ static const char *help_text =
|
|||
"vitastor-disk write-sb <device>\n"
|
||||
" Read JSON from STDIN and write it into Vitastor OSD superblock on <device>.\n"
|
||||
"\n"
|
||||
"vitastor-disk update-sb <device> [--force] [--<parameter> <value>] [...]\n"
|
||||
" Read Vitastor OSD superblock from <device>, update parameters in it and write it back.\n"
|
||||
" --force allows to ignore validation errors.\n"
|
||||
"\n"
|
||||
"vitastor-disk udev <device>\n"
|
||||
" Try to read Vitastor OSD superblock from <device> and print variables for udev.\n"
|
||||
"\n"
|
||||
|
@ -363,6 +367,15 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
return self.write_sb(cmd[1]);
|
||||
}
|
||||
else if (!strcmp(cmd[0], "update-sb"))
|
||||
{
|
||||
if (cmd.size() != 2)
|
||||
{
|
||||
fprintf(stderr, "Exactly 1 device path argument is required\n");
|
||||
return 1;
|
||||
}
|
||||
return self.update_sb(cmd[1]);
|
||||
}
|
||||
else if (!strcmp(cmd[0], "start") || !strcmp(cmd[0], "stop") ||
|
||||
!strcmp(cmd[0], "restart") || !strcmp(cmd[0], "enable") || !strcmp(cmd[0], "disable"))
|
||||
{
|
||||
|
|
|
@ -109,6 +109,7 @@ struct disk_tool_t
|
|||
int udev_import(std::string device);
|
||||
int read_sb(std::string device);
|
||||
int write_sb(std::string device);
|
||||
int update_sb(std::string device);
|
||||
int exec_osd(std::string device);
|
||||
int systemd_start_stop_osds(const std::vector<std::string> & cmd, const std::vector<std::string> & devices);
|
||||
int pre_exec_osd(std::string device);
|
||||
|
|
|
@ -86,6 +86,24 @@ int disk_tool_t::write_sb(std::string device)
|
|||
return !write_osd_superblock(device, params);
|
||||
}
|
||||
|
||||
int disk_tool_t::update_sb(std::string device)
|
||||
{
|
||||
json11::Json sb = read_osd_superblock(device, true, options.find("force") != options.end());
|
||||
if (sb.is_null())
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
auto sb_obj = sb["params"].object_items();
|
||||
for (auto & kv: options)
|
||||
{
|
||||
if (kv.first != "force")
|
||||
{
|
||||
sb_obj[kv.first] = kv.second;
|
||||
}
|
||||
}
|
||||
return !write_osd_superblock(device, sb_obj);
|
||||
}
|
||||
|
||||
uint32_t disk_tool_t::write_osd_superblock(std::string device, json11::Json params)
|
||||
{
|
||||
std::string json_data = params.dump();
|
||||
|
|
Loading…
Reference in New Issue