Do not try to purge the same OSD multiple times if its multiple devices are passed to purge
This commit is contained in:
@@ -383,7 +383,7 @@ int disk_tool_t::pre_exec_osd(std::string device)
|
|||||||
|
|
||||||
int disk_tool_t::purge_devices(const std::vector<std::string> & devices)
|
int disk_tool_t::purge_devices(const std::vector<std::string> & devices)
|
||||||
{
|
{
|
||||||
std::vector<uint64_t> osd_numbers;
|
std::set<uint64_t> osd_numbers;
|
||||||
json11::Json::array superblocks;
|
json11::Json::array superblocks;
|
||||||
for (auto & device: devices)
|
for (auto & device: devices)
|
||||||
{
|
{
|
||||||
@@ -391,8 +391,11 @@ int disk_tool_t::purge_devices(const std::vector<std::string> & devices)
|
|||||||
if (!sb.is_null())
|
if (!sb.is_null())
|
||||||
{
|
{
|
||||||
uint64_t osd_num = sb["params"]["osd_num"].uint64_value();
|
uint64_t osd_num = sb["params"]["osd_num"].uint64_value();
|
||||||
osd_numbers.push_back(osd_num);
|
if (osd_numbers.find(osd_num) == osd_numbers.end())
|
||||||
superblocks.push_back(sb);
|
{
|
||||||
|
osd_numbers.insert(osd_num);
|
||||||
|
superblocks.push_back(sb);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!osd_numbers.size())
|
if (!osd_numbers.size())
|
||||||
|
|||||||
Reference in New Issue
Block a user