matahari on RHEL5
by Roman Rakus
Hi all. I'm trying to build and run matahari on RHEL5. Here is status so far.
qpid-cpp is not in RHEL5 cvs branch, but RHEL6's could work.
in qpid-cpp.spec set global flag `rhel_5' to 1 and I get:
DEBUG util.py:256: No Package Found for xqilla-devel
DEBUG util.py:256: No Package Found for xerces-c-devel
- Both are in brew, so probably just only need to move them to build root.
sigar - in cvs but not built, older version than in RHEL6
matahari
Got ../lib/libmcommon.so.1.0.0: undefined reference to `__ns_name_uncompress' (and 2 more) - looks like a bug in libresolv, not exported symbols (glibc doh :( )
package 'polkit-gobject-1' not found - policy kit is not in RHEL6
So I think we can drop dbus support for RHEL5.
One question - does anybody know how to easily fix those undefined references?
RR
12 years, 10 months
Summary
by Adam Stokes
These are a work in progress but I thought I'd send them up to perhaps get some
futher ideas on making anaconda/puppet automagically set everything up for the
administrator.
A couple ideas I do have are possibly providing some conditionals within puppet/ks
to:
- allow SSL/Kerberos to be enabled and configured.
- Pre-define federated brokers
Should we do any integration tests during kickstart/puppet to verify the custom
entered hostnames, brokers are resolvable and accessible?
Thanks
12 years, 10 months
[PATCH] Perform host domain lookup in t_dnssrv.c
by Antoine van Gelder
Perform host domain lookup in t_dnssrv.c
Added gethostdomain()
Modified test to use gethostdomain() for domain lookup
Modified test to do SRV lookup for _matahari._tcp as per Bug# 688199
Signed-off-by: Antoine van Gelder <antoine(a)7degrees.co.za>
---
src/tests/t_dnssrv.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 50 insertions(+), 2 deletions(-)
diff --git a/src/tests/t_dnssrv.c b/src/tests/t_dnssrv.c
index 91b2772..855a6f3 100644
--- a/src/tests/t_dnssrv.c
+++ b/src/tests/t_dnssrv.c
@@ -16,22 +16,70 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <sys/utsname.h>
+#include <netdb.h>
+#include <string.h>
+#include <stdio.h>
#include <glib.h>
#include "dnssrv_private.h"
+
+int
+gethostdomain(char* domain, size_t domainlen)
+{
+ struct utsname sysinfo;
+ struct addrinfo hints, *res, *p;
+ int error;
+ char* offset;
+
+ if (uname(&sysinfo) != 0) {
+ return -1;
+ }
+
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = AF_UNSPEC;
+ hints.ai_socktype = SOCK_STREAM;
+ hints.ai_flags = AI_CANONNAME;
+
+ if ((error = getaddrinfo(sysinfo.nodename, NULL, &hints, &res)) != 0) {
+ printf("warning: %s", gai_strerror(error));
+ goto fail;
+ }
+
+ /* strip host from fqdn */
+ if ((offset = strchr(res->ai_canonname, '.')) == NULL) {
+ goto fail;
+ }
+ strncpy(domain, ++offset, domainlen);
+ freeaddrinfo(res);
+
+ return 0;
+
+fail:
+ freeaddrinfo(res);
+ return -1;
+}
+
+
int main(int argc, char **argv)
{
struct srv_reply **srvl = NULL, *srv = NULL;
int i;
- if (srvl = srv_lookup("qpid-broker", "tcp", "qpid-broker:49000")) {
+ char hostdomain[MAX_NAME_LEN];
+ if (gethostdomain(hostdomain, sizeof hostdomain) != 0) {
+ perror("Could not determine host domain");
+ return 0;
+ }
+
+ if (srvl = srv_lookup("matahari", "tcp", hostdomain)) {
srv = *srvl;
for (i = 1; srvl[i]; i++) {
if (srvl[i]->prio < srv->prio)
srv = srvl[i];
}
- fprintf("\tAccessible QPID Broker: %s\n", srv->name);
+ printf("\tAccessible QPID Broker: %s\n", srv->name);
return 0;
}
return -1;
--
1.7.5.2
12 years, 10 months
Summary
by Adam Stokes
So attempting to build this project I receive these warnings:
CMake Warning (dev) at CMakeLists.txt:115 (configure_file):
Syntax error in cmake code when parsing string
for $name in ${array[@]}
syntax error, unexpected cal_SYMBOL, expecting } (26)
Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at CMakeLists.txt:115 (configure_file):
Syntax error in cmake code when parsing string
if [ ${#FEDERATED_BROKERS[@]} -gt 0 ]; then
syntax error, unexpected cal_SYMBOL, expecting } (31)
Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at CMakeLists.txt:115 (configure_file):
Syntax error in cmake code when parsing string
federate ${FEDERATED_BROKERS[@]}
syntax error, unexpected cal_SYMBOL, expecting } (38)
Policy CMP0010 is not set: Bad variable reference syntax is an error. Run
"cmake --help-policy CMP0010" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.
----
I believe this is primarily cmake only since the code itself runs without error.
>From what I can tell im supposed to issue a cmake_policy somewhere to either
ignore these errors or remove them?
Thanks
Adam
12 years, 10 months
[PATCH] - Broker initialization update
by Adam Stokes
- Provided array variable for defining DNS SRV records or
a fqdn:port
- Based on FEDERATED_BROKERS array if DNS SRV record exist
format dns query answer into <fqdn>:<port>, otherwise
process as is.
- Attempt to setup bidirectional communication with all defined
brokers.
- Setup a qpid-route TIMEOUT variable so we aren't waiting longer
than 5 seconds for a broker to respond.
Signed-off-by: Adam Stokes <astokes(a)fedoraproject.org>
---
matahari-broker.init.in | 43 +++++++++++++++++++++++++++++++++++++++++++
matahari-broker.sysconf.in | 8 ++++++++
2 files changed, 51 insertions(+), 0 deletions(-)
diff --git a/matahari-broker.init.in b/matahari-broker.init.in
index 13a535d..3d53ef2 100755
--- a/matahari-broker.init.in
+++ b/matahari-broker.init.in
@@ -42,6 +42,8 @@ pidfile=@localstatedir(a)/run/matahari-broker.pid
# Turn off automatic systemd redirects
SYSTEMCTL_SKIP_REDIRECT=1
+# Timeout for qpid-route in seconds
+TIMEOUT=5
# Source function library.
. @sysconfdir(a)/rc.d/init.d/functions
@@ -50,6 +52,42 @@ if [ -f @sysconfdir@/sysconfig/matahari-broker ] ; then
fi
RETVAL=0
+# Enable broker federation
+federate() {
+ for (( i=0; i<$1; i++ ));
+ do
+ case ${FEDERATED_BROKERS[$i]} in
+ *_matahari-broker._tcp*)
+ RESP=`dig SRV ${FEDERATED_BROKERS[$i]} +short| awk '{print $4":"$3}'|sed 's/\.:/:/'`
+ array[${#array[*]}]=$RESP
+ ;;
+ *)
+ array[${#array[*]}]="${FEDERATED_BROKERS[$i]}"
+ ;;
+ esac
+ done
+
+ for (( i=0; i<${#array[@]}; i++ ));
+ do
+ /usr/bin/qpid-route --timeout=$TIMEOUT dynamic add ${array[$i]} \
+ localhost:$MATAHARI_PORT amq.direct &> /dev/null
+
+ /usr/bin/qpid-route --timeout=$TIMEOUT dynamic add localhost:$MATAHARI_PORT \
+ ${array[$i]} amq.direct &> /dev/null
+
+ /usr/bin/qpid-route --timeout=$TIMEOUT dynamic add ${array[$i]} \
+ localhost:$MATAHARI_PORT qmf.default.direct &> /dev/null
+
+ /usr/bin/qpid-route --timeout=$TIMEOUT dynamic add localhost:$MATAHARI_PORT \
+ ${array[$i]} qmf.default.direct &> /dev/null
+
+ /usr/bin/qpid-route --timeout=$TIMEOUT dynamic add ${array[$i]} \
+ localhost:$MATAHARI_PORT qmf.default.topic &> /dev/null
+
+ /usr/bin/qpid-route --timeout=$TIMEOUT dynamic add localhost:$MATAHARI_PORT \
+ ${array[$i]} qmf.default.topic &> /dev/null
+ done
+}
start() {
echo -n $"Starting Matahari broker daemon: "
@@ -64,6 +102,11 @@ start() {
[ -x /sbin/restorecon ] && /sbin/restorecon $pidfile
runuser -s /bin/sh qpidd -c "/usr/sbin/$prog --check --pid-dir @localstatedir@/run/matahari $QPIDD_OPTIONS > $pidfile"
fi
+ broker_len=${#FEDERATED_BROKERS[@]}
+ if [ $broker_len -gt 0 ]; then
+ federate $broker_len
+ RETVAL=0
+ fi
return $RETVAL
}
diff --git a/matahari-broker.sysconf.in b/matahari-broker.sysconf.in
index 9b1c2b5..4473610 100644
--- a/matahari-broker.sysconf.in
+++ b/matahari-broker.sysconf.in
@@ -11,3 +11,11 @@ fi
QPIDD_OPTIONS="--config @sysconfdir(a)/matahari-broker.conf --port $MATAHARI_PORT"
+# Federated Broker configuration
+# Takes the following formats:
+# <fqdn>:<port>
+# DNS SRV record format "_matahari-broker._tcp" is REQUIRED
+# _matahari-broker._tcp.<fqdn>
+#
+# A mixture of the above is acceptable.
+# FEDERATED_BROKERS=("broker1.example.com:49000" "_matahari-broker._tcp.example.com")
--
1.7.6
12 years, 10 months
/var/lib/dbus/machine_id, imagefactory, and matahari
by Steven Dake
Currently most linux distributions that use dbus store a UUID in
/var/lib/dbus/machine_id. In our pacemaker-cloud work test tools, we
must manipulate this file via oz image creation to match a value we know
about.
Q1. Is this file freshly created on each image creation/cloning process?
If not, it should be, because Matahari uses this information to uniquely
identify a host. If it is copied exactly to each new image, that
creates a problem (all hosts appear the same to matahari).
Q2. If/when it is created by image factory, will it be stored in a
database or other storage medium?
In pacemaker-cloud we need to have a mapping from image->internal id id
so that we know which VM maps to which deployable HA configuration.
If we wait on this point until after our 1.0 release, we could end up
with a bunch of images in the field that have either the same machine id
or are not mapped in any way that allows us to provide HA functionality.
Regards
-steve
12 years, 10 months
[PATCH] Disable systemd support in RHEL6 and below
by Adam Stokes
- RHEL6 and previous releases do not provide
systemd as its initialization framework.
Signed-off-by: Adam Stokes <astokes(a)fedoraproject.org>
---
matahari.spec | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/matahari.spec b/matahari.spec
index a4311df..44a79f5 100644
--- a/matahari.spec
+++ b/matahari.spec
@@ -11,6 +11,9 @@
# Systemd init scripts
%bcond_without systemd
+%if 0%{?rhel} <= 6
+%bcond_with systemd
+%endif
Name: matahari
Version: 0.4.2
--
1.7.6
12 years, 10 months
[PATCH] - Add mh_qmf_connect routine
by Adam Stokes
- Cleans up connection logic, runs indefinately.
- DNSSRV URI is stored in urlMap if URI exists
Signed-off-by: Adam Stokes <astokes(a)fedoraproject.org>
---
src/lib/mh_agent.cpp | 75 ++++++++++++++++++++++++++------------------------
1 files changed, 39 insertions(+), 36 deletions(-)
diff --git a/src/lib/mh_agent.cpp b/src/lib/mh_agent.cpp
index 0d464d9..f4aedad 100644
--- a/src/lib/mh_agent.cpp
+++ b/src/lib/mh_agent.cpp
@@ -133,6 +133,33 @@ mh_qpid_disconnect(gpointer user_data)
mh_err("Qpid connection closed");
}
+struct MatahariAgentImpl *
+mh_qmf_connect(qpid::types::Variant::Map &urlMap, qpid::types::Variant::Map &options,
+ struct MatahariAgentImpl *_impl)
+{
+ _impl->_amqp_connection = qpid::messaging::Connection(urlMap["uri"], options);
+ try {
+ _impl->_amqp_connection.open();
+ } catch (const std::exception& err) {
+ while (!_impl->_amqp_connection.isOpen()) {
+ mh_info("Trying DNS SRV");
+ _impl->_amqp_connection = qpid::messaging::Connection(urlMap["dnssrv"], options);
+ try {
+ _impl->_amqp_connection.open();
+ } catch (const std::exception& err2) {
+ mh_info("Trying qpid broker %s again", urlMap["servername"].asString().c_str());
+ _impl->_amqp_connection = qpid::messaging::Connection(urlMap["uri"], options);
+ try {
+ _impl->_amqp_connection.open();
+ } catch (const std::exception& err3) {
+ g_usleep(G_USEC_PER_SEC);
+ }
+ }
+ }
+ }
+
+ return _impl;
+}
typedef struct mh_opt_s
{
@@ -266,6 +293,8 @@ mh_parse_options(const char *proc_name, int argc, char **argv, qpid::types::Vari
struct option *long_opts = (struct option *)calloc(1, sizeof(struct option));
struct addrinfo hints, *res;
int rc, arg;
+ char query[NS_MAXDNAME];
+ char target[NS_MAXDNAME];
/* Force more local-only processing */
mh_add_option('h', no_argument, "help", NULL, NULL, NULL);
@@ -381,6 +410,15 @@ mh_parse_options(const char *proc_name, int argc, char **argv, qpid::types::Vari
}
url << "amqp:" << urlMap["protocol"] << ":" << urlMap["servername"] << ":" << urlMap["serverport"] ;
urlMap["uri"] = url.str();
+ // Go ahead and verify if this is a DNS SRV record
+ g_snprintf(query, sizeof(query), "_matahari._tcp.%s",
+ urlMap["servername"].asString().c_str());
+ rc = mh_srv_lookup(query, target, sizeof(target));
+ if (rc == 0) {
+ std::stringstream dnsuri;
+ url << target << ":" << urlMap["serverport"];
+ urlMap["dnssrv"] = dnsuri.str();
+ }
return urlMap;
}
@@ -452,42 +490,7 @@ MatahariAgent::init(int argc, char **argv, const char* proc_name)
mh_info("Connecting %s to Qpid broker at %s", proc_name, urlMap["uri"].asString().c_str());
- // TODO: Write routine to clean the below up for testing connections and building uris
- _impl->_amqp_connection = qpid::messaging::Connection(urlMap["uri"], options);
- try {
- _impl->_amqp_connection.open();
- } catch (const std::exception& err) {
- while (!_impl->_amqp_connection.isOpen()) {
- mh_info("Trying DNS SRV");
- std::stringstream url;
- url << "amqp:" << urlMap["protocol"] << ":";
- int ret;
- char query[NS_MAXDNAME];
- char target[NS_MAXDNAME];
- g_snprintf(query, sizeof(query), "_matahari._tcp.%s",
- urlMap["servername"].asString().c_str());
- ret = mh_srv_lookup(query, target, sizeof(target));
- if (ret == 0) {
- url << target << ":" << urlMap["serverport"];
- urlMap["uri"] = url.str();
- }
- _impl->_amqp_connection = qpid::messaging::Connection(urlMap["uri"], options);
- try {
- _impl->_amqp_connection.open();
- } catch (const std::exception& err2) {
- mh_info("Trying qpid broker %s again", urlMap["servername"].asString().c_str());
- url << "amqp:" << urlMap["protocol"] << ":";
- url << urlMap["servername"] << ":" << urlMap["serverport"];
- urlMap["uri"] = url.str();
- _impl->_amqp_connection = qpid::messaging::Connection(urlMap["uri"], options);
- try {
- _impl->_amqp_connection.open();
- } catch (const std::exception& err3) {
- g_usleep(G_USEC_PER_SEC);
- }
- }
- }
- }
+ mh_qmf_connect(urlMap, options, _impl);
_impl->_agent_session = qmf::AgentSession(_impl->_amqp_connection);
_impl->_agent_session.setVendor("matahariproject.org");
--
1.7.6
12 years, 10 months