Heartbeat discussion
by Ryan O'Hara
Darryl and I had a long discussion about heartbeat in Matahari
yesterday. I'll try to hit on the major points.
The first thing towas discussed was that Matahari should only have one
heartbeat timer. I'm only mentioning this now because it was a point
of confusion in the past. If an instance of Matahari has multiple
"subscribers", those subscribers will get heartbeats at the same
interval.
That said, we discussed the API for setting/getting heartbeat
interval. This value would turn out to be a property of Matahari
itself. Our thinking is that we shoud implement 2 API calls:
heartbeat_interval_set (int interval);
heartbeat_interval_get ();
We also discussed whether Mahari should immediately begin sending
heartbeats when it starts or if there is really a nead for API calls
like:
heartbeat_start (int interval);
heartbeat_stop ();
Obviously there is some overlap with heartbeat_start and
heartbeat_interval_set. Is there a compelling reason to use start/stop
API calls rather than just automatically begin sending heartbeats when
Matahari starts?
In addition to the API calls that will call into Mathari, we proposed
a client-side API call that will register a callback to be called when
a heartbeat is received. This would be completely optional. An
alternative for checking health would be to check the timestamp of the
last heartbeat received and verify that it was received within a
certain threshold (ie. a more passive way to check health as opposed
to registering a callback).
Thoughts? Comments are welcome/encouraged.
Ryan
13 years, 12 months
virtio-serial information
by Ryan O'Hara
I have virtio-serial devices working on a handful of guests. Here is
some information about how I configured it, etc.
First, I should point out a few useful resources on the web.
[1] http://fedoraproject.org/wiki/Features/VirtioSerial
[2] http://www.linux-kvm.org/page/VMchannel_Requirements
[3] http://fedorapeople.org/gitweb?p=amitshah/public_git/test-virtserial.git
There is some good informatio here, including examples of how to
create a virtioserial device on the command-line. There is now,
however, much information about configuring these devices from the
guest config file (XML).
Here is what I added to my guest config file:
<controller type='virtio-serial' index='0' ports='4' vectors='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</controller>
And ...
<channel type='unix'>
<source mode='bind' path='/path/to/socket'/>
<target type='virtio' name='org.linux-kvm.port.0'/>
</channel>
It is my understandin that the 'controller' block is not required and
should work with default values. However, there is currently a bug
that requires this block so that we can define ports to be != 0.
Matthew Booth has more information.
With this configuration, I get a UNIX socket on the host and a
character device on the host. Obviously the UNIX socket path can be
defined. In the guest, we'll get a character device and a symlink:
# ls -l /dev/vport0p1
crw-rw----. 1 root root 249, 1 May 13 17:53 /dev/vport0p1
# ls -l /dev/virtio-ports/org.linux-kvm.port.0
lrwxrwxrwx. 1 root root 11 May 13 17:53 /dev/virtio-ports/org.linux-kvm.port.0 -> ../vport0p1
I have a very simple client/service app (in C) that can communicate
over this channel. In a nutshell,
host:
- create socket (AF_UNIX)
- connect to socket
- write to socket
guest:
- open file (char device)
- poll
- read
Very simple. It needs to be improved such that each can handle 2-way
communication, but that should be simple.
Ryan
13 years, 12 months
Matahari and facter
by David Lutterkort
Just a thought: if you are curious what people like to get out of a host
agent for config management, have a look at facter[1], which is puppet's
helper to gather information about a host.
I doubt there's all that much there that hasn't been covered for
Matahari, but if nothing else, it's a godd example for some of the
gyrations you need to go through to determine, e.g., the domain name of
a system, in a portable manner.
David
[1] http://www.puppetlabs.com/puppet/related-projects/facter/
14 years
[PATCH matahari] Moving QMF functionality into a transport layer.
by Darryl L. Pierce
This is the first step towards separating the APIs from the means by
which they are carried between the remote and local system.
Added a few new classes and types:
* HostTransport - defines a type for talking to the Host
* Host - the public contract for the host APIs
* HostAgent - the QMF transport layer
Signed-off-by: Darryl L. Pierce <dpierce(a)redhat.com>
---
.gitignore | 2 +-
src/Makefile.am | 8 +++-
src/host.cpp | 133 +++++++++++++++++++----------------------------
src/host.h | 62 ++++++++++++++--------
src/host_transport.cpp | 33 ++++++++++++
src/host_transport.h | 37 +++++++++++++
src/hostimpl.cpp | 135 ++++++++++++++++++++++++++++++++++++++++++++++++
src/hostimpl.h | 47 +++++++++++++++++
src/main.cpp | 8 ++-
src/qmf/hostagent.cpp | 87 +++++++++++++++++++++++++++++++
src/qmf/hostagent.h | 55 +++++++++++++++++++
11 files changed, 502 insertions(+), 105 deletions(-)
create mode 100644 src/host_transport.cpp
create mode 100644 src/host_transport.h
create mode 100644 src/hostimpl.cpp
create mode 100644 src/hostimpl.h
create mode 100644 src/qmf/hostagent.cpp
create mode 100644 src/qmf/hostagent.h
diff --git a/.gitignore b/.gitignore
index ad6d70b..8e12062 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,4 +17,4 @@ stamp-h1
*~
src/matahari
-src/qmf
+src/qmf/com
diff --git a/src/Makefile.am b/src/Makefile.am
index aed9e19..530abd7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -18,6 +18,10 @@ nodist_matahari_SOURCES = $(generated_file_list) $(first)
matahari_SOURCES = \
host.cpp \
host.h \
+ host_transport.cpp \
+ host_transport.h \
+ hostimpl.cpp \
+ hostimpl.h \
linux_platform.cpp \
linux_platform.h \
main.cpp \
@@ -26,7 +30,9 @@ matahari_SOURCES = \
platform.cpp \
platform.h \
processors.cpp \
- processors.h
+ processors.h \
+ qmf/hostagent.cpp \
+ qmf/hostagent.h
$(generated_file_list): $(generated_file_list)
diff --git a/src/host.cpp b/src/host.cpp
index 34d4550..e755ffa 100644
--- a/src/host.cpp
+++ b/src/host.cpp
@@ -17,103 +17,78 @@
* also available at http://www.gnu.org/copyleft/gpl.html.
*/
-#include <fstream>
-
-#include <libvirt/libvirt.h>
-#include <qpid/management/Manageable.h>
-#include <sys/sysinfo.h>
-#include <sys/utsname.h>
-
#include "host.h"
-#include "platform.h"
-#include "qmf/com/redhat/matahari/Host.h"
-using namespace qpid::management;
using namespace std;
-using qpid::management::Manageable;
-namespace _qmf = qmf::com::redhat::matahari;
-
void
-HostAgent::setup(ManagementAgent* agent)
+Host::set_uuid(const string uuid)
{
- management_object = new _qmf::Host(agent, this);
- agent->addObject(management_object);
-
- // discover the aspects of the host
- processors.setup(agent, this);
- networkdevices = Platform::instance()->get_network_devices();
-
- for(vector<NetworkDeviceAgent>::iterator iter = networkdevices.begin();
- iter != networkdevices.end();
- iter++)
- {
- iter->setup(agent, this);
- }
+ _uuid = uuid;
+}
- struct utsname details;
- string uuid = "Unknown";
- string hostname = "Unknown";
- string hypervisor = "Unknown";
- string architecture = "None";
- unsigned long memory = 0;
- bool beeping = false;
+string
+Host:: get_uuid() const
+{
+ return _uuid;
+}
- ifstream input("/var/lib/dbus/machine-id");
+void
+Host::set_hostname(const string hostname)
+{
+ _hostname = hostname;
+}
- if(input.is_open())
- {
- getline(input, uuid);
- input.close();
- }
+string
+Host::get_hostname() const
+{
+ return _hostname;
+}
- if(!uname(&details))
- {
- hostname = string(details.nodename);
- architecture = string(details.machine);
- }
- else
- {
- throw runtime_error("Unable to retrieve system details");
- }
+void
+Host::set_hypervisor(const string hypervisor)
+{
+ _hypervisor = hypervisor;
+}
- virConnectPtr lvconn = virConnectOpenReadOnly(NULL);
+string
+Host::get_hypervisor() const
+{
+ return _hypervisor;
+}
- if(lvconn)
- {
- hypervisor = string(virConnectGetType(lvconn));
- virConnectClose(lvconn);
- }
+void
+Host::set_architecture(const string architecture)
+{
+ _architecture = architecture;
+}
- struct sysinfo sysinf;
- if(!sysinfo(&sysinf))
- {
- memory = sysinf.totalram / 1024L;
- }
- else
- {
- throw runtime_error("Unable to retrieve system memory details.");
- }
+string
+Host::get_architecture() const
+{
+ return _architecture;
+}
- cout << "memory: " << memory << endl;
+void
+Host::set_memory(const unsigned int memory)
+{
+ _memory = memory;
+}
- management_object->set_uuid(uuid);
- management_object->set_hostname(hostname);
- management_object->set_hypervisor(hypervisor);
- management_object->set_arch(architecture);
- management_object->set_memory(memory);
- management_object->set_beeping(beeping);
+unsigned int
+Host::get_memory() const
+{
+ return _memory;
}
void
-HostAgent::update(void)
+Host::set_beeping(const bool beeping)
{
- processors.update();
+ _beeping = beeping;
+}
- for(vector<NetworkDeviceAgent>::iterator iter = networkdevices.begin();
- iter != networkdevices.end();
- iter++)
- {
- iter->update();
- }
+bool
+Host::is_beeping() const
+{
+ return _beeping;
}
diff --git a/src/host.h b/src/host.h
index d2da776..b2a4a30 100644
--- a/src/host.h
+++ b/src/host.h
@@ -20,39 +20,57 @@
* also available at http://www.gnu.org/copyleft/gpl.html.
*/
-#include <qpid/management/Manageable.h>
-#include <qpid/management/ManagementObject.h>
-#include <qpid/agent/ManagementAgent.h>
+#include <string>
-#include "qmf/com/redhat/matahari/Host.h"
-
-#include "networkdevice.h"
-#include "processors.h"
-
-using namespace qpid::management;
using namespace std;
-using qpid::management::Manageable;
+/*
+ HeartbeatListener defines a type which receives notification
+ when a heartbeat event occurs.
+ */
+class HeartbeatListener
+{
+ public:
+ virtual void heartbeat() = 0;
+};
-class HostAgent : public Manageable
+/*
+ Host represents the public contract for the set of host APIs.
+ */
+class Host
{
private:
- qmf::com::redhat::matahari::Host* management_object;
- ProcessorsAgent processors;
- vector<NetworkDeviceAgent> networkdevices;
+ string _uuid;
+ string _hostname;
+ string _hypervisor;
+ string _architecture;
+ unsigned int _memory;
+ bool _beeping;
public:
- HostAgent() {}
- virtual ~HostAgent() {}
+ void set_uuid(const string uuid);
+ string get_uuid() const;
+
+ void set_hostname(const string hostname);
+ string get_hostname() const;
+
+ void set_hypervisor(const string hypervisor);
+ string get_hypervisor() const;
+
+ void set_architecture(const string architecture);
+ string get_architecture() const;
- ManagementObject* GetManagementObject(void) const { return management_object; }
+ void set_memory(const unsigned int memory);
+ unsigned int get_memory() const;
- void setup(ManagementAgent* agent);
- void update(void);
+ void set_beeping(const bool beeping);
+ bool is_beeping() const;
- // agent methods
- void shutdown(void);
- void reboot(void);
+ virtual void identify(const int iterations) = 0;
+ virtual void subscribe_to_heartbeat(const HeartbeatListener& listener) = 0;
+ virtual void unsubscribe_from_heartbeat(const HeartbeatListener& listener) = 0;
+ virtual void shutdown() = 0;
+ virtual void reboot() = 0;
};
#endif // __HOST_H
diff --git a/src/host_transport.cpp b/src/host_transport.cpp
new file mode 100644
index 0000000..ab89912
--- /dev/null
+++ b/src/host_transport.cpp
@@ -0,0 +1,33 @@
+/* host_transport.cpp - Copyright (C) 2009 Red Hat, Inc.
+ * Written by Arjun Roy <arroy(a)redhat.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA. A copy of the GNU General Public License is
+ * also available at http://www.gnu.org/copyleft/gpl.html.
+ */
+
+#include "host_transport.h"
+
+void
+HostTransport::addHostTransport(HostTransport* nextTransport)
+{
+ if(!_nextTransport)
+ {
+ _nextTransport = nextTransport;
+ }
+ else
+ {
+ this->_nextTransport->addHostTransport(nextTransport);
+ }
+}
diff --git a/src/host_transport.h b/src/host_transport.h
new file mode 100644
index 0000000..a4019ad
--- /dev/null
+++ b/src/host_transport.h
@@ -0,0 +1,37 @@
+#ifndef __HOST_TRANSPORT_H
+#define __HOST_TRANSPORT_H
+
+/* host_transport.h - Copyright (C) 2009 Red Hat, Inc.
+ * Written by Arjun Roy <arroy(a)redhat.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA. A copy of the GNU General Public License is
+ * also available at http://www.gnu.org/copyleft/gpl.html.
+ */
+
+/*
+ HostTransport represents a type that handles transporting data to and from
+ an instance of Host.
+ */
+class HostTransport
+{
+ private:
+ HostTransport* _nextTransport;
+
+ public:
+ // Sets a reference to the next listener in a chain.
+ void addHostTransport(HostTransport* next);
+};
+
+#endif
diff --git a/src/hostimpl.cpp b/src/hostimpl.cpp
new file mode 100644
index 0000000..bb976b7
--- /dev/null
+++ b/src/hostimpl.cpp
@@ -0,0 +1,135 @@
+/* hostimpl.cpp - Copyright (C) 2009 Red Hat, Inc.
+ * Written by Arjun Roy <arroy(a)redhat.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA. A copy of the GNU General Public License is
+ * also available at http://www.gnu.org/copyleft/gpl.html.
+ */
+
+#include <fstream>
+#include <string>
+
+#include <libvirt/libvirt.h>
+#include <sys/sysinfo.h>
+#include <sys/utsname.h>
+
+#include "hostimpl.h"
+#include "platform.h"
+
+using namespace std;
+
+HostImpl::HostImpl()
+{
+ struct utsname details;
+ this->set_uuid(string("Unknown"));
+ this->set_hostname(string("Unknown"));
+ this->set_hypervisor(string("Unknown"));
+ this->set_architecture(string("None"));
+ this->set_memory(0);
+ this->set_beeping(false);
+
+ std::ifstream input("/var/lib/dbus/machine-id");
+
+ if(input.is_open())
+ {
+ string uuid;
+
+ getline(input, uuid);
+ input.close();
+ this->set_uuid(uuid);
+ }
+
+ if(!uname(&details))
+ {
+ this->set_hostname(string(details.nodename));
+ this->set_architecture(string(details.machine));
+ }
+ else
+ {
+ throw runtime_error("Unable to retrieve system details");
+ }
+
+ virConnectPtr lvconn = virConnectOpenReadOnly(NULL);
+
+ if(lvconn)
+ {
+ this->set_hypervisor(string(virConnectGetType(lvconn)));
+ virConnectClose(lvconn);
+ }
+
+ struct sysinfo sysinf;
+ if(!sysinfo(&sysinf))
+ {
+ this->set_memory(sysinf.totalram / 1024L);
+ }
+ else
+ {
+ throw runtime_error("Unable to retrieve system memory details.");
+ }
+}
+
+void
+HostImpl::setup(ManagementAgent* agent, HostAgent* host)
+{
+ // discover the aspects of the host
+ processors.setup(agent, host);
+ networkdevices = Platform::instance()->get_network_devices();
+
+ for(vector<NetworkDeviceAgent>::iterator iter = networkdevices.begin();
+ iter != networkdevices.end();
+ iter++)
+ {
+ iter->setup(agent, host);
+ }
+}
+
+void
+HostImpl::update()
+{
+ processors.update();
+
+ for(vector<NetworkDeviceAgent>::iterator iter = networkdevices.begin();
+ iter != networkdevices.end();
+ iter++)
+ {
+ iter->update();
+ }
+}
+
+void
+HostImpl::identify(const int iterations)
+{
+}
+
+void
+HostImpl:: subscribe_to_heartbeat(const HeartbeatListener& listener)
+{
+}
+
+void
+HostImpl::unsubscribe_from_heartbeat(const HeartbeatListener& listener)
+{
+}
+
+void
+HostImpl::shutdown()
+{
+ // TODO implement an actual shutdown function
+}
+
+void
+HostImpl::reboot()
+{
+ // TODO implement an actual reboot function
+}
diff --git a/src/hostimpl.h b/src/hostimpl.h
new file mode 100644
index 0000000..f5a4e47
--- /dev/null
+++ b/src/hostimpl.h
@@ -0,0 +1,47 @@
+#ifndef __HOSTIMPL_H
+#define __HOSTIMPL_H
+
+/* hostimpl.h - Copyright (C) 2009 Red Hat, Inc.
+ * Written by Arjun Roy <arroy(a)redhat.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA. A copy of the GNU General Public License is
+ * also available at http://www.gnu.org/copyleft/gpl.html.
+ */
+
+#include "host.h"
+#include "qmf/hostagent.h"
+#include "processors.h"
+#include "networkdevice.h"
+
+class HostImpl : public Host
+{
+ private:
+ ProcessorsAgent processors;
+ vector<NetworkDeviceAgent> networkdevices;
+ public:
+ HostImpl();
+ virtual ~HostImpl() {}
+
+ void setup(ManagementAgent* agent, HostAgent* host);
+ void update();
+
+ virtual void identify(const int iterations);
+ virtual void subscribe_to_heartbeat(const HeartbeatListener& listener);
+ virtual void unsubscribe_from_heartbeat(const HeartbeatListener& listener);
+ virtual void shutdown();
+ virtual void reboot();
+};
+
+#endif
diff --git a/src/main.cpp b/src/main.cpp
index 5ab3ac2..05b5ad6 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -32,6 +32,8 @@
#include <getopt.h>
#include "host.h"
+#include "hostimpl.h"
+
#include "qmf/com/redhat/matahari/Package.h"
using namespace qpid::management;
@@ -76,7 +78,8 @@ main(int argc, char **argv)
ConnectionSettings settings;
ManagementAgent *agent;
- HostAgent host;
+ HostImpl host;
+ HostAgent hostAgent(&host);
struct option opt[] = {
{"help", no_argument, NULL, 'h'},
@@ -178,7 +181,8 @@ main(int argc, char **argv)
agent->init(settings, 5, false, ".magentdata");
// Get the info and post it to the broker
- host.setup(agent);
+ hostAgent.setup(agent);
+ host.setup(agent, &hostAgent);
while(1)
{
diff --git a/src/qmf/hostagent.cpp b/src/qmf/hostagent.cpp
new file mode 100644
index 0000000..644679f
--- /dev/null
+++ b/src/qmf/hostagent.cpp
@@ -0,0 +1,87 @@
+/* hostagent.cpp - Copyright (C) 2009 Red Hat, Inc.
+ * Written by Arjun Roy <arroy(a)redhat.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA. A copy of the GNU General Public License is
+ * also available at http://www.gnu.org/copyleft/gpl.html.
+ */
+
+#include "hostagent.h"
+#include <qpid/agent/ManagementAgent.h>
+
+namespace _qmf = qmf::com::redhat::matahari;
+
+HostAgent::HostAgent(Host* host)
+ :_host(host)
+{}
+
+void
+HostAgent::setup(ManagementAgent* agent)
+{
+ _management_object = new _qmf::Host(agent, this);
+ agent->addObject(_management_object);
+
+ _management_object->set_uuid(_host->get_uuid());
+ _management_object->set_hostname(_host->get_hostname());
+ _management_object->set_hypervisor(_host->get_hypervisor());
+ _management_object->set_arch(_host->get_architecture());
+ _management_object->set_memory(_host->get_memory());
+ _management_object->set_beeping(_host->is_beeping());
+}
+
+Manageable::status_t
+HostAgent::ManagementMethod(uint32_t method, Args& arguments, string& text)
+{
+ switch(method)
+ {
+ case _qmf::Host::METHOD_SHUTDOWN:
+ _host->shutdown();
+ return Manageable::STATUS_OK;
+ case _qmf::Host::METHOD_REBOOT:
+ _host->reboot();
+ return Manageable::STATUS_OK;
+ }
+
+ return Manageable::STATUS_NOT_IMPLEMENTED;
+}
+
+void
+HostAgent::identify(const int iterations)
+{
+ // TODO
+}
+
+void
+HostAgent::subscribe_to_heartbeat(const HeartbeatListener& listener)
+{
+ // TODO
+}
+
+void
+HostAgent::unsubscribe_from_heartbeat(const HeartbeatListener& listener)
+{
+ // TODO
+}
+
+void
+HostAgent::shutdown()
+{
+ _host->shutdown();
+}
+
+void
+HostAgent::reboot()
+{
+ _host->reboot();
+}
diff --git a/src/qmf/hostagent.h b/src/qmf/hostagent.h
new file mode 100644
index 0000000..1262e42
--- /dev/null
+++ b/src/qmf/hostagent.h
@@ -0,0 +1,55 @@
+#ifndef __HOSTAGENT_H
+#define __HOSTAGENT_H
+
+/* hostagent.h - Copyright (C) 2009 Red Hat, Inc.
+ * Written by Arjun Roy <arroy(a)redhat.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA. A copy of the GNU General Public License is
+ * also available at http://www.gnu.org/copyleft/gpl.html.
+ */
+
+#include <qpid/management/Manageable.h>
+
+#include "host.h"
+#include "host_transport.h"
+
+#include "qmf/com/redhat/matahari/Host.h"
+
+using namespace qpid::management;
+
+class HostAgent : public Manageable, public Host, public HostTransport, public HeartbeatListener
+{
+ private:
+ qmf::com::redhat::matahari::Host* _management_object;
+ Host* _host;
+
+ public:
+ HostAgent(Host* host);
+ virtual ~HostAgent() {}
+
+ void setup(ManagementAgent* agent);
+ ManagementObject* GetManagementObject() const { return _management_object; }
+ status_t ManagementMethod(uint32_t method, Args& arguments, string& text);
+
+ virtual void identify(const int iterations);
+ virtual void subscribe_to_heartbeat(const HeartbeatListener& listener);
+ virtual void unsubscribe_from_heartbeat(const HeartbeatListener& listener);
+ virtual void shutdown();
+ virtual void reboot();
+
+ virtual void heartbeat() {}
+};
+
+#endif
--
1.6.6.1
14 years
Matahari + virtio-serial
by Ryan O'Hara
I learned some new things about virtio-serial that are worth
mentioning.
First, the configuration I am using with some F12 guests is not true
virtio-serial. Rather, it is just serial port emulation in the guest
which maps to a UNIX socket on the host. This is how fence-virtd
works, but it is my understanding that we do not want to go this
route. By using the virtio-serial, the device created in the guest
will not be a true serial device (as in fence-virtd). Rather, we'll
have a plain character device for communication. This should be much
more simple.
To get true virtio-serial support, we'll need F13. I'm currently
working on getting F13 beta installed and some VMs created.
In the meantime, we should being looking at implementing heartbeat
over QMF. Darryl, do you have time to discuss this? Perhaps we should
schedule a call to hammer-out some details and then post our thoughts
to the list.
Ryan
14 years
Migrating Matahari to Python...
by Darryl L. Pierce
Therw was some discussion today about converting the Matahari codebase
over to Python from C++. Since Matahari is fairly young at this point
and not feature rich, it would be a good time to change languages if we
were to do so.
However, in discussing things with Ian, I think that there's not really
that much of an advantage to going from C++ to Python.
I know some are concerned that, with C++, there's the chance that the
code could become hard to maintain.
And proffered as an advantage of using Python is the speed of
development. Though this is debatable.
A pro in favor of staying with the C++ code is that the QMF framework is
itself being developed primarily in C++ and the Python bindings are a
port based on that C++ code. Also speed of execution and reduced
dependencies in using C++ over Python.
What are everybody's thoughts on this topic? Is there an advantage to be
gained in switching to Python or should we stay with the C++ codebase?
The Python code for QMF is not yet available, but is scheduled to come
out with F13/RHEL6.
--
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/
14 years
Patch supercedes previous patch...
by Darryl L. Pierce
In looking at the code I realized that the last of the HAL depenencies were
removed with this patch. So, I'm pushing an updated patch that contains
none of the HAL code in it.
14 years