Compare commits
2 Commits
1d94afbd51
...
f904576ab1
Author | SHA1 | Date |
---|---|---|
|
f904576ab1 | |
|
4f9b1f2f62 |
|
@ -355,7 +355,7 @@ Set OSD reweight, tags or noout flag. See detail description in [OSD config docu
|
|||
|
||||
## pg-list
|
||||
|
||||
`vitastor-cli pg-list|pg-ls|list-pg|ls-pg|ls-pgs [OPTIONS] [state1+state2] [^state3] [...]`
|
||||
`vitastor-cli pg-list|pg-ls|list-pg|ls-pg|ls-pgs|pgs [OPTIONS] [state1+state2] [^state3] [...]`
|
||||
|
||||
List PGs with any of listed state filters (^ or ! in the beginning is negation). Options:
|
||||
|
||||
|
@ -363,6 +363,7 @@ List PGs with any of listed state filters (^ or ! in the beginning is negation).
|
|||
--pool <pool name or number> Only list PGs of the given pool.
|
||||
--min <min pg number> Only list PGs with number >= min.
|
||||
--max <max pg number> Only list PGs with number <= max.
|
||||
--osd 1,2,... Only list PGs with some data on specified OSD(s).
|
||||
```
|
||||
|
||||
Examples:
|
||||
|
|
|
@ -375,9 +375,10 @@ OSD PARENT UP SIZE USED% TAGS WEIGHT BLOCK BITMAP
|
|||
в начале фильтра означает отрицание). Опции:
|
||||
|
||||
```
|
||||
--pool <pool name or number> Only list PGs of the given pool.
|
||||
--min <min pg number> Only list PGs with number >= min.
|
||||
--max <max pg number> Only list PGs with number <= max.
|
||||
--pool <pool name or number> Вывести только PG в заданном пуле.
|
||||
--min <min pg number> Вывести только PG с номерами >= min.
|
||||
--max <max pg number> Вывести только PG с номерами <= max.
|
||||
--osd 1,2,... Вывести только PG с данными на заданных OSD.
|
||||
```
|
||||
|
||||
Примеры:
|
||||
|
|
|
@ -160,11 +160,12 @@ static const char* help_text =
|
|||
"vitastor-cli modify-osd [--tags tag1,tag2,...] [--reweight <number>] [--noout true/false] <osd_number>\n"
|
||||
" Set OSD reweight, tags or noout flag.\n"
|
||||
"\n"
|
||||
"vitastor-cli pg-list|pg-ls|list-pg|ls-pg|ls-pgs [OPTIONS] [state1+state2] [^state3] [...]\n"
|
||||
"vitastor-cli pg-list|pg-ls|list-pg|ls-pg|ls-pgs|pgs [OPTIONS] [state1+state2] [^state3] [...]\n"
|
||||
" List PGs with any of listed state filters (^ or ! in the beginning is negation). Options:\n"
|
||||
" --pool <pool name or number> Only list PGs of the given pool.\n"
|
||||
" --min <min pg number> Only list PGs with number >= min.\n"
|
||||
" --max <max pg number> Only list PGs with number <= max.\n"
|
||||
" --osd 1,2,... Only list PGs with some data on specified OSD(s).\n"
|
||||
" Examples:\n"
|
||||
" vitastor-cli pg-list active+degraded\n"
|
||||
" vitastor-cli pg-list ^active\n"
|
||||
|
@ -483,7 +484,7 @@ static int run(cli_tool_t *p, json11::Json::object cfg)
|
|||
cfg["osd_num"] = cmd[1];
|
||||
action_cb = p->start_modify_osd(cfg);
|
||||
}
|
||||
else if (cmd[0] == "pg-list" || cmd[0] == "pg-ls" || cmd[0] == "list-pg" || cmd[0] == "ls-pg" || cmd[0] == "ls-pgs")
|
||||
else if (cmd[0] == "pg-list" || cmd[0] == "pg-ls" || cmd[0] == "list-pg" || cmd[0] == "ls-pg" || cmd[0] == "ls-pgs" || cmd[0] == "pgs")
|
||||
{
|
||||
// Modify OSD configuration
|
||||
if (cmd.size() > 1)
|
||||
|
|
|
@ -11,6 +11,7 @@ struct pg_lister_t
|
|||
cli_tool_t *parent;
|
||||
|
||||
uint64_t pool_id = 0;
|
||||
std::set<osd_num_t> osd_nums;
|
||||
std::string pool_name;
|
||||
std::vector<std::string> pg_state;
|
||||
uint64_t min_pg_num = 0;
|
||||
|
@ -137,6 +138,22 @@ resume_1:
|
|||
{
|
||||
continue;
|
||||
}
|
||||
if (osd_nums.size())
|
||||
{
|
||||
bool found = false;
|
||||
for (int i = 0; !found && i < pgp.second.target_set.size(); i++)
|
||||
if (osd_nums.find(pgp.second.target_set[i]) != osd_nums.end())
|
||||
found = true;
|
||||
for (int i = 0; !found && i < pgp.second.target_history.size(); i++)
|
||||
for (int j = 0; !found && j < pgp.second.target_history[i].size(); j++)
|
||||
if (osd_nums.find(pgp.second.target_history[i][j]) != osd_nums.end())
|
||||
found = true;
|
||||
for (int i = 0; !found && i < pgp.second.all_peers.size(); i++)
|
||||
if (osd_nums.find(pgp.second.all_peers[i]) != osd_nums.end())
|
||||
found = true;
|
||||
if (!found)
|
||||
continue;
|
||||
}
|
||||
if (masks.size())
|
||||
{
|
||||
bool found = false;
|
||||
|
@ -274,6 +291,14 @@ std::function<bool(cli_result_t &)> cli_tool_t::start_pg_list(json11::Json cfg)
|
|||
pg_lister->pg_state.push_back(cfg["pg_state"].string_value());
|
||||
pg_lister->min_pg_num = cfg["min"].uint64_value();
|
||||
pg_lister->max_pg_num = cfg["max"].uint64_value();
|
||||
if (cfg["osd"].is_array())
|
||||
for (auto & osd_num_json: cfg["osd"].array_items())
|
||||
pg_lister->osd_nums.insert(osd_num_json.uint64_value());
|
||||
else if (cfg["osd"].is_string())
|
||||
for (auto & osd_num_str: explode(",", cfg["osd"].string_value(), true))
|
||||
pg_lister->osd_nums.insert(stoull_full(osd_num_str));
|
||||
else if (cfg["osd"].uint64_value())
|
||||
pg_lister->osd_nums.insert(cfg["osd"].uint64_value());
|
||||
return [pg_lister](cli_result_t & result)
|
||||
{
|
||||
pg_lister->loop();
|
||||
|
|
|
@ -69,11 +69,11 @@ struct rm_inode_t
|
|||
});
|
||||
if (min_offset == 0 && max_offset == 0)
|
||||
{
|
||||
total_count += objects.size();
|
||||
total_count += rm->objects.size();
|
||||
}
|
||||
else
|
||||
{
|
||||
for (object_id oid: objects)
|
||||
for (object_id oid: rm->objects)
|
||||
{
|
||||
if (oid.stripe >= min_offset && (!max_offset || oid.stripe < max_offset))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue