New upstream version 8.1.0
This commit is contained in:
44
storage/source/net/message/nodes/MapTargetsMsgEx.cpp
Normal file
44
storage/source/net/message/nodes/MapTargetsMsgEx.cpp
Normal file
@@ -0,0 +1,44 @@
|
||||
#include <common/net/message/nodes/MapTargetsRespMsg.h>
|
||||
#include <common/toolkit/MessagingTk.h>
|
||||
#include <common/toolkit/ZipIterator.h>
|
||||
#include <program/Program.h>
|
||||
#include "MapTargetsMsgEx.h"
|
||||
|
||||
|
||||
bool MapTargetsMsgEx::processIncoming(ResponseContext& ctx)
|
||||
{
|
||||
LogContext log("MapTargetsMsg incoming");
|
||||
|
||||
const App* app = Program::getApp();
|
||||
const NodeStoreServers* storageNodes = app->getStorageNodes();
|
||||
TargetMapper* targetMapper = app->getTargetMapper();
|
||||
|
||||
const NumNodeID nodeID = getNodeID();
|
||||
std::map<uint16_t, FhgfsOpsErr> results;
|
||||
|
||||
for (const auto mapping : getTargets())
|
||||
{
|
||||
const auto targetId = mapping.first;
|
||||
const auto poolId = mapping.second;
|
||||
|
||||
const auto mapRes = targetMapper->mapTarget(targetId, nodeID, poolId);
|
||||
|
||||
results[targetId] = mapRes.first;
|
||||
|
||||
if ( (mapRes.first != FhgfsOpsErr_SUCCESS) && (mapRes.second) )
|
||||
{ // target could be mapped and is new
|
||||
LOG_DEBUG_CONTEXT(log, Log_WARNING, "Mapping "
|
||||
"target " + StringTk::uintToStr(targetId) +
|
||||
" => " +
|
||||
storageNodes->getNodeIDWithTypeStr(nodeID) );
|
||||
|
||||
IGNORE_UNUSED_VARIABLE(storageNodes);
|
||||
}
|
||||
}
|
||||
|
||||
if(!acknowledge(ctx) )
|
||||
ctx.sendResponse(MapTargetsRespMsg(results));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user