-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add PURGE_HOST cms action * Review fixes * Review fixes 2
- Loading branch information
1 parent
d5b6ea7
commit b29fd3a
Showing
29 changed files
with
974 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
105 changes: 105 additions & 0 deletions
105
cloud/blockstore/libs/storage/disk_registry/disk_registry_actor_purge_host_cms.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
#include "disk_registry_actor.h" | ||
#include "disk_registry_database.h" | ||
|
||
namespace NCloud::NBlockStore::NStorage { | ||
|
||
using namespace NActors; | ||
using namespace NKikimr; | ||
using namespace NKikimr::NTabletFlatExecutor; | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
void TDiskRegistryActor::HandlePurgeHostCms( | ||
const TEvDiskRegistryPrivate::TEvPurgeHostCmsRequest::TPtr& ev, | ||
const TActorContext& ctx) | ||
{ | ||
BLOCKSTORE_DISK_REGISTRY_COUNTER(PurgeHostCms); | ||
|
||
auto* msg = ev->Get(); | ||
|
||
auto requestInfo = CreateRequestInfo( | ||
ev->Sender, | ||
ev->Cookie, | ||
msg->CallContext); | ||
|
||
LOG_INFO( | ||
ctx, | ||
TBlockStoreComponents::DISK_REGISTRY, | ||
"[%lu] Received PurgeHostCms request: Host=%s", | ||
TabletID(), | ||
msg->Host.c_str()); | ||
|
||
ExecuteTx<TPurgeHostCms>( | ||
ctx, | ||
std::move(requestInfo), | ||
std::move(msg->Host), | ||
msg->DryRun); | ||
} | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
bool TDiskRegistryActor::PreparePurgeHostCms( | ||
const TActorContext& ctx, | ||
TTransactionContext& tx, | ||
TTxDiskRegistry::TPurgeHostCms& args) | ||
{ | ||
Y_UNUSED(ctx); | ||
Y_UNUSED(tx); | ||
Y_UNUSED(args); | ||
|
||
return true; | ||
} | ||
|
||
void TDiskRegistryActor::ExecutePurgeHostCms( | ||
const TActorContext& ctx, | ||
TTransactionContext& tx, | ||
TTxDiskRegistry::TPurgeHostCms& args) | ||
{ | ||
TDiskRegistryDatabase db(tx.DB); | ||
args.Error = State->PurgeHost( | ||
db, | ||
args.Host, | ||
ctx.Now(), | ||
args.DryRun, | ||
args.AffectedDisks); | ||
} | ||
|
||
void TDiskRegistryActor::CompletePurgeHostCms( | ||
const TActorContext& ctx, | ||
TTxDiskRegistry::TPurgeHostCms& args) | ||
{ | ||
LOG_INFO( | ||
ctx, | ||
TBlockStoreComponents::DISK_REGISTRY, | ||
"PurgeHostCms result: Host=%s Error=%s AffectedDisks=%s", | ||
args.Host.c_str(), | ||
FormatError(args.Error).c_str(), | ||
[&] | ||
{ | ||
TStringStream out; | ||
out << "["; | ||
for (const auto& diskId: args.AffectedDisks) { | ||
out << " " << diskId << ":" | ||
<< NProto::EDiskState_Name(State->GetDiskState(diskId)); | ||
} | ||
out << " ]"; | ||
return out.Str(); | ||
}().c_str()); | ||
|
||
ReallocateDisks(ctx); | ||
NotifyUsers(ctx); | ||
PublishDiskStates(ctx); | ||
|
||
SecureErase(ctx); | ||
StartMigration(ctx); | ||
|
||
auto response = | ||
std::make_unique<TEvDiskRegistryPrivate::TEvPurgeHostCmsResponse>( | ||
std::move(args.Error), | ||
TDuration(), // Timeout | ||
std::move(args.AffectedDisks)); | ||
|
||
NCloud::Reply(ctx, *args.RequestInfo, std::move(response)); | ||
} | ||
|
||
} // namespace NCloud::NBlockStore::NStorage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.