Skip to content

Commit

Permalink
review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
komarevtsev-d committed Jul 15, 2024
1 parent b1a0bc3 commit 61bfff6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 20 deletions.
33 changes: 14 additions & 19 deletions cloud/blockstore/libs/storage/disk_registry/disk_registry_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4694,17 +4694,10 @@ NProto::TError TDiskRegistryState::UpdateAgentState(
// an idle agent. DR waits for it to become online and blocks host
// deployment.
if (StorageConfig->GetCleanupDRConfigOnCMSActions() &&
newState == NProto::EAgentState::AGENT_STATE_UNAVAILABLE &&
newState == NProto::AGENT_STATE_UNAVAILABLE &&
agent->GetDevices().empty())
{
bool success = RemoveAgent(db, agent->GetNodeId());
if (!success) {
return MakeError(
E_FAIL,
TStringBuilder() << "Couldn't remove the agent "
<< agent->GetAgentId().Quote());
}

RemoveAgent(db, *agent);
return {};
}

Expand Down Expand Up @@ -5060,17 +5053,19 @@ NProto::TError TDiskRegistryState::UpdateCmsHostState(
ApplyAgentStateChange(db, *agent, now, affectedDisks);

if (newState != NProto::AGENT_STATE_ONLINE && !HasError(result)) {
auto error = TryToRemoveAgentDevices(db, agent->GetAgentId());
if (!HasError(error)) {
return result;
}
if (StorageConfig->GetCleanupDRConfigOnCMSActions()) {
auto error = TryToRemoveAgentDevices(db, agent->GetAgentId());
if (!HasError(error)) {
return result;
}

// Do not return the error from "TryToRemoveAgentDevices()" since it's
// internal and shouldn't block node removal.
STORAGE_WARN(
"Could not remove device from agent %s: %s",
agent->GetAgentId().Quote().c_str(),
FormatError(error).c_str());
// Do not return the error from "TryToRemoveAgentDevices()" since
// it's internal and shouldn't block node removal.
STORAGE_WARN(
"Could not remove device from agent %s: %s",
agent->GetAgentId().Quote().c_str(),
FormatError(error).c_str());
}

SuspendLocalDevices(db, *agent);
}
Expand Down
1 change: 0 additions & 1 deletion cloud/blockstore/tests/infra-cms/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,6 @@ def wait_for_stats(self, **kwargs):

for name, expected in kwargs.items():
val = get_sensor_by_name(sensors, 'disk_registry', name)
logging.info('looking for {}, current val = {}, waitong for = {}'.format(name, val, expected))
if val != expected:
break
satisfied.add(name)
Expand Down

0 comments on commit 61bfff6

Please sign in to comment.