in host/common/TagTelemetry.h [289:439]
static void ParseCmdOutput(const std::string& cmdOutput, TagStatus& tagStatus, const SV_ULONG &exitCode)
{
std::string strValue;
GetValueForPropertyKey(cmdOutput, NsVacpOutputKeys::TagGuidKey, strValue, TAG_GUID_LEN);
ADD_STRING_TO_MAP(tagStatus, TAGGUID, strValue);
GetValueForPropertyKey(cmdOutput, NsVacpOutputKeys::TagInsertKey, strValue);
ADD_STRING_TO_MAP(tagStatus, NUMOFDISKWITHTAG, strValue);
std::string tagName;
uint32_t tagTypeInsert = INVALID_TAGTYPE;
std::string strTagVal;
GetValueForPropertyKey(cmdOutput, NsVacpOutputKeys::TagType, strTagVal);
if (0 == strTagVal.compare(BASELINE_TAG))
{
tagTypeInsert = BASELINE_CONSISTENCY;
GetValueForPropertyKey(cmdOutput, NsVacpOutputKeys::BaselineTagKey, tagName);
ADD_STRING_TO_MAP(tagStatus, TAGNAME, tagName);
}
else
{
GetValueForPropertyKey(cmdOutput, NsVacpOutputKeys::TagKey, tagName, NsVacpOutputKeys::TIMESTAMP_LEN);
if (std::string::npos != cmdOutput.find(NsVacpOutputKeys::FsTagKey))
{
tagTypeInsert = APP_CONSISTENCY;
tagName = std::string("FileSystem") + tagName;
ADD_STRING_TO_MAP(tagStatus, TAGNAME, tagName);
}
if (std::string::npos != cmdOutput.find(NsVacpOutputKeys::CcTagKey))
{
tagTypeInsert = CRASH_CONSISTENCY;
tagName = std::string("CrashTag") + tagName;
ADD_STRING_TO_MAP(tagStatus, TAGNAME, tagName);
}
if (std::string::npos != cmdOutput.find(NsVacpOutputKeys::LocalTagKey))
tagTypeInsert |= SINGLE_NODE;
if (std::string::npos != cmdOutput.find(NsVacpOutputKeys::MultivmTagKey))
tagTypeInsert |= MULTI_NODE;
}
ADD_INT_TO_MAP(tagStatus, TAGTYPEINSERT, tagTypeInsert);
GetValueForPropertyKey(cmdOutput, NsVacpOutputKeys::TagInsertTimeKey, strValue);
ADD_STRING_TO_MAP(tagStatus, TAGINSERTTIME, strValue);
if (CRASH_CONSISTENCY == (tagTypeInsert & CRASH_CONSISTENCY))
{
GetValueForPropertyKey(cmdOutput, NsVacpOutputKeys::IoBarrierKey, strValue);
ADD_STRING_TO_MAP(tagStatus, APPFREEZEELAPSED, strValue);
}
else if (APP_CONSISTENCY == (tagTypeInsert & APP_CONSISTENCY))
{
GetValueForPropertyKey(cmdOutput, NsVacpOutputKeys::TagCommitTimeKey, strValue);
ADD_STRING_TO_MAP(tagStatus, TAGCOMMITTIME, strValue);
GetValueForPropertyKey(cmdOutput, NsVacpOutputKeys::AppQuiesceKey, strValue);
ADD_STRING_TO_MAP(tagStatus, APPFREEZEELAPSED, strValue);
GetValueForPropertyKey(cmdOutput, NsVacpOutputKeys::DrainBarrierKey, strValue);
ADD_STRING_TO_MAP(tagStatus, BARRIERELAPSED, strValue);
GetValueForPropertyKey(cmdOutput, NsVacpOutputKeys::AppPrepPhKey, strValue);
ADD_STRING_TO_MAP(tagStatus, APPPREPAREELAPSED, strValue);
}
if (MULTI_NODE == (tagTypeInsert & MULTI_NODE))
{
GetValueForPropertyKey(cmdOutput, NsVacpOutputKeys::PrepPhKey, strValue);
ADD_STRING_TO_MAP(tagStatus, PREPAREELAPSED, strValue);
GetValueForPropertyKey(cmdOutput, NsVacpOutputKeys::TagPhKey, strValue);
ADD_STRING_TO_MAP(tagStatus, TAGPHASEELAPSED, strValue);
GetValueForPropertyKey(cmdOutput, NsVacpOutputKeys::QuiescePhKey, strValue);
ADD_STRING_TO_MAP(tagStatus, FREEZEELAPSED, strValue);
GetValueForPropertyKey(cmdOutput, NsVacpOutputKeys::ResumePhKey, strValue);
ADD_STRING_TO_MAP(tagStatus, RESUMEELAPSED, strValue);
}
ADD_INT_TO_MAP(tagStatus, REASON, exitCode);
if (0 == exitCode)
{
ADD_INT_TO_MAP(tagStatus, FINALSTATUS, TAG_SUCCEEDED);
}
else if (VACP_ONE_OR_MORE_DISK_IN_IR == exitCode)
{
ADD_INT_TO_MAP(tagStatus, FINALSTATUS, TAG_SKIPPED);
}
else if (VACP_E_PREPARE_PHASE_FAILED == exitCode)
{
ADD_INT_TO_MAP(tagStatus, FINALSTATUS, TAG_PRECHECK_FAILED);
}
else if (std::string::npos != cmdOutput.find(NsVacpOutputKeys::VacpSpawnFailKey))
{
ADD_INT_TO_MAP(tagStatus, FINALSTATUS, TAG_VACP_SPAWN_FAILED);
}
else if (std::string::npos != cmdOutput.find(NsVacpOutputKeys::VacpAbortKey))
{
ADD_INT_TO_MAP(tagStatus, FINALSTATUS, TAG_VACP_ABORT_TIMEOUT);
}
else
{
ADD_INT_TO_MAP(tagStatus, FINALSTATUS, TAG_FAILED);
}
int first = 0;
int len = 0;
if (std::string::npos != (first = cmdOutput.find(vacpFailMsgsTok)))
{
first += vacpFailMsgsTok.length();
if (std::string::npos != (len = cmdOutput.rfind(VACP_FAIL_MSG_DELM)))
{
len -= first;
ParsegVacpFailMsgs(cmdOutput.substr(first, len), tagStatus, exitCode);
}
}
else if (0 != exitCode)
{
DebugPrintf(SV_LOG_ERROR, "%s: vacp failed but token \"%s\" not found in vacp cmdOutput, exitCode=%d.\n", FUNCTION_NAME, vacpFailMsgsTok.c_str(), exitCode);
}
if (boost::lexical_cast<uint32_t>(tagStatus.Map[TAGTYPECONF]) & MULTI_NODE)
{
if (std::string::npos != cmdOutput.find(NsVacpOutputKeys::MasterNodeRoleKey))
{
ADD_INT_TO_MAP(tagStatus, NODETYPE, MULTI_VM_NODE_TYPE_MASTER);
}
else if (std::string::npos != cmdOutput.find(NsVacpOutputKeys::ClientNodeRoleKey))
{
ADD_INT_TO_MAP(tagStatus, NODETYPE, MULTI_VM_NODE_TYPE_CLIENT);
}
// Check multivm failure here as exitCode is 0 when multivm fails and local tag successful
std::size_t first = cmdOutput.find(multivmFailMsgsTok);
if (std::string::npos != first)
{
std::size_t end = cmdOutput.rfind(MULTIVM_FAIL_MSG_DELM);
first += multivmFailMsgsTok.length();
if (std::string::npos != end)
{
ParsegMultivmFailMsgs(cmdOutput.substr(first, end - first), tagStatus);
}
}
}
}