[Ovirt-devel] [PATCH matahari] Introduces explicit heartbeat events to the QMF transport.
Darryl L. Pierce
dpierce at redhat.com
Tue May 25 15:34:04 UTC 2010
Signed-off-by: Darryl L. Pierce <dpierce at redhat.com>
---
src/Makefile.am | 2 ++
src/host.cpp | 9 ++++++---
src/qmf/hostagent.cpp | 5 ++++-
src/qmf/hostagent.h | 7 +++++--
src/schema.xml | 6 ++++++
5 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index 498ee72..d830031 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -5,6 +5,8 @@ sbin_PROGRAMS = matahari
first = qmf/com/redhat/matahari/Host.cpp
generated_file_list = \
+ qmf/com/redhat/matahari/EventHeartbeat.cpp \
+ qmf/com/redhat/matahari/EventHeartbeat.h \
qmf/com/redhat/matahari/Host.h \
qmf/com/redhat/matahari/NetworkDevice.cpp \
qmf/com/redhat/matahari/NetworkDevice.h \
diff --git a/src/host.cpp b/src/host.cpp
index 29b84ec..d9bd698 100644
--- a/src/host.cpp
+++ b/src/host.cpp
@@ -101,11 +101,14 @@ Host::update()
{
_processors.update();
- for(vector<NetworkDeviceAgent>::iterator iter = _networkdevices.begin();
- iter != _networkdevices.end();
+ time_t __time;
+ time(&__time);
+
+ for(set<HostListener*>::iterator iter = _listeners.begin();
+ iter != _listeners.end();
iter++)
{
- iter->update();
+ (*iter)->heartbeat((unsigned long)__time);
}
}
diff --git a/src/qmf/hostagent.cpp b/src/qmf/hostagent.cpp
index 9807f65..7376f69 100644
--- a/src/qmf/hostagent.cpp
+++ b/src/qmf/hostagent.cpp
@@ -20,7 +20,7 @@
#include "hostagent.h"
#include <qpid/agent/ManagementAgent.h>
-namespace _qmf = qmf::com::redhat::matahari;
+#include "qmf/com/redhat/matahari/EventHeartbeat.h"
HostAgent::HostAgent(Host& host)
:_host(host)
@@ -35,6 +35,8 @@ HostAgent::~HostAgent()
void
HostAgent::setup(ManagementAgent* agent)
{
+ this->_agent = agent;
+
_management_object = new _qmf::Host(agent, this);
agent->addObject(_management_object);
@@ -65,4 +67,5 @@ HostAgent::ManagementMethod(uint32_t method, Args& arguments, string& text)
void
HostAgent::heartbeat(unsigned long timestamp)
{
+ this->_agent->raiseEvent(_qmf::EventHeartbeat(timestamp));
}
diff --git a/src/qmf/hostagent.h b/src/qmf/hostagent.h
index 6d2f2a0..f9a6f8e 100644
--- a/src/qmf/hostagent.h
+++ b/src/qmf/hostagent.h
@@ -31,11 +31,14 @@
using namespace qpid::management;
using namespace std;
+namespace _qmf = qmf::com::redhat::matahari;
+
class HostAgent : public Manageable, public HostListener
{
private:
- qmf::com::redhat::matahari::Host* _management_object;
- Host& _host;
+ _qmf::Host* _management_object;
+ Host& _host;
+ ManagementAgent* _agent;
public:
HostAgent(Host& host);
diff --git a/src/schema.xml b/src/schema.xml
index 206e39b..31abb35 100644
--- a/src/schema.xml
+++ b/src/schema.xml
@@ -14,6 +14,12 @@
</class>
+ <eventArguments>
+ <arg name="timestamp" type="absTime" />
+ </eventArguments>
+
+ <event name="heartbeat" args="timestamp" />
+
<!-- The processor for the node. -->
<class name="Processors">
<property name="host" type="objId" access="RC" desc="The host machine." index="y" references="Host" parentRef="y" />
--
1.6.6.1
More information about the ovirt-devel
mailing list