Adds immediate migration results in progress
This commit is contained in:
2102 files changed
+17482
-15071
No files matched your search
+25
-26
@@ -22,8 +22,7 @@
|
||||
|
||||
|
||||
|
||||
DataTopicTests::DataTopicTests()
|
||||
: m_domainParticipantPub(nullptr)
|
||||
DataTopicTests::DataTopicTests() : m_domainParticipantPub(nullptr)
|
||||
, m_domainParticipantSub(nullptr)
|
||||
, m_domainId(0)
|
||||
, m_ddsPublisher(nullptr)
|
||||
@@ -35,12 +34,12 @@ DataTopicTests::DataTopicTests()
|
||||
, m_dtcServiceInformation(nullptr)
|
||||
, m_dtcGroupInformation(nullptr)
|
||||
, m_mainThreadId(QThread::currentThreadId())
|
||||
.getNGLLogger("UnitTests.DataTopicTests"))
|
||||
{
|
||||
.getNGLLogger("UnitTests.DataTopicTests")),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
|
||||
if (!DDS::QosProfile::setDefault())
|
||||
ERROR_LOG() << "Error setting default QoS from xml-file ";
|
||||
ERROR_LOG(m_logger) << "Error setting default QoS from xml-file ";
|
||||
|
||||
DEBUG_LOG() << "Main thread ID is " << m_mainThreadId;
|
||||
DEBUG_LOG(m_logger) << "Main thread ID is " << m_mainThreadId;
|
||||
}
|
||||
|
||||
DataTopicTests::~DataTopicTests()
|
||||
@@ -83,7 +82,7 @@ bool DataTopicTests::initPublisher()
|
||||
partitionQos.name( { partition } );
|
||||
publisherQos << partitionQos;
|
||||
|
||||
DEBUG_LOG() << "Publish on partition " << partition;
|
||||
DEBUG_LOG(m_logger) << "Publish on partition " << partition;
|
||||
|
||||
m_ddsPublisher = dds::pub::Publisher(m_domainParticipantPub, publisherQos);
|
||||
|
||||
@@ -96,9 +95,9 @@ bool DataTopicTests::initPublisher()
|
||||
|
||||
bool DataTopicTests::write(const ServiceManagement::ServiceInformation &data)
|
||||
{
|
||||
INFO_LOG() << "Publish topic ServiceInformation ";
|
||||
INFO_LOG(m_logger) << "Publish topic ServiceInformation ";
|
||||
|
||||
DEBUG_LOG() << "Id: " << data.id()
|
||||
DEBUG_LOG(m_logger) << "Id: " << data.id()
|
||||
<< ", Name: " << data.name()
|
||||
<< ", State: " << data.state()
|
||||
<< ", Timestamp: " << data.timestamp()
|
||||
@@ -110,7 +109,7 @@ bool DataTopicTests::write(const ServiceManagement::ServiceInformation &data)
|
||||
|
||||
bool DataTopicTests::write(const ServiceManagement::GroupInformation &data)
|
||||
{
|
||||
INFO_LOG() << "Publish topic GroupInformation ";
|
||||
INFO_LOG(m_logger) << "Publish topic GroupInformation ";
|
||||
|
||||
if(m_logger.isDebugEnabled())
|
||||
{
|
||||
@@ -125,7 +124,7 @@ bool DataTopicTests::write(const ServiceManagement::GroupInformation &data)
|
||||
if(services.endsWith(QLatin1Char(',')))
|
||||
services.chop(1);
|
||||
|
||||
DEBUG_LOG() << "Type: " << data.type()
|
||||
DEBUG_LOG(m_logger) << "Type: " << data.type()
|
||||
<< ", Domain: " << data.domainId()
|
||||
<< ", Partition: " << data.exercisePartitionId()
|
||||
<< ", Partition: " << data.replayPartitionId()
|
||||
@@ -149,13 +148,13 @@ ServiceManagement::GroupInformation DataTopicTests::getReceivedGroupInformationD
|
||||
void DataTopicTests::processData(const ServiceManagement::ServiceInformation &instance, DataModification modType)
|
||||
{
|
||||
Q_UNUSED(modType);
|
||||
INFO_LOG() << "process Lts_ServiceInformation";
|
||||
INFO_LOG(m_logger) << "process Lts_ServiceInformation";
|
||||
|
||||
DEBUG_LOG() << "Id: " << instance.id();
|
||||
DEBUG_LOG() << "Name: " << instance.name();
|
||||
DEBUG_LOG() << "State: " << instance.state();
|
||||
DEBUG_LOG() << "Timestamp: " << instance.timestamp();
|
||||
DEBUG_LOG() << "ErrorString: " << instance.errorString();
|
||||
DEBUG_LOG(m_logger) << "Id: " << instance.id();
|
||||
DEBUG_LOG(m_logger) << "Name: " << instance.name();
|
||||
DEBUG_LOG(m_logger) << "State: " << instance.state();
|
||||
DEBUG_LOG(m_logger) << "Timestamp: " << instance.timestamp();
|
||||
DEBUG_LOG(m_logger) << "ErrorString: " << instance.errorString();
|
||||
|
||||
m_receivedServiceInformationData = instance;
|
||||
|
||||
@@ -167,7 +166,7 @@ void DataTopicTests::processData(const ServiceManagement::ServiceInformation &in
|
||||
void DataTopicTests::processData(const ServiceManagement::GroupInformation &instance, DataModification modType)
|
||||
{
|
||||
Q_UNUSED(modType);
|
||||
INFO_LOG() << "process Lts_ServiceInformation";
|
||||
INFO_LOG(m_logger) << "process Lts_ServiceInformation";
|
||||
|
||||
if(m_logger.isDebugEnabled())
|
||||
{
|
||||
@@ -182,12 +181,12 @@ void DataTopicTests::processData(const ServiceManagement::GroupInformation &inst
|
||||
if(services.endsWith(QLatin1Char(',')))
|
||||
services.chop(1);
|
||||
|
||||
DEBUG_LOG() << "Type: " << instance.type();
|
||||
DEBUG_LOG() << "Domain: " << instance.domainId();
|
||||
DEBUG_LOG() << "Partition: " << instance.exercisePartitionId();
|
||||
DEBUG_LOG() << "Replay Partition: " << instance.replayPartitionId();
|
||||
DEBUG_LOG() << "Services: " << services;
|
||||
DEBUG_LOG() << "Timestamp: " << instance.timestamp();
|
||||
DEBUG_LOG(m_logger) << "Type: " << instance.type();
|
||||
DEBUG_LOG(m_logger) << "Domain: " << instance.domainId();
|
||||
DEBUG_LOG(m_logger) << "Partition: " << instance.exercisePartitionId();
|
||||
DEBUG_LOG(m_logger) << "Replay Partition: " << instance.replayPartitionId();
|
||||
DEBUG_LOG(m_logger) << "Services: " << services;
|
||||
DEBUG_LOG(m_logger) << "Timestamp: " << instance.timestamp();
|
||||
}
|
||||
|
||||
m_receivedGroupInformationData = instance;
|
||||
@@ -203,7 +202,7 @@ void DataTopicTests::processData(const ServiceManagement::GroupInformation &inst
|
||||
|
||||
bool DataTopicTests::initSubscriber()
|
||||
{
|
||||
DEBUG_LOG() << "Initialisation DDS (Subscriber/Reader)";
|
||||
DEBUG_LOG(m_logger) << "Initialisation DDS (Subscriber/Reader)";
|
||||
|
||||
m_domainParticipantSub =
|
||||
dds::domain::DomainParticipant(m_domainId,
|
||||
@@ -224,7 +223,7 @@ bool DataTopicTests::initSubscriber()
|
||||
partitionQos.name( partitions );
|
||||
subscriberQos << partitionQos;
|
||||
|
||||
DEBUG_LOG() << "Initialise DTC::SubscriberListener";
|
||||
DEBUG_LOG(m_logger) << "Initialise DTC::SubscriberListener";
|
||||
m_subscriberListener = new DDSGeneric::SubscriberListener;
|
||||
|
||||
m_ddsSubscriber = dds::sub::Subscriber(m_domainParticipantSub,
|
||||
|
||||
+1
@@ -44,6 +44,7 @@ public:
|
||||
ServiceManagement::GroupInformation getReceivedGroupInformationData() const;
|
||||
|
||||
protected:
|
||||
NGL::INGLLogger &m_logger;
|
||||
// Subscriber Methods
|
||||
void processData(const ServiceManagement::ServiceInformation& instance, DataModification modType);
|
||||
void processData(const ServiceManagement::GroupInformation& instance, DataModification modType);
|
||||
|
||||
+6
-6
@@ -38,7 +38,7 @@ DataTopicTestsMain::DataTopicTestsMain()
|
||||
|
||||
void DataTopicTestsMain::initTestCase()
|
||||
{
|
||||
DEBUG_LOG() <<"DataTopicTestsMain: initTestCase";
|
||||
DEBUG_LOG(m_logger) <<"DataTopicTestsMain: initTestCase";
|
||||
|
||||
m_dtTest = new DataTopicTests();
|
||||
|
||||
@@ -52,7 +52,7 @@ void DataTopicTestsMain::initTestCase()
|
||||
|
||||
void DataTopicTestsMain::publishServiceInformationTestCase()
|
||||
{
|
||||
DEBUG_LOG() <<"DataTopicTestsMain: publish ServiceInformation data";
|
||||
DEBUG_LOG(m_logger) <<"DataTopicTestsMain: publish ServiceInformation data";
|
||||
|
||||
// Topic ServiceInformation
|
||||
m_sentServiceInformationData.id(13);
|
||||
@@ -66,7 +66,7 @@ void DataTopicTestsMain::publishServiceInformationTestCase()
|
||||
|
||||
void DataTopicTestsMain::subscribeServiceInformationTestCase()
|
||||
{
|
||||
DEBUG_LOG() << "IN subscribeServiceInformationTestCase";
|
||||
DEBUG_LOG(m_logger) << "IN subscribeServiceInformationTestCase";
|
||||
|
||||
QTRY_COMPARE(m_serviceInformationDataArrivedSpy->count(), 1);
|
||||
|
||||
@@ -81,7 +81,7 @@ void DataTopicTestsMain::subscribeServiceInformationTestCase()
|
||||
|
||||
void DataTopicTestsMain::publishGroupInformationTestCase()
|
||||
{
|
||||
DEBUG_LOG() << "DataTopicTestsMain: publish GroupInformation data";
|
||||
DEBUG_LOG(m_logger) << "DataTopicTestsMain: publish GroupInformation data";
|
||||
|
||||
std::vector<int> services = {1, 3, 5, 7, 11, 13, 17, 19, 23, 42};
|
||||
|
||||
@@ -97,7 +97,7 @@ void DataTopicTestsMain::publishGroupInformationTestCase()
|
||||
|
||||
void DataTopicTestsMain::subscribeGroupInformationTestCase()
|
||||
{
|
||||
DEBUG_LOG() << "IN subscribeGroupInformationTestCase";
|
||||
DEBUG_LOG(m_logger) << "IN subscribeGroupInformationTestCase";
|
||||
|
||||
QTRY_COMPARE(m_groupInformationDataArrivedSpy->count(), 1);
|
||||
|
||||
@@ -112,7 +112,7 @@ void DataTopicTestsMain::subscribeGroupInformationTestCase()
|
||||
|
||||
void DataTopicTestsMain::cleanupTestCase()
|
||||
{
|
||||
DEBUG_LOG() <<"DataTopicTestsMain: cleanupTestCase";
|
||||
DEBUG_LOG(m_logger) <<"DataTopicTestsMain: cleanupTestCase";
|
||||
delete m_dtTest; m_dtTest = nullptr;
|
||||
delete m_serviceInformationDataArrivedSpy; m_serviceInformationDataArrivedSpy = nullptr;
|
||||
delete m_groupInformationDataArrivedSpy; m_groupInformationDataArrivedSpy = nullptr;
|
||||
|
||||
+1
@@ -35,6 +35,7 @@ private Q_SLOTS:
|
||||
|
||||
protected:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
private:
|
||||
ServiceManagement::ServiceInformation m_sentServiceInformationData;
|
||||
ServiceManagement::GroupInformation m_sentGroupInformationData;
|
||||
|
||||
+8
-8
@@ -36,31 +36,31 @@ bool WebSocketInterfaceHandler::init()
|
||||
{
|
||||
cleanup();
|
||||
|
||||
DEBUG_LOG() << "... ok";
|
||||
DEBUG_LOG(m_logger) << "... ok";
|
||||
|
||||
DEBUG_LOG() << "Initialising DataManager";
|
||||
DEBUG_LOG(m_logger) << "Initialising DataManager";
|
||||
m_dataManager = new DataManager(m_mainHandler);
|
||||
if (!m_dataManager->init())
|
||||
{
|
||||
ERROR_LOG() << "Failed to initialise DataManager";
|
||||
ERROR_LOG(m_logger) << "Failed to initialise DataManager";
|
||||
return false;
|
||||
}
|
||||
DEBUG_LOG() << "... ok";
|
||||
DEBUG_LOG(m_logger) << "... ok";
|
||||
|
||||
|
||||
m_messageFactory = new Messages::ClientMessageFactory(m_dataManager);
|
||||
|
||||
m_webSocketServer = new LtsWebSocket::LtsWebSocketServer(m_messageFactory, this);
|
||||
|
||||
DEBUG_LOG() << "Initialising LtsWebSocketServer";
|
||||
DEBUG_LOG(m_logger) << "Initialising LtsWebSocketServer";
|
||||
if (!m_webSocketServer->init(QStringLiteral("SCM"), NGL::Connections::port(NGL::Connections::eConnection::SCM_WEBSOCKET)))
|
||||
{
|
||||
ERROR_LOG() << "Failed to initialise LtsWebSocketServer";
|
||||
ERROR_LOG(m_logger) << "Failed to initialise LtsWebSocketServer";
|
||||
return false;
|
||||
}
|
||||
DEBUG_LOG() << "... ok";
|
||||
DEBUG_LOG(m_logger) << "... ok";
|
||||
|
||||
DEBUG_LOG() << "Connection signals and slots";
|
||||
DEBUG_LOG(m_logger) << "Connection signals and slots";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -16,14 +16,14 @@ namespace ServiceManagement
|
||||
DdsHandler::DdsHandler(int domainId)
|
||||
: m_ddsConnector(std::make_shared<DDSConnector::DdsConnector>(domainId, IDL::PartitionType::Any))
|
||||
{
|
||||
DEBUG_LOG() << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition();
|
||||
DEBUG_LOG(m_logger) << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition();
|
||||
}
|
||||
|
||||
bool DdsHandler::init(const QStringList &qosFileList)
|
||||
{
|
||||
if (!m_ddsConnector->init(qosFileList))
|
||||
{
|
||||
ERROR_LOG() << "Error initializing dds connections - aborting";
|
||||
ERROR_LOG(m_logger) << "Error initializing dds connections - aborting";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -33,11 +33,11 @@ bool DdsHandler::init(const QStringList &qosFileList)
|
||||
|
||||
m_ddsDts = ServiceManagement::Interface::Dts::create(m_ddsConnector);
|
||||
bool bRet = m_ddsDts->enableAll();
|
||||
INFO_LOG() << "initialized Dts";
|
||||
INFO_LOG(m_logger) << "initialized Dts";
|
||||
|
||||
m_ddsFts = ServiceManagement::Interface::Fts::create(m_ddsConnector);
|
||||
bRet &= m_ddsFts->enableAll();
|
||||
INFO_LOG() << "initialized Fts";
|
||||
INFO_LOG(m_logger) << "initialized Fts";
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ public:
|
||||
std::shared_ptr<ServiceManagement::Interface::Fts> fts() const;
|
||||
std::shared_ptr<DDSConnector::DdsConnector> connector() const;
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::shared_ptr<DDSConnector::DdsConnector> m_ddsConnector;
|
||||
std::shared_ptr<ServiceManagement::Interface::Dts> m_ddsDts;
|
||||
std::shared_ptr<ServiceManagement::Interface::Fts> m_ddsFts;
|
||||
|
||||
@@ -41,7 +41,7 @@ Group::Group(const std::shared_ptr<DdsHandler> &ddsHandler,
|
||||
, m_groupData(groupData)
|
||||
, m_completeCoreTimeout(0)
|
||||
{
|
||||
INFO_LOG() << "Group "
|
||||
INFO_LOG(m_logger) << "Group "
|
||||
<< m_scheme->groupType
|
||||
<< " for partition "
|
||||
<< groupData
|
||||
@@ -77,7 +77,7 @@ void Group::init()
|
||||
|
||||
bool Group::setRunningState(Core::RunningState newState)
|
||||
{
|
||||
INFO_LOG() << "Setting RunningState of group "
|
||||
INFO_LOG(m_logger) << "Setting RunningState of group "
|
||||
<< m_scheme->groupType
|
||||
<< " in exercisePartition "
|
||||
<< m_groupData.exercisePartitionId()
|
||||
@@ -109,10 +109,10 @@ void Group::startCore()
|
||||
{
|
||||
if (m_scheme->groupType != Core::ServiceGroupType::Core)
|
||||
{
|
||||
ERROR_LOG() << "startCore() was invoked on a non Core Group object";
|
||||
ERROR_LOG(m_logger) << "startCore() was invoked on a non Core Group object";
|
||||
return;
|
||||
}
|
||||
DEBUG_LOG() << "Starting Core";
|
||||
DEBUG_LOG(m_logger) << "Starting Core";
|
||||
|
||||
// make sure all services are there
|
||||
init();
|
||||
@@ -124,7 +124,7 @@ void Group::startCore()
|
||||
{
|
||||
if ( proc->prio() == m_actPrio)
|
||||
{
|
||||
DEBUG_LOG() << "startCore proc->start() "
|
||||
DEBUG_LOG(m_logger) << "startCore proc->start() "
|
||||
<< proc->serviceName()
|
||||
<< " prio=" << proc->prio()
|
||||
<< " m_actPrio=" <<m_actPrio;
|
||||
@@ -155,7 +155,7 @@ int Group::getNextPrio(QList <int> &prioList)
|
||||
void Group::start()
|
||||
{
|
||||
QList <int> prioList;
|
||||
DEBUG_LOG() << "Group::start() m_actPrio=" << m_actPrio
|
||||
DEBUG_LOG(m_logger) << "Group::start() m_actPrio=" << m_actPrio
|
||||
<< " groupId=" << m_groupId;
|
||||
// make sure all services are there
|
||||
init();
|
||||
@@ -164,7 +164,7 @@ void Group::start()
|
||||
{
|
||||
if ( !prioList.contains(proc->prio()))
|
||||
{
|
||||
DEBUG_LOG() << "prioList.append " << proc->prio()
|
||||
DEBUG_LOG(m_logger) << "prioList.append " << proc->prio()
|
||||
<< " m_actPrio=" << m_actPrio
|
||||
<< " groupId=" << m_groupId;
|
||||
prioList.append(proc->prio());
|
||||
@@ -180,7 +180,7 @@ void Group::start()
|
||||
{
|
||||
if ( m_actPrio == proc->prio())
|
||||
{
|
||||
DEBUG_LOG() << "Group::start(): proc->start() "
|
||||
DEBUG_LOG(m_logger) << "Group::start(): proc->start() "
|
||||
<< proc->serviceName()
|
||||
<< " prio=" << proc->prio()
|
||||
<< " m_actPrio=" << m_actPrio
|
||||
@@ -280,7 +280,7 @@ void Group::onNewServiceInfo()
|
||||
m_groupData.replayPartitionId(),
|
||||
serviceIds);
|
||||
|
||||
TRACE_LOG() << "Publishing new GroupInformation: " << info;
|
||||
TRACE_LOG(m_logger) << "Publishing new GroupInformation: " << info;
|
||||
|
||||
m_ddsHandler->dts()->publish(info);
|
||||
}
|
||||
@@ -290,7 +290,7 @@ void Group::onCompleteCoreTick()
|
||||
QList <int> prioList;
|
||||
if (QDateTime::currentMSecsSinceEpoch() > m_completeCoreTimeout)
|
||||
{
|
||||
ERROR_LOG() << "Could not start group Core, because no Heartbeat for EXM with RunningState 'Running' was received.";
|
||||
ERROR_LOG(m_logger) << "Could not start group Core, because no Heartbeat for EXM with RunningState 'Running' was received.";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -307,7 +307,7 @@ void Group::onCompleteCoreTick()
|
||||
}
|
||||
if (exmProc == nullptr)
|
||||
{
|
||||
ERROR_LOG() << "Could not find Process for EXM";
|
||||
ERROR_LOG(m_logger) << "Could not find Process for EXM";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -319,7 +319,7 @@ void Group::onCompleteCoreTick()
|
||||
{
|
||||
if ( !prioList.contains(proc->prio()))
|
||||
{
|
||||
DEBUG_LOG() << "prioList.append " << proc->prio()
|
||||
DEBUG_LOG(m_logger) << "prioList.append " << proc->prio()
|
||||
<< " m_actPrio=" << m_actPrio
|
||||
<< " groupId=" << m_groupId;
|
||||
prioList.append(proc->prio());
|
||||
@@ -331,7 +331,7 @@ void Group::onCompleteCoreTick()
|
||||
{
|
||||
if (proc->state() != QProcess::Running && proc->prio() == m_actPrio)
|
||||
{
|
||||
DEBUG_LOG() << "onCompleteCoreTick proc->start() "
|
||||
DEBUG_LOG(m_logger) << "onCompleteCoreTick proc->start() "
|
||||
<< proc->serviceName()
|
||||
<< " prio=" << proc->prio();
|
||||
proc->start();
|
||||
@@ -345,7 +345,7 @@ void Group::onCompleteCoreTick()
|
||||
return;
|
||||
}
|
||||
else
|
||||
DEBUG_LOG() << "EXM has runningState " << exmProc->runningState();
|
||||
DEBUG_LOG(m_logger) << "EXM has runningState " << exmProc->runningState();
|
||||
// start next completion attemp
|
||||
QTimer::singleShot(1000, this, &Group::onCompleteCoreTick);
|
||||
}
|
||||
@@ -357,7 +357,7 @@ ServiceProcess *Group::procFromPid(Q_PID pid)
|
||||
if (proc->pid() == pid)
|
||||
return proc;
|
||||
}
|
||||
DEBUG_LOG() << "Searched for not existing process with PID "
|
||||
DEBUG_LOG(m_logger) << "Searched for not existing process with PID "
|
||||
<< pid;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -40,15 +40,15 @@ GroupHandler::~GroupHandler()
|
||||
|
||||
bool GroupHandler::init(int32_t coreDomain)
|
||||
{
|
||||
DEBUG_LOG() << "Initializing GroupHandler ...";
|
||||
DEBUG_LOG(m_logger) << "Initializing GroupHandler ...";
|
||||
|
||||
bool bAllPartsInitialized = m_heartbeatListener->init() &&
|
||||
startGroupCore(coreDomain);
|
||||
|
||||
if (bAllPartsInitialized)
|
||||
DEBUG_LOG() << "GroupHandler successfully initialized.";
|
||||
DEBUG_LOG(m_logger) << "GroupHandler successfully initialized.";
|
||||
else
|
||||
ERROR_LOG() << "GroupHandler initialization failed.";
|
||||
ERROR_LOG(m_logger) << "GroupHandler initialization failed.";
|
||||
|
||||
return bAllPartsInitialized;
|
||||
}
|
||||
@@ -137,14 +137,14 @@ bool GroupHandler::startGroupCore(int32_t domainId)
|
||||
{
|
||||
if (domainId != m_ddsHandler->connector()->getDomainId())
|
||||
{
|
||||
ERROR_LOG() << "Could not start group Core for domain "
|
||||
ERROR_LOG(m_logger) << "Could not start group Core for domain "
|
||||
<< domainId
|
||||
<< ", this ServiceManagement instance only supports domain "
|
||||
<< m_ddsHandler->connector()->getDomainId();
|
||||
return false;
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "Starting core group ...";
|
||||
DEBUG_LOG(m_logger) << "Starting core group ...";
|
||||
|
||||
GroupRequest groupToSearch;
|
||||
groupToSearch.type(Core::ServiceGroupType::Core);
|
||||
@@ -157,7 +157,7 @@ bool GroupHandler::startGroupCore(int32_t domainId)
|
||||
|
||||
if (coreScheme == nullptr)
|
||||
{
|
||||
ERROR_LOG() << "Could not start core group because there are no services linked to it";
|
||||
ERROR_LOG(m_logger) << "Could not start core group because there are no services linked to it";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ void GroupHandler::onStartGroupRequest(const rti::core::SampleIdentity &cookie,
|
||||
{
|
||||
auto ret = onStartGroup(request);
|
||||
if (ret.error())
|
||||
WARNING_LOG() << ret();
|
||||
WARNING_LOG(m_logger) << ret();
|
||||
m_ddsHandler->fts()->startGroupReply(cookie, ret);
|
||||
}
|
||||
|
||||
@@ -182,13 +182,13 @@ void GroupHandler::slotStartGroupRequest(const GroupRequest &request)
|
||||
{
|
||||
auto ret = onStartGroup(request);
|
||||
if (ret.error())
|
||||
WARNING_LOG() << ret();
|
||||
WARNING_LOG(m_logger) << ret();
|
||||
emit startGroupReply(ret);
|
||||
}
|
||||
|
||||
Core::FunctionReplyObject GroupHandler::onStartGroup(const GroupRequest &request)
|
||||
{
|
||||
DEBUG_LOG() << "New StartGroupRequest: " << request;
|
||||
DEBUG_LOG(m_logger) << "New StartGroupRequest: " << request;
|
||||
|
||||
if (request.domainId() != m_ddsHandler->connector()->getDomainId())
|
||||
return Core::FunctionReplyObject(request.requestId(),
|
||||
@@ -219,7 +219,7 @@ Core::FunctionReplyObject GroupHandler::onStartGroup(const GroupRequest &request
|
||||
// if there is a similar group, we should take the services from there (to avoid restarting services on exeuction -> pause or pause -> resume)
|
||||
if (similarGroup)
|
||||
{
|
||||
DEBUG_LOG() << "Taking existing services from group " << similarGroup->type()
|
||||
DEBUG_LOG(m_logger) << "Taking existing services from group " << similarGroup->type()
|
||||
<< " to " << existingGroup->type();
|
||||
existingGroup->takeServicesFromGroup(similarGroup);
|
||||
similarGroup->stop();
|
||||
@@ -235,7 +235,7 @@ Core::FunctionReplyObject GroupHandler::onStartGroup(const GroupRequest &request
|
||||
|
||||
Core::FunctionReplyObject GroupHandler::onStopAllForExercise(int domainId, int exercisePartitionId)
|
||||
{
|
||||
DEBUG_LOG() << "Stopping all proces for domain " << domainId << ", partition " << exercisePartitionId;
|
||||
DEBUG_LOG(m_logger) << "Stopping all proces for domain " << domainId << ", partition " << exercisePartitionId;
|
||||
QVector<Group *> stillAliveGroups;
|
||||
|
||||
int cntStopped = 0;
|
||||
@@ -257,7 +257,7 @@ Core::FunctionReplyObject GroupHandler::onStopAllForExercise(int domainId, int e
|
||||
}
|
||||
|
||||
m_groups = stillAliveGroups;
|
||||
DEBUG_LOG() << "Stopping all proces for domain " << domainId << ", partition " << exercisePartitionId
|
||||
DEBUG_LOG(m_logger) << "Stopping all proces for domain " << domainId << ", partition " << exercisePartitionId
|
||||
<< " - done. Stopped " << cntStopped << " groups"
|
||||
<< ", still alive: " << cntAlive;
|
||||
return Core::FunctionReplyObject(exercisePartitionId);
|
||||
@@ -267,7 +267,7 @@ void GroupHandler::onStopGroupRequest(const rti::core::SampleIdentity &cookie, c
|
||||
{
|
||||
auto ret = onStopGroup(request);
|
||||
if (ret.error())
|
||||
WARNING_LOG() << ret();
|
||||
WARNING_LOG(m_logger) << ret();
|
||||
m_ddsHandler->fts()->stopGroupReply(cookie, ret);
|
||||
}
|
||||
|
||||
@@ -275,13 +275,13 @@ void GroupHandler::slotStopGroupRequest(const GroupRequest &request)
|
||||
{
|
||||
auto ret = onStopGroup(request);
|
||||
if (ret.error())
|
||||
WARNING_LOG() << ret();
|
||||
WARNING_LOG(m_logger) << ret();
|
||||
emit stopGroupReply(ret);
|
||||
}
|
||||
|
||||
Core::FunctionReplyObject GroupHandler::onStopGroup(const GroupRequest &request)
|
||||
{
|
||||
DEBUG_LOG() << "New StopGroupRequest: " << request;
|
||||
DEBUG_LOG(m_logger) << "New StopGroupRequest: " << request;
|
||||
|
||||
Group *existingGroup = getGroup(request);
|
||||
|
||||
@@ -303,13 +303,13 @@ void GroupHandler::onRestartGroupRequest(const rti::core::SampleIdentity &cookie
|
||||
{
|
||||
auto ret = onRestartGroup(request);
|
||||
if (ret.error())
|
||||
WARNING_LOG() << ret();
|
||||
WARNING_LOG(m_logger) << ret();
|
||||
m_ddsHandler->fts()->restartGroupReply(cookie, ret);
|
||||
}
|
||||
|
||||
Core::FunctionReplyObject GroupHandler::onRestartGroup(const GroupRequest &request)
|
||||
{
|
||||
DEBUG_LOG() << "New RestartGroupRequest: " << request;
|
||||
DEBUG_LOG(m_logger) << "New RestartGroupRequest: " << request;
|
||||
|
||||
Group *existingGroup = getGroup(request);
|
||||
|
||||
|
||||
+5
-6
@@ -9,10 +9,9 @@
|
||||
#include "heartbeat_listener.h"
|
||||
#include "service_donator.h"
|
||||
|
||||
ServiceManagement::HeartbeatListener::HeartbeatListener(const std::shared_ptr<DDSConnector::DdsConnector> &connector, const std::shared_ptr<ServiceDonator> &serviceDonator)
|
||||
: m_ddsConnector(connector)
|
||||
, m_serviceDonator(serviceDonator)
|
||||
{}
|
||||
ServiceManagement::HeartbeatListener::HeartbeatListener(const std::shared_ptr<DDSConnector::DdsConnector> &connector, const std::shared_ptr<ServiceDonator> &serviceDonator) : m_ddsConnector(connector)
|
||||
, m_serviceDonator(serviceDonator),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {}
|
||||
|
||||
ServiceManagement::HeartbeatListener::~HeartbeatListener()
|
||||
{}
|
||||
@@ -25,7 +24,7 @@ bool ServiceManagement::HeartbeatListener::init()
|
||||
|
||||
if (!m_coreDtc->enableCurrentRunningState())
|
||||
{
|
||||
ERROR_LOG() << "Core DTC for HeartbeatListener in domain " << m_ddsConnector->getDomainId()
|
||||
ERROR_LOG(m_logger) << "Core DTC for HeartbeatListener in domain " << m_ddsConnector->getDomainId()
|
||||
<< " could not be initialized.";
|
||||
m_coreDtc.reset();
|
||||
return false;
|
||||
@@ -34,7 +33,7 @@ bool ServiceManagement::HeartbeatListener::init()
|
||||
QObject::connect(m_coreDtc.get(), &Core::Interface::Dtc::currentRunningStateChanged,
|
||||
m_serviceDonator.get(), &ServiceDonator::onNewServiceInfoFromDds);
|
||||
|
||||
DEBUG_LOG() << "HeartbeatListener for domain " << m_ddsConnector->getDomainId()
|
||||
DEBUG_LOG(m_logger) << "HeartbeatListener for domain " << m_ddsConnector->getDomainId()
|
||||
<< " successfully initialized.";
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ LicenceHandler::LicenceHandler(const std::shared_ptr<DdsHandler> &ddsHandler, co
|
||||
, m_ddsHandler(ddsHandler)
|
||||
, m_xmlFileName(licenceFile)
|
||||
{
|
||||
INFO_LOG() << "Start ServiceManagement LicenceHandler. Filename: " << m_xmlFileName;
|
||||
INFO_LOG(m_logger) << "Start ServiceManagement LicenceHandler. Filename: " << m_xmlFileName;
|
||||
} // end of ctor()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -35,12 +35,12 @@ LicenceHandler::~LicenceHandler()
|
||||
|
||||
bool LicenceHandler::init()
|
||||
{
|
||||
INFO_LOG() << "init() Start ServiceManagement LicenceHandler.";
|
||||
INFO_LOG(m_logger) << "init() Start ServiceManagement LicenceHandler.";
|
||||
|
||||
// read all licences from licencefile
|
||||
if (!readLicenceFile())
|
||||
{
|
||||
ERROR_LOG() << "Error reading data from licencefile!";
|
||||
ERROR_LOG(m_logger) << "Error reading data from licencefile!";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ bool LicenceHandler::isServiceLicensed(const QString &licenceName) const
|
||||
void LicenceHandler::onGetLicenceRequest(const rti::core::SampleIdentity &cookie,
|
||||
const LicenceRequest &request)
|
||||
{
|
||||
INFO_LOG() << "Try to getLicence (from DDS) for '" << request.name() << "' ...";
|
||||
INFO_LOG(m_logger) << "Try to getLicence (from DDS) for '" << request.name() << "' ...";
|
||||
|
||||
Core::FunctionReplyObject ret = getLicenceInternal(QString::fromStdString(request.name()));
|
||||
m_ddsHandler->fts()->getLicenceReply(cookie, ret);
|
||||
@@ -76,7 +76,7 @@ void LicenceHandler::onGetLicenceRequest(const rti::core::SampleIdentity &cookie
|
||||
void LicenceHandler::onFreeLicenceRequest(const rti::core::SampleIdentity &cookie,
|
||||
const LicenceRequest &request)
|
||||
{
|
||||
INFO_LOG() << "Try to freeLicence (from DDS) for '" << request.name() << "' ...";
|
||||
INFO_LOG(m_logger) << "Try to freeLicence (from DDS) for '" << request.name() << "' ...";
|
||||
|
||||
Core::FunctionReplyObject ret = freeLicenceInternal(QString::fromStdString(request.name()));
|
||||
m_ddsHandler->fts()->freeLicenceReply(cookie, ret);
|
||||
@@ -87,12 +87,12 @@ void LicenceHandler::onFreeLicenceRequest(const rti::core::SampleIdentity &cooki
|
||||
|
||||
bool LicenceHandler::getLicence(const QString &licenceName)
|
||||
{
|
||||
INFO_LOG() << "Try to getLicence (from SCM) for '" << licenceName << "' ...";
|
||||
INFO_LOG(m_logger) << "Try to getLicence (from SCM) for '" << licenceName << "' ...";
|
||||
|
||||
Core::FunctionReplyObject fro = getLicenceInternal(licenceName);
|
||||
|
||||
if (fro.error())
|
||||
INFO_LOG() << "getLicence() errorText: " << fro.translated();
|
||||
INFO_LOG(m_logger) << "getLicence() errorText: " << fro.translated();
|
||||
|
||||
return !fro.error();
|
||||
} // end of getLicence()
|
||||
@@ -100,12 +100,12 @@ bool LicenceHandler::getLicence(const QString &licenceName)
|
||||
|
||||
bool LicenceHandler::freeLicence(const QString &licenceName)
|
||||
{
|
||||
INFO_LOG() << "Try to freeLicence (from SCM) for '" << licenceName << "' ...";
|
||||
INFO_LOG(m_logger) << "Try to freeLicence (from SCM) for '" << licenceName << "' ...";
|
||||
|
||||
Core::FunctionReplyObject fro = freeLicenceInternal(licenceName);
|
||||
|
||||
if (fro.error())
|
||||
INFO_LOG() << "freeLicence() errorText: " << fro.translated();
|
||||
INFO_LOG(m_logger) << "freeLicence() errorText: " << fro.translated();
|
||||
|
||||
return !fro.error();
|
||||
} // end of freeLicence()
|
||||
@@ -116,13 +116,13 @@ bool LicenceHandler::readLicenceFile()
|
||||
QFile f(m_xmlFileName);
|
||||
if (!f.exists())
|
||||
{
|
||||
ERROR_LOG() << "Error loading licencefile ... file not found. '" << m_xmlFileName << "'";
|
||||
ERROR_LOG(m_logger) << "Error loading licencefile ... file not found. '" << m_xmlFileName << "'";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!f.open(QIODevice::ReadOnly))
|
||||
{
|
||||
ERROR_LOG() << "Error loading licencefile ... file open failed.'" << m_xmlFileName << "'";
|
||||
ERROR_LOG(m_logger) << "Error loading licencefile ... file open failed.'" << m_xmlFileName << "'";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -131,20 +131,20 @@ bool LicenceHandler::readLicenceFile()
|
||||
if (m_xmlFileName.endsWith(QLatin1String(".crl")))
|
||||
{
|
||||
qbaIn = LtsLicence::decryptData(qbaIn);
|
||||
INFO_LOG() << "ReadAll() from encrypted licencefile ... bytesAvailable:" << qbaIn.size();
|
||||
INFO_LOG(m_logger) << "ReadAll() from encrypted licencefile ... bytesAvailable:" << qbaIn.size();
|
||||
}
|
||||
else if (m_xmlFileName.endsWith(QLatin1String(".lic")))
|
||||
INFO_LOG() << "ReadAll() from unencrypted licencefile ... bytesAvailable:" << qbaIn.size();
|
||||
INFO_LOG(m_logger) << "ReadAll() from unencrypted licencefile ... bytesAvailable:" << qbaIn.size();
|
||||
|
||||
f.close();
|
||||
|
||||
INFO_LOG() << "Try to parse xml file '" << m_xmlFileName << "'";
|
||||
INFO_LOG(m_logger) << "Try to parse xml file '" << m_xmlFileName << "'";
|
||||
|
||||
m_licenceVec = LtsLicence::readLicences(qbaIn);
|
||||
|
||||
if (m_licenceVec.isEmpty())
|
||||
{
|
||||
ERROR_LOG() << "Parse error reading xml file '" << m_xmlFileName << "'";
|
||||
ERROR_LOG(m_logger) << "Parse error reading xml file '" << m_xmlFileName << "'";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -169,7 +169,7 @@ Core::FunctionReplyObject LicenceHandler::getLicenceInternal(const QString &lice
|
||||
{
|
||||
if (licence.maxCount <= licence.licenceRefCount)
|
||||
{
|
||||
WARNING_LOG() << "getLicence() for '" << licence.name << "' failed. - No more licences available.";
|
||||
WARNING_LOG(m_logger) << "getLicence() for '" << licence.name << "' failed. - No more licences available.";
|
||||
return Core::FunctionReplyObject(0, "No more licences available.");
|
||||
}
|
||||
else
|
||||
@@ -183,14 +183,14 @@ Core::FunctionReplyObject LicenceHandler::getLicenceInternal(const QString &lice
|
||||
if (m_logger.isInfoEnabled())
|
||||
{
|
||||
const QString info = dumpLicenceInformation(licence);
|
||||
INFO_LOG() << "getLicence() for '" << licenceName << "' ok.\n" << info;
|
||||
INFO_LOG(m_logger) << "getLicence() for '" << licenceName << "' ok.\n" << info;
|
||||
}
|
||||
publishData(licence);
|
||||
return Core::FunctionReplyObject(i + 1); // id im FRO >0 ; - m_licenceVec beginnt bei [0]
|
||||
}
|
||||
}
|
||||
|
||||
ERROR_LOG() << "getLicence() for '" << licenceName << "' failed. - No licence with this name.";
|
||||
ERROR_LOG(m_logger) << "getLicence() for '" << licenceName << "' failed. - No licence with this name.";
|
||||
return Core::FunctionReplyObject(0, "No licence with this name.");
|
||||
} // end of getLicenceInternal()
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -213,7 +213,7 @@ Core::FunctionReplyObject LicenceHandler::freeLicenceInternal(const QString &lic
|
||||
{
|
||||
if (licence.licenceRefCount <= 0)
|
||||
{
|
||||
WARNING_LOG() << "freeLicence() for '" << licence.name << "' failed. - Max number of licences are free.";
|
||||
WARNING_LOG(m_logger) << "freeLicence() for '" << licence.name << "' failed. - Max number of licences are free.";
|
||||
return Core::FunctionReplyObject(0, "Max number of licences are free.");
|
||||
}
|
||||
else
|
||||
@@ -230,14 +230,14 @@ Core::FunctionReplyObject LicenceHandler::freeLicenceInternal(const QString &lic
|
||||
if (m_logger.isInfoEnabled())
|
||||
{
|
||||
const QString info = dumpLicenceInformation(licence);
|
||||
INFO_LOG() << "freeLicence() for '" << licenceName << "' ok.\n" << info;
|
||||
INFO_LOG(m_logger) << "freeLicence() for '" << licenceName << "' ok.\n" << info;
|
||||
}
|
||||
publishData(licence);
|
||||
return Core::FunctionReplyObject(i + 1); // id im FRO >0 ; - m_licenceVec beginnt bei [0]
|
||||
}
|
||||
}
|
||||
|
||||
ERROR_LOG() << "freeLicence() for '" << licenceName << "' failed. - No licence with this name.";
|
||||
ERROR_LOG(m_logger) << "freeLicence() for '" << licenceName << "' failed. - No licence with this name.";
|
||||
return Core::FunctionReplyObject(0, "No licence with this name.");
|
||||
}// end of freeLicence()
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -251,13 +251,13 @@ bool LicenceHandler::isLicenceValid(const LtsLicence::Licence &licence) const
|
||||
{
|
||||
if (!licence.ignoreExpiration)
|
||||
{
|
||||
INFO_LOG() << "Licence '" << licence.name << "' is valid for " << now.daysTo(end) << " days."
|
||||
INFO_LOG(m_logger) << "Licence '" << licence.name << "' is valid for " << now.daysTo(end) << " days."
|
||||
<< " Expiration: " << licence.expiration.date().toString()
|
||||
<< " " << licence.expiration.time().toString();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
WARNING_LOG() << "Licence '" << licence.name << "' is expired since " << end.daysTo(now) << " days."
|
||||
WARNING_LOG(m_logger) << "Licence '" << licence.name << "' is expired since " << end.daysTo(now) << " days."
|
||||
<< " Expiration: " << licence.expiration.date().toString()
|
||||
<< " " << licence.expiration.time().toString();
|
||||
return false;
|
||||
@@ -309,10 +309,10 @@ void LicenceHandler::publishAllData()
|
||||
|
||||
void LicenceHandler::publishData(const LtsLicence::Licence &data)
|
||||
{
|
||||
INFO_LOG() << "Publish '" << data.name << "' Licence-data to dds";
|
||||
INFO_LOG(m_logger) << "Publish '" << data.name << "' Licence-data to dds";
|
||||
|
||||
if (!m_ddsHandler->dts()->publish(toDdsData(data)))
|
||||
ERROR_LOG() << "Error publishing '" << data.name << "' Licence-data to dds";
|
||||
ERROR_LOG(m_logger) << "Error publishing '" << data.name << "' Licence-data to dds";
|
||||
|
||||
} // end of publishData()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -45,6 +45,8 @@ public:
|
||||
bool freeLicence(const QString &licenceName) override;
|
||||
|
||||
private: // Methoden
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
bool readLicenceFile();
|
||||
|
||||
Core::FunctionReplyObject getLicenceInternal(const QString &licenceName);
|
||||
|
||||
@@ -24,14 +24,13 @@
|
||||
namespace ServiceManagement
|
||||
{
|
||||
|
||||
MainHandler::MainHandler(QObject *parent)
|
||||
: QObject(parent)
|
||||
MainHandler::MainHandler(QObject *parent) : QObject(parent)
|
||||
, m_ddsHandler(nullptr)
|
||||
, m_groupHandler(nullptr)
|
||||
, m_licenceHandler(nullptr)
|
||||
, m_serviceHandler(nullptr)
|
||||
, m_websocketHandler(nullptr)
|
||||
{
|
||||
, m_websocketHandler(nullptr),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
|
||||
QtSingleCoreApplication *sa = qobject_cast<QtSingleCoreApplication*>(QCoreApplication::instance());
|
||||
Q_ASSERT(sa);
|
||||
connect(sa, &QtSingleCoreApplication::messageReceived,
|
||||
@@ -49,18 +48,18 @@ MainHandler::~MainHandler()
|
||||
|
||||
bool MainHandler::init(int domainId, const QString &licenceFile)
|
||||
{
|
||||
DEBUG_LOG() << "Initializing MainHandler ...";
|
||||
DEBUG_LOG(m_logger) << "Initializing MainHandler ...";
|
||||
|
||||
m_ddsHandler = std::make_shared<DdsHandler>(domainId);
|
||||
bool bAllPartsInitialized = m_ddsHandler->init();
|
||||
|
||||
ERROR_LOG() << "Searching for licence file: " << licenceFile;
|
||||
ERROR_LOG(m_logger) << "Searching for licence file: " << licenceFile;
|
||||
QString licenceFileName = NGL::findFile(NGL::FileType::ConfigFile, licenceFile);
|
||||
|
||||
m_licenceHandler = std::make_shared<LicenceHandler>(m_ddsHandler, licenceFileName);
|
||||
if (!m_licenceHandler->init())
|
||||
{
|
||||
ERROR_LOG() << "Initialisation LicenceHandler failed.";
|
||||
ERROR_LOG(m_logger) << "Initialisation LicenceHandler failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -78,15 +77,15 @@ bool MainHandler::init(int domainId, const QString &licenceFile)
|
||||
m_websocketHandler = std::make_shared<WebSocketInterface::WebSocketInterfaceHandler>(this);
|
||||
if (!m_websocketHandler->init())
|
||||
{
|
||||
ERROR_LOG() << "Initialisation WebSocketInterfaceHandler failed.";
|
||||
ERROR_LOG(m_logger) << "Initialisation WebSocketInterfaceHandler failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "MainHandler successfully initialized :)";
|
||||
DEBUG_LOG(m_logger) << "MainHandler successfully initialized :)";
|
||||
}
|
||||
else
|
||||
{
|
||||
ERROR_LOG() << "MainHandler initialization failed";
|
||||
ERROR_LOG(m_logger) << "MainHandler initialization failed";
|
||||
}
|
||||
|
||||
return bAllPartsInitialized;
|
||||
@@ -101,7 +100,7 @@ bool MainHandler::readServices()
|
||||
{
|
||||
CodeGen::XmlReader xmlReader;
|
||||
const QString xmlPath = NGL::directory(NGL::FileType::ConfigFile, QLatin1String("xml"));
|
||||
DEBUG_LOG() << "Using xml path " << xmlPath;
|
||||
DEBUG_LOG(m_logger) << "Using xml path " << xmlPath;
|
||||
QDirIterator directoryIterator(xmlPath);
|
||||
int serviceCount = 0;
|
||||
|
||||
@@ -131,7 +130,7 @@ bool MainHandler::readServices()
|
||||
|
||||
if (serviceName.isEmpty() || exeName.length() < 4 || groupNames.isEmpty())
|
||||
{
|
||||
INFO_LOG() << currentFileName
|
||||
INFO_LOG(m_logger) << currentFileName
|
||||
<< " does not include complete service information.";
|
||||
}
|
||||
else
|
||||
@@ -144,7 +143,7 @@ bool MainHandler::readServices()
|
||||
const int prioService = xmlReader.getPrio();
|
||||
if (bDevMode)
|
||||
{
|
||||
WARNING_LOG() << "Developer mode for service " << serviceName
|
||||
WARNING_LOG(m_logger) << "Developer mode for service " << serviceName
|
||||
<< " activated - no automatic restart on crash!";
|
||||
}
|
||||
Service *newService = new Service(serviceName,
|
||||
@@ -156,7 +155,7 @@ bool MainHandler::readServices()
|
||||
prioService);
|
||||
m_serviceHandler->addService(newService);
|
||||
|
||||
DEBUG_LOG() << "Added new service \""
|
||||
DEBUG_LOG(m_logger) << "Added new service \""
|
||||
<< serviceName
|
||||
<< "\""
|
||||
<< " prio=" << prioService;
|
||||
@@ -165,7 +164,7 @@ bool MainHandler::readServices()
|
||||
{
|
||||
if (groupNameMapping.contains(groupName))
|
||||
{
|
||||
DEBUG_LOG() << " --> Linking to group \""
|
||||
DEBUG_LOG(m_logger) << " --> Linking to group \""
|
||||
<< groupName
|
||||
<< "\"";
|
||||
if (serviceName == QStringLiteral("ReportAnalyzer") && (groupName == QStringLiteral("ExercisePaused") || groupName == QStringLiteral("ExerciseAfterActionReview")))
|
||||
@@ -174,7 +173,7 @@ bool MainHandler::readServices()
|
||||
m_groupHandler->addServiceLink(newService->id(), groupNameMapping.value(groupName));
|
||||
}
|
||||
else
|
||||
INFO_LOG() << "Found unknown group name: " << groupName;
|
||||
INFO_LOG(m_logger) << "Found unknown group name: " << groupName;
|
||||
}
|
||||
++ serviceCount;
|
||||
}
|
||||
@@ -188,7 +187,7 @@ bool MainHandler::readServices()
|
||||
|
||||
if (serviceCount)
|
||||
return true;
|
||||
ERROR_LOG() << "Could not find any valid service in directory " << xmlPath;
|
||||
ERROR_LOG(m_logger) << "Could not find any valid service in directory " << xmlPath;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -115,13 +115,13 @@ void ServiceManagement::Service::waitForStopped()
|
||||
|
||||
void ServiceManagement::Service::onServiceProcessDestroyed(QObject *obj)
|
||||
{
|
||||
DEBUG_LOG() << "onServiceProcessDestroyed: " << obj;
|
||||
DEBUG_LOG(m_logger) << "onServiceProcessDestroyed: " << obj;
|
||||
ServiceProcess *sp = static_cast<ServiceProcess*>(obj);
|
||||
for (int i = 0; i < m_procs.size(); ++i)
|
||||
{
|
||||
if (m_procs.at(i) == sp)
|
||||
{
|
||||
DEBUG_LOG() << "Found... - removing";
|
||||
DEBUG_LOG(m_logger) << "Found... - removing";
|
||||
m_procs.remove(i);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -39,17 +39,17 @@ ServiceManagement::ServiceHandler::~ServiceHandler()
|
||||
|
||||
bool ServiceManagement::ServiceHandler::init()
|
||||
{
|
||||
DEBUG_LOG() << "Initializing ServiceHandler ...";
|
||||
DEBUG_LOG(m_logger) << "Initializing ServiceHandler ...";
|
||||
|
||||
connect(m_heartBeatObserverTimer, &QTimer::timeout,
|
||||
this, &ServiceHandler::onHeartBeatObserverTimerTimeout);
|
||||
|
||||
|
||||
HEARTBEAT_OBSERVER_INTERVAL = Settings::observerIntervall();
|
||||
DEBUG_LOG() << HEARTBEAT_OBSERVER_INTERVAL;
|
||||
DEBUG_LOG(m_logger) << HEARTBEAT_OBSERVER_INTERVAL;
|
||||
m_heartBeatObserverTimer->start(HEARTBEAT_OBSERVER_INTERVAL);
|
||||
|
||||
DEBUG_LOG() << "ServiceHandler successfully initialized.";
|
||||
DEBUG_LOG(m_logger) << "ServiceHandler successfully initialized.";
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -78,21 +78,21 @@ ServiceManagement::ServiceProcess *ServiceManagement::ServiceHandler::getProcess
|
||||
void ServiceManagement::ServiceHandler::onRestartServiceRequest(const rti::core::SampleIdentity &cookie,
|
||||
const RestartServiceRequest &request)
|
||||
{
|
||||
DEBUG_LOG() << "onRestartServiceRequest " << request;
|
||||
DEBUG_LOG(m_logger) << "onRestartServiceRequest " << request;
|
||||
|
||||
ServiceProcess *proc = serviceProcessFromServiceProcId(request.id());
|
||||
|
||||
Core::FunctionReplyObject ret(request.id());
|
||||
if (proc == nullptr)
|
||||
{
|
||||
INFO_LOG() << "Got restart request for non existing service ID "
|
||||
INFO_LOG(m_logger) << "Got restart request for non existing service ID "
|
||||
<< request.id();
|
||||
ret.setStr(tr_lts("dds", "There is no ServiceProcess with id %1")).arg(request.id());
|
||||
m_ddsHandler->fts()->restartServiceReply(cookie, ret);
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "Restart request for service "
|
||||
DEBUG_LOG(m_logger) << "Restart request for service "
|
||||
<< proc->serviceName()
|
||||
<< ", domain "
|
||||
<< proc->domainId()
|
||||
@@ -108,7 +108,7 @@ void ServiceManagement::ServiceHandler::onRestartServiceRequest(const rti::core:
|
||||
|
||||
void ServiceManagement::ServiceHandler::stopAllServices()
|
||||
{
|
||||
INFO_LOG() << "Stopping all Services ...";
|
||||
INFO_LOG(m_logger) << "Stopping all Services ...";
|
||||
|
||||
// shutdown async
|
||||
for (Service *service : std::as_const(m_services))
|
||||
@@ -116,12 +116,12 @@ void ServiceManagement::ServiceHandler::stopAllServices()
|
||||
for (Service *service : std::as_const(m_services))
|
||||
service->waitForStopped();
|
||||
|
||||
INFO_LOG() << "... all Services stopped :)";
|
||||
INFO_LOG(m_logger) << "... all Services stopped :)";
|
||||
}
|
||||
|
||||
void ServiceManagement::ServiceHandler::onNewServiceInfoFromProc(const ServiceInformation &info)
|
||||
{
|
||||
TRACE_LOG() << "Publishing new ServiceInformation: " << info;
|
||||
TRACE_LOG(m_logger) << "Publishing new ServiceInformation: " << info;
|
||||
|
||||
m_ddsHandler->dts()->publish(info);
|
||||
|
||||
@@ -133,11 +133,11 @@ void ServiceManagement::ServiceHandler::onNewServiceInfoFromDds(const Core::Curr
|
||||
if (type == DataModification::eRemoved)
|
||||
return;
|
||||
|
||||
TRACE_LOG() << "Got new CurrentRunningState: " << data;
|
||||
TRACE_LOG(m_logger) << "Got new CurrentRunningState: " << data;
|
||||
|
||||
if (!data.pid())
|
||||
{
|
||||
INFO_LOG() << "PID 0 is not allowed.";
|
||||
INFO_LOG(m_logger) << "PID 0 is not allowed.";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ void ServiceManagement::ServiceHandler::onNewServiceInfoFromDds(const Core::Curr
|
||||
{
|
||||
if (currentProc->remotePid() == data.pid())
|
||||
{
|
||||
DEBUG_LOG() << "Found my prog " << data.pid() << " to "<< currentProc->pid() << " " << currentProc->serviceName();
|
||||
DEBUG_LOG(m_logger) << "Found my prog " << data.pid() << " to "<< currentProc->pid() << " " << currentProc->serviceName();
|
||||
proc = currentProc;
|
||||
retData.pid() = proc->processId();
|
||||
found = true;
|
||||
@@ -170,7 +170,7 @@ void ServiceManagement::ServiceHandler::onNewServiceInfoFromDds(const Core::Curr
|
||||
{
|
||||
if (!m_unknownPidsWarned.contains(data.pid()))
|
||||
{
|
||||
ERROR_LOG() << "Got CurrentRunningState for non existing process with PID "
|
||||
ERROR_LOG(m_logger) << "Got CurrentRunningState for non existing process with PID "
|
||||
<< data.pid();
|
||||
m_unknownPidsWarned += data.pid();
|
||||
}
|
||||
@@ -238,7 +238,7 @@ void ServiceManagement::ServiceHandler::onHeartBeatObserverTimerTimeout()
|
||||
|
||||
if (currentProc->lastHeartbeatMSec() < minAge)
|
||||
{
|
||||
WARNING_LOG() << "Heartbeat TIMEOUT for " << currentProc->debugInfo()
|
||||
WARNING_LOG(m_logger) << "Heartbeat TIMEOUT for " << currentProc->debugInfo()
|
||||
<< " - Restarting ..."
|
||||
<< " min heartbeat age: " << QDateTime::fromMSecsSinceEpoch(minHeartbeatAge).toString(QStringLiteral("HH:mm:ss"));
|
||||
currentProc->addStartAttempt();
|
||||
|
||||
@@ -52,6 +52,8 @@ private Q_SLOTS:
|
||||
void onHeartBeatObserverTimerTimeout();
|
||||
|
||||
private: // methods
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
Service *serviceFromId(int id);
|
||||
ServiceProcess *serviceProcessFromPid(qint64 pid);
|
||||
ServiceProcess *serviceProcessFromServiceProcId(int32_t id);
|
||||
|
||||
@@ -17,8 +17,7 @@
|
||||
|
||||
int ServiceManagement::ServiceProcess::s_serviceProcessIdCounter = 0;
|
||||
|
||||
ServiceManagement::ServiceProcess::ServiceProcess(const GroupRequest &groupData, ServiceManagement::Service *parentService)
|
||||
: QProcess(parentService)
|
||||
ServiceManagement::ServiceProcess::ServiceProcess(const GroupRequest &groupData, ServiceManagement::Service *parentService) : QProcess(parentService)
|
||||
, m_serviceId(parentService->id())
|
||||
, m_serviceProcessId(s_serviceProcessIdCounter++)
|
||||
, m_abbreviation(parentService->abbreviation())
|
||||
@@ -33,8 +32,8 @@ ServiceManagement::ServiceProcess::ServiceProcess(const GroupRequest &groupData,
|
||||
, m_isInDevMode(parentService->devMode())
|
||||
, m_failedStartAttemptCounter(0)
|
||||
, m_stoppedFromRequest(false)
|
||||
, m_pidProc(new QProcess(this))
|
||||
{
|
||||
, m_pidProc(new QProcess(this)),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
|
||||
QStringList args({QStringLiteral("-e"), QString::number(m_groupData.exercisePartitionId()),
|
||||
QStringLiteral("-d"), QString::number(m_groupData.domainId())});
|
||||
|
||||
@@ -59,7 +58,7 @@ ServiceManagement::ServiceProcess::ServiceProcess(const GroupRequest &groupData,
|
||||
#ifndef LTS_DEBUG
|
||||
if (m_name == QStringLiteral("HighLevelArchitecture"))
|
||||
{
|
||||
DEBUG_LOG() <<" START HLA REMOTE";
|
||||
DEBUG_LOG(m_logger) <<" START HLA REMOTE";
|
||||
killallRemote();
|
||||
|
||||
//QString sshCmd = QStringLiteral("ssh ctcap03 '/shd/CTC/SV/bin/svcHighLevelArchitecture %1 &'").arg(arguments().join(QLatin1Char(' ')));
|
||||
@@ -73,7 +72,7 @@ ServiceManagement::ServiceProcess::ServiceProcess(const GroupRequest &groupData,
|
||||
|
||||
if (m_name == QStringLiteral("Buildings"))
|
||||
{
|
||||
DEBUG_LOG() <<" START Buildings Remote";
|
||||
DEBUG_LOG(m_logger) <<" START Buildings Remote";
|
||||
killallRemote();
|
||||
|
||||
//QString sshCmd = QStringLiteral("ssh ctcap03 '/shd/CTC/SV/bin/svcHighLevelArchitecture %1 &'").arg(arguments().join(QLatin1Char(' ')));
|
||||
@@ -116,7 +115,7 @@ Core::RunningState ServiceManagement::ServiceProcess::runningState() const
|
||||
|
||||
bool ServiceManagement::ServiceProcess::start(OpenMode mode)
|
||||
{
|
||||
DEBUG_LOG() << "Starting ServiceProcess "
|
||||
DEBUG_LOG(m_logger) << "Starting ServiceProcess "
|
||||
<< debugInfo()
|
||||
<< " executable: " << program()
|
||||
<< " in dir: " << workingDirectory()
|
||||
@@ -129,10 +128,10 @@ bool ServiceManagement::ServiceProcess::start(OpenMode mode)
|
||||
#ifndef LTS_DEBUG
|
||||
if (m_name == QStringLiteral("HighLevelArchitecture"))
|
||||
{
|
||||
DEBUG_LOG() <<" START HLA REMOTE";
|
||||
DEBUG_LOG(m_logger) <<" START HLA REMOTE";
|
||||
|
||||
//QString sshCmd = QStringLiteral("ssh ctcap03 '/shd/CTC/SV/bin/svcHighLevelArchitecture %1 &echo $! '").arg(arguments().join(QLatin1Char(' ')));
|
||||
//DEBUG_LOG() << sshCmd;
|
||||
//DEBUG_LOG(m_logger) << sshCmd;
|
||||
setProgram(QStringLiteral("ssh"));
|
||||
|
||||
if (state() == QProcess::NotRunning)
|
||||
@@ -140,11 +139,11 @@ bool ServiceManagement::ServiceProcess::start(OpenMode mode)
|
||||
QProcess::start(mode);
|
||||
waitForStarted(5000);
|
||||
}
|
||||
DEBUG_LOG() << program() << " " << arguments().join(QLatin1Char(' '));
|
||||
DEBUG_LOG(m_logger) << program() << " " << arguments().join(QLatin1Char(' '));
|
||||
|
||||
m_pidProc->kill();
|
||||
m_pidProc->setProgram(QStringLiteral("ssh"));
|
||||
//DEBUG_LOG() << sshCmd;
|
||||
//DEBUG_LOG(m_logger) << sshCmd;
|
||||
QStringList args({QStringLiteral("-e"), QString::number(m_groupData.exercisePartitionId()),
|
||||
QStringLiteral("-d"), QString::number(m_groupData.domainId())});
|
||||
setProgram(QStringLiteral("ssh"));
|
||||
@@ -169,26 +168,26 @@ bool ServiceManagement::ServiceProcess::start(OpenMode mode)
|
||||
m_pidProc->waitForReadyRead(5000);
|
||||
});
|
||||
|
||||
DEBUG_LOG() << m_pidProc->program() << " " << m_pidProc->arguments().join(QLatin1Char(' '));
|
||||
DEBUG_LOG(m_logger) << m_pidProc->program() << " " << m_pidProc->arguments().join(QLatin1Char(' '));
|
||||
|
||||
}else if (m_name == QStringLiteral("Buildings"))
|
||||
{
|
||||
DEBUG_LOG() <<" START Buildings REMOTE";
|
||||
DEBUG_LOG(m_logger) <<" START Buildings REMOTE";
|
||||
setProgram(QStringLiteral("ssh"));
|
||||
//QString sshCmd = QStringLiteral("ssh ctcap03 '/shd/CTC/SV/bin/svcHighLevelArchitecture %1 &echo $! '").arg(arguments().join(QLatin1Char(' ')));
|
||||
//DEBUG_LOG() << sshCmd;
|
||||
//DEBUG_LOG(m_logger) << sshCmd;
|
||||
|
||||
if (state() == QProcess::NotRunning)
|
||||
{
|
||||
QProcess::start(mode);
|
||||
waitForStarted(5000);
|
||||
}
|
||||
DEBUG_LOG() << program() << " " << arguments().join(QLatin1Char(' '));
|
||||
DEBUG_LOG(m_logger) << program() << " " << arguments().join(QLatin1Char(' '));
|
||||
|
||||
|
||||
m_pidProc->kill();
|
||||
m_pidProc->setProgram(QStringLiteral("ssh"));
|
||||
//DEBUG_LOG() << sshCmd;
|
||||
//DEBUG_LOG(m_logger) << sshCmd;
|
||||
QStringList args({QStringLiteral("-e"), QString::number(m_groupData.exercisePartitionId()),
|
||||
QStringLiteral("-d"), QString::number(m_groupData.domainId())});
|
||||
setProgram(QStringLiteral("ssh"));
|
||||
@@ -215,7 +214,7 @@ bool ServiceManagement::ServiceProcess::start(OpenMode mode)
|
||||
m_pidProc->waitForReadyRead(5000);
|
||||
});
|
||||
|
||||
DEBUG_LOG() << m_pidProc->program() << " " << m_pidProc->arguments().join(QLatin1Char(' '));
|
||||
DEBUG_LOG(m_logger) << m_pidProc->program() << " " << m_pidProc->arguments().join(QLatin1Char(' '));
|
||||
}
|
||||
else
|
||||
#endif
|
||||
@@ -230,7 +229,7 @@ bool ServiceManagement::ServiceProcess::start(OpenMode mode)
|
||||
}
|
||||
else
|
||||
{
|
||||
ERROR_LOG() << "Could not start service "
|
||||
ERROR_LOG(m_logger) << "Could not start service "
|
||||
<< debugInfo()
|
||||
<< " because there is no licence for it.";
|
||||
return false;
|
||||
@@ -244,7 +243,7 @@ int ServiceManagement::ServiceProcess::serviceProcessId() const
|
||||
|
||||
void ServiceManagement::ServiceProcess::setNewStateFromHeartbeat(const Core::CurrentRunningState &data)
|
||||
{
|
||||
DEBUG_LOG() << "Heartbeat for " << debugInfo() << ", running state: " << data.runningState();
|
||||
DEBUG_LOG(m_logger) << "Heartbeat for " << debugInfo() << ", running state: " << data.runningState();
|
||||
m_failedStartAttemptCounter = 0;
|
||||
m_lastHeartbeatMSec = QDateTime::currentMSecsSinceEpoch();
|
||||
m_runningState = data.runningState();
|
||||
@@ -287,7 +286,7 @@ void ServiceManagement::ServiceProcess::killallRemote()
|
||||
sh.startDetached();
|
||||
#else
|
||||
sh.start();
|
||||
#endif DEBUG_LOG() << "kill remote " << sh.program() << " " << args.join(QLatin1Char(' '));
|
||||
#endif DEBUG_LOG(m_logger) << "kill remote " << sh.program() << " " << args.join(QLatin1Char(' '));
|
||||
}
|
||||
|
||||
void ServiceManagement::ServiceProcess::restart()
|
||||
@@ -420,7 +419,7 @@ void ServiceManagement::ServiceProcess::setNewStateFromChangeRequest(const Core:
|
||||
|
||||
void ServiceManagement::ServiceProcess::onNewInfoFromProc(ProcessState state)
|
||||
{
|
||||
DEBUG_LOG() << "New state for " << debugInfo() << ": " << state;
|
||||
DEBUG_LOG(m_logger) << "New state for " << debugInfo() << ": " << state;
|
||||
QString errString;
|
||||
switch (state)
|
||||
{
|
||||
@@ -428,10 +427,10 @@ void ServiceManagement::ServiceProcess::onNewInfoFromProc(ProcessState state)
|
||||
if (exitStatus() == QProcess::NormalExit)
|
||||
{
|
||||
if (exitCode() == 0)
|
||||
DEBUG_LOG() << "Normal exit for " << debugInfo()
|
||||
DEBUG_LOG(m_logger) << "Normal exit for " << debugInfo()
|
||||
<< ": " << readAllStandardError() << ", " << readAllStandardOutput();
|
||||
else
|
||||
ERROR_LOG() << "Normal exit with exit code " << exitCode() << " for " << debugInfo()
|
||||
ERROR_LOG(m_logger) << "Normal exit with exit code " << exitCode() << " for " << debugInfo()
|
||||
<< ": " << readAllStandardError() << ", " << readAllStandardOutput();
|
||||
m_runningState = Core::RunningState::StoppedNormally;
|
||||
}
|
||||
@@ -452,7 +451,7 @@ void ServiceManagement::ServiceProcess::onNewInfoFromProc(ProcessState state)
|
||||
m_runningState = Core::RunningState::StoppedError;
|
||||
}
|
||||
errString += QLatin1String(" error string: ") + errorString();
|
||||
ERROR_LOG() << "Crashed Error for " << debugInfo() << ", error: " << errorString() << ":\n"
|
||||
ERROR_LOG(m_logger) << "Crashed Error for " << debugInfo() << ", error: " << errorString() << ":\n"
|
||||
<< readAll();
|
||||
}
|
||||
m_parentService->licenceDonator()->freeLicence(m_name);
|
||||
@@ -463,7 +462,7 @@ void ServiceManagement::ServiceProcess::onNewInfoFromProc(ProcessState state)
|
||||
m_runningState = Core::RunningState::Starting;
|
||||
break;
|
||||
case QProcess::Running:
|
||||
DEBUG_LOG() << "Process " << m_name
|
||||
DEBUG_LOG(m_logger) << "Process " << m_name
|
||||
<< " has now the PID " << usablePid();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user