@@ -38,6 +38,41 @@ void TNodeWarden::Handle(NMon::TEvHttpInfo::TPtr &ev) {
3838 }
3939 result = std::make_unique<NMon::TEvHttpInfoRes>(NMonitoring::HTTPOKJSON + out.Str (), 0 ,
4040 NMon::IEvHttpInfoRes::EContentType::Custom);
41+ } else if (pathInfo.StartsWith (" /slayer" )) {
42+ HTTP_METHOD method = ev->Get ()->Request .GetMethod ();
43+ if (method != HTTP_METHOD_POST) {
44+ out << " Only POST method is supported for /slayer endpoint" ;
45+ } else {
46+ const TCgiParameters& postCgi = ev->Get ()->Request .GetPostParams ();
47+ if (postCgi.Has (" vdiskId" ) && postCgi.Has (" pdiskId" )) {
48+ TString vdiskIdStr = postCgi.Get (" vdiskId" );
49+ ui32 pdiskId = FromStringWithDefault<ui32>(postCgi.Get (" pdiskId" ), 0 );
50+ if (vdiskIdStr && pdiskId) {
51+ TVDiskID vdiskId = VDiskIDFromString (vdiskIdStr);
52+ ui32 groupId = vdiskId.GroupID .GetRawId ();
53+ bool hasVDisk = false ;
54+ for (const auto & kv : LocalVDisks) {
55+ if (kv.second .GetGroupId () == groupId) {
56+ hasVDisk = true ;
57+ out << " GroupId " << groupId << " has actual working VDisk " << kv.second .GetVDiskId () << " , cannot slay it" ;
58+ break ;
59+ }
60+ }
61+ if (!hasVDisk) {
62+ const TActorId pdiskServiceId = MakeBlobStoragePDiskID (LocalNodeId, pdiskId);
63+ const ui64 round = NextLocalPDiskInitOwnerRound ();
64+ Send (pdiskServiceId, new NPDisk::TEvSlay (vdiskId, round, 0 , 0 ));
65+ out << " OK" ;
66+ }
67+ } else {
68+ out << " Invalid groupId or pdiskId" ;
69+ }
70+ } else {
71+ out << " Missing groupId or pdiskId parameters" ;
72+ }
73+ }
74+ result = std::make_unique<NMon::TEvHttpInfoRes>(NMonitoring::HTTPOKJSON + out.Str (), 0 ,
75+ NMon::IEvHttpInfoRes::EContentType::Custom);
4176 } else {
4277 RenderWholePage (out);
4378 result = std::make_unique<NMon::TEvHttpInfoRes>(out.Str ());
0 commit comments