The previous patch, for whatever reason, fails to apply on top of tip. This patch is reimplemented and, hopefully, fixed.
Darryl L. Pierce
2010-May-25 15:34 UTC
[Ovirt-devel] [PATCH matahari] Introduces explicit heartbeat events to the QMF transport.
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
Darryl L. Pierce
2010-May-26 13:43 UTC
[Ovirt-devel] [Matahari] [PATCH matahari] Introduces explicit heartbeat events to the QMF transport.
On Wed, May 26, 2010 at 09:23:44AM +0200, Andrew Beekhof wrote:> Some quick questions... > > Is the interval not being used yet? I don't see any timers or such.Not implemented yet. This patch just introduces the actual heartbeat event over QMF.> Wouldn't you still need to update the network devices in Host::update()?Those are going to get refactored. As it stands they weren't being updated.> Does the heartbeat event need a counter (like ICMP packets do) to > detect backward jumps and/or lost heartbeats?Right now the heartbeat sends out the timestamp. But if the clock gets changed, it could seem to be a backwards jump. Changing it to be a counter instead would be a simple change to this patch for pushing. -- Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc. Delivering value year after year. Red Hat ranks #1 in value among software vendors. http://www.redhat.com/promo/vendor/
Darryl L. Pierce
2010-May-27 17:55 UTC
[Ovirt-devel] [Matahari] [PATCH matahari] Introduces explicit heartbeat events to the QMF transport.
On Thu, May 27, 2010 at 08:43:30AM +0200, Andrew Beekhof wrote:> >> Does the heartbeat event need a counter (like ICMP packets do) to > >> detect backward jumps and/or lost heartbeats? > > > > Right now the heartbeat sends out the timestamp. But if the clock gets changed, it > > could seem to be a backwards jump. Changing it to be a counter instead would > > be a simple change to this patch for pushing. > > I think you'd probably want both. The timestamp and a sequence number.That's cool. Okay, so if this is an ACK with that change (I'll wait for a response) I'll go ahead and push it. -- Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc. Delivering value year after year. Red Hat ranks #1 in value among software vendors. http://www.redhat.com/promo/vendor/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: <http://listman.redhat.com/archives/ovirt-devel/attachments/20100527/2417cf83/attachment.sig>