Compare commits
No commits in common. "aca2bef15f66e76c6e3fa874d2814e90421756c4" and "62ed130960d0af4f82c7c4997ef0ec6e05b42760" have entirely different histories.
aca2bef15f
...
62ed130960
|
@ -257,8 +257,7 @@ func (ns *NodeServer) mapVduse(volName string, ctxVars map[string]string, readon
|
||||||
if (err == nil)
|
if (err == nil)
|
||||||
{
|
{
|
||||||
// Find block device name
|
// Find block device name
|
||||||
var matches []string
|
matches, err := filepath.Glob("/sys/bus/vdpa/devices/"+vdpaId+"/virtio*/block/*")
|
||||||
matches, err = filepath.Glob("/sys/bus/vdpa/devices/"+vdpaId+"/virtio*/block/*")
|
|
||||||
if (err == nil && len(matches) == 0)
|
if (err == nil && len(matches) == 0)
|
||||||
{
|
{
|
||||||
err = errors.New("/sys/bus/vdpa/devices/"+vdpaId+"/virtio*/block/* is not found")
|
err = errors.New("/sys/bus/vdpa/devices/"+vdpaId+"/virtio*/block/* is not found")
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
stable version from 0.9.x branch instead of 1.x
|
stable version from 0.9.x branch instead of 1.x
|
||||||
- For Debian 10 (Buster) also enable backports repository:
|
- For Debian 10 (Buster) also enable backports repository:
|
||||||
`deb http://deb.debian.org/debian buster-backports main`
|
`deb http://deb.debian.org/debian buster-backports main`
|
||||||
- Install packages: `apt update; apt install vitastor lp-solve etcd linux-image-amd64 qemu-system-x86`
|
- Install packages: `apt update; apt install vitastor lp-solve etcd linux-image-amd64 qemu`
|
||||||
|
|
||||||
## CentOS
|
## CentOS
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
установить последнюю стабильную версию из ветки 0.9.x вместо 1.x
|
установить последнюю стабильную версию из ветки 0.9.x вместо 1.x
|
||||||
- Для Debian 10 (Buster) также включите репозиторий backports:
|
- Для Debian 10 (Buster) также включите репозиторий backports:
|
||||||
`deb http://deb.debian.org/debian buster-backports main`
|
`deb http://deb.debian.org/debian buster-backports main`
|
||||||
- Установите пакеты: `apt update; apt install vitastor lp-solve etcd linux-image-amd64 qemu-system-x86`
|
- Установите пакеты: `apt update; apt install vitastor lp-solve etcd linux-image-amd64 qemu`
|
||||||
|
|
||||||
## CentOS
|
## CentOS
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@ It supports the following commands:
|
||||||
- [purge](#purge)
|
- [purge](#purge)
|
||||||
- [read-sb](#read-sb)
|
- [read-sb](#read-sb)
|
||||||
- [write-sb](#write-sb)
|
- [write-sb](#write-sb)
|
||||||
- [update-sb](#update-sb)
|
|
||||||
- [udev](#udev)
|
- [udev](#udev)
|
||||||
- [exec-osd](#exec-osd)
|
- [exec-osd](#exec-osd)
|
||||||
- [pre-exec](#pre-exec)
|
- [pre-exec](#pre-exec)
|
||||||
|
@ -183,14 +182,6 @@ 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>`.
|
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
|
## udev
|
||||||
|
|
||||||
`vitastor-disk udev <device>`
|
`vitastor-disk udev <device>`
|
||||||
|
|
|
@ -17,7 +17,6 @@ vitastor-disk - инструмент командной строки для уп
|
||||||
- [purge](#purge)
|
- [purge](#purge)
|
||||||
- [read-sb](#read-sb)
|
- [read-sb](#read-sb)
|
||||||
- [write-sb](#write-sb)
|
- [write-sb](#write-sb)
|
||||||
- [update-sb](#update-sb)
|
|
||||||
- [udev](#udev)
|
- [udev](#udev)
|
||||||
- [exec-osd](#exec-osd)
|
- [exec-osd](#exec-osd)
|
||||||
- [pre-exec](#pre-exec)
|
- [pre-exec](#pre-exec)
|
||||||
|
@ -188,15 +187,6 @@ throttle_target_mbs, throttle_target_parallelism, throttle_threshold_us.
|
||||||
|
|
||||||
Прочитать JSON со стандартного ввода и записать его в суперблок OSD на диск `<device>`.
|
Прочитать JSON со стандартного ввода и записать его в суперблок OSD на диск `<device>`.
|
||||||
|
|
||||||
## update-sb
|
|
||||||
|
|
||||||
`vitastor-disk update-sb <device> [--force] [--<параметр> <значение>] [...]`
|
|
||||||
|
|
||||||
Прочитать суперблок OSD с диска `<device>`, изменить в нём заданные параметры и записать обратно.
|
|
||||||
|
|
||||||
Опция `--force` позволяет читать суперблок, даже если он считается некорректным
|
|
||||||
из-за ошибок валидации.
|
|
||||||
|
|
||||||
## udev
|
## udev
|
||||||
|
|
||||||
`vitastor-disk udev <device>`
|
`vitastor-disk udev <device>`
|
||||||
|
|
|
@ -127,10 +127,6 @@ static const char *help_text =
|
||||||
"vitastor-disk write-sb <device>\n"
|
"vitastor-disk write-sb <device>\n"
|
||||||
" Read JSON from STDIN and write it into Vitastor OSD superblock on <device>.\n"
|
" Read JSON from STDIN and write it into Vitastor OSD superblock on <device>.\n"
|
||||||
"\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"
|
"vitastor-disk udev <device>\n"
|
||||||
" Try to read Vitastor OSD superblock from <device> and print variables for udev.\n"
|
" Try to read Vitastor OSD superblock from <device> and print variables for udev.\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
@ -367,15 +363,6 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
return self.write_sb(cmd[1]);
|
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") ||
|
else if (!strcmp(cmd[0], "start") || !strcmp(cmd[0], "stop") ||
|
||||||
!strcmp(cmd[0], "restart") || !strcmp(cmd[0], "enable") || !strcmp(cmd[0], "disable"))
|
!strcmp(cmd[0], "restart") || !strcmp(cmd[0], "enable") || !strcmp(cmd[0], "disable"))
|
||||||
{
|
{
|
||||||
|
|
|
@ -109,7 +109,6 @@ struct disk_tool_t
|
||||||
int udev_import(std::string device);
|
int udev_import(std::string device);
|
||||||
int read_sb(std::string device);
|
int read_sb(std::string device);
|
||||||
int write_sb(std::string device);
|
int write_sb(std::string device);
|
||||||
int update_sb(std::string device);
|
|
||||||
int exec_osd(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 systemd_start_stop_osds(const std::vector<std::string> & cmd, const std::vector<std::string> & devices);
|
||||||
int pre_exec_osd(std::string device);
|
int pre_exec_osd(std::string device);
|
||||||
|
|
|
@ -86,24 +86,6 @@ int disk_tool_t::write_sb(std::string device)
|
||||||
return !write_osd_superblock(device, params);
|
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)
|
uint32_t disk_tool_t::write_osd_superblock(std::string device, json11::Json params)
|
||||||
{
|
{
|
||||||
std::string json_data = params.dump();
|
std::string json_data = params.dump();
|
||||||
|
|
Loading…
Reference in New Issue